Avoid nil in usermembermap (discord). See #198

This commit is contained in:
Wim 2017-06-15 22:29:01 +02:00
parent 3f79da84d5
commit 4b839b9958
1 changed files with 2 additions and 1 deletions

View File

@ -169,10 +169,11 @@ func (b *bdiscord) getNick(user *discordgo.User) string {
} }
} }
// if we didn't find nick, search for it // if we didn't find nick, search for it
b.userMemberMap[user.ID], err = b.c.GuildMember(b.guildID, user.ID) member, err := b.c.GuildMember(b.guildID, user.ID)
if err != nil { if err != nil {
return user.Username return user.Username
} }
b.userMemberMap[user.ID] = member
// only return if nick is set // only return if nick is set
if b.userMemberMap[user.ID].Nick != "" { if b.userMemberMap[user.ID].Nick != "" {
return b.userMemberMap[user.ID].Nick return b.userMemberMap[user.ID].Nick