[liverole] Fix: Take username from member information

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-08-30 22:28:12 +02:00
parent 9bc19f0451
commit 60146d4fe1
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -77,10 +77,7 @@ func (m modLiveRole) handlePresenceUpdate(d *discordgo.Session, p *discordgo.Pre
return return
} }
logger := log.WithFields(log.Fields{ logger := log.WithField("user", p.User.ID)
"name": p.User.Username,
"user": p.User.ID,
})
member, err := d.GuildMember(p.GuildID, p.User.ID) member, err := d.GuildMember(p.GuildID, p.User.ID)
if err != nil { if err != nil {
@ -88,6 +85,8 @@ func (m modLiveRole) handlePresenceUpdate(d *discordgo.Session, p *discordgo.Pre
return return
} }
logger = logger.WithField("name", member.User.String())
// @attr role_streamers optional string "" Only take members with this role ID into account // @attr role_streamers optional string "" Only take members with this role ID into account
roleStreamer := m.attrs.MustString("role_streamers", ptrStringEmpty) roleStreamer := m.attrs.MustString("role_streamers", ptrStringEmpty)
if roleStreamer != "" && !str.StringInSlice(roleStreamer, member.Roles) { if roleStreamer != "" && !str.StringInSlice(roleStreamer, member.Roles) {