Trim nick whitespace when looking up the guild members (discord) (#2072)

this fixes the matching to attempt to find avatars

fixes #2059
This commit is contained in:
Brian S. Stephan 2024-05-23 17:19:31 -05:00 committed by GitHub
parent 2e9db32a83
commit 6edd5de3b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -68,7 +68,7 @@ func (b *Bdiscord) getGuildMemberByNick(nick string) (*discordgo.Member, error)
b.membersMutex.RLock() b.membersMutex.RLock()
defer b.membersMutex.RUnlock() defer b.membersMutex.RUnlock()
if member, ok := b.nickMemberMap[nick]; ok { if member, ok := b.nickMemberMap[strings.TrimSpace(nick)]; ok {
return member, nil return member, nil
} }
return nil, errors.New("Couldn't find guild member with nick " + nick) // This will most likely get ignored by the caller return nil, errors.New("Couldn't find guild member with nick " + nick) // This will most likely get ignored by the caller