Avoid nil in usermembermap (discord). See #198
This commit is contained in:
parent
3f79da84d5
commit
4b839b9958
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue