mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-12-24 18:25:40 +00:00
This commit is contained in:
parent
9b320cd43f
commit
0abf4d5d5d
@ -89,7 +89,7 @@ func (b *Bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat
|
||||
|
||||
// set username
|
||||
if !b.GetBool("UseUserName") {
|
||||
rmsg.Username = b.getNick(m.Author)
|
||||
rmsg.Username = b.getNick(m.Author, m.GuildID)
|
||||
} else {
|
||||
rmsg.Username = m.Author.Username
|
||||
if b.GetBool("UseDiscriminator") {
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
func (b *Bdiscord) getNick(user *discordgo.User) string {
|
||||
func (b *Bdiscord) getNick(user *discordgo.User, guildID string) string {
|
||||
b.membersMutex.RLock()
|
||||
defer b.membersMutex.RUnlock()
|
||||
|
||||
@ -23,9 +23,9 @@ func (b *Bdiscord) getNick(user *discordgo.User) string {
|
||||
}
|
||||
|
||||
// If we didn't find nick, search for it.
|
||||
member, err := b.c.GuildMember(b.guildID, user.ID)
|
||||
member, err := b.c.GuildMember(guildID, user.ID)
|
||||
if err != nil {
|
||||
b.Log.Warnf("Failed to fetch information for member %#v on guild %#v: %s", user, b.guildID, err)
|
||||
b.Log.Warnf("Failed to fetch information for member %#v on guild %#v: %s", user, guildID, err)
|
||||
return user.Username
|
||||
} else if member == nil {
|
||||
b.Log.Warnf("Got no information for member %#v", user)
|
||||
|
Loading…
Reference in New Issue
Block a user