5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-26 00:51:36 +00:00

Fix #1027: warning when handling inbound webhooks (discord) (#1044)

This commit is contained in:
Qais Patankar 2020-03-18 22:12:48 +00:00 committed by GitHub
parent 79f764c7a8
commit 9e3bd7398c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,12 +90,12 @@ func (b *Bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat
// set channel name // set channel name
rmsg.Channel = b.getChannelName(m.ChannelID) rmsg.Channel = b.getChannelName(m.ChannelID)
// set username fromWebhook := m.WebhookID != ""
if !b.GetBool("UseUserName") { if !fromWebhook && !b.GetBool("UseUserName") {
rmsg.Username = b.getNick(m.Author, m.GuildID) rmsg.Username = b.getNick(m.Author, m.GuildID)
} else { } else {
rmsg.Username = m.Author.Username rmsg.Username = m.Author.Username
if b.GetBool("UseDiscriminator") { if !fromWebhook && b.GetBool("UseDiscriminator") {
rmsg.Username += "#" + m.Author.Discriminator rmsg.Username += "#" + m.Author.Discriminator
} }
} }