5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 12:50:27 +00:00

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

View File

@ -169,10 +169,11 @@ func (b *bdiscord) getNick(user *discordgo.User) string {
}
}
// 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 {
return user.Username
}
b.userMemberMap[user.ID] = member
// only return if nick is set
if b.userMemberMap[user.ID].Nick != "" {
return b.userMemberMap[user.ID].Nick