summaryrefslogtreecommitdiffstats
path: root/bridge/discord/handlers.go
diff options
context:
space:
mode:
authorQais Patankar <qaisjp@gmail.com>2020-03-18 22:12:48 +0000
committerGitHub <noreply@github.com>2020-03-18 23:12:48 +0100
commit9e3bd7398cd153637f084cf4b5e6f01e567b491c (patch)
tree8dbb3a85008cf8d0e93f483f3c500a98a528e45e /bridge/discord/handlers.go
parent79f764c7a8e6449092a2a57eafdc597409263e32 (diff)
downloadmatterbridge-msglm-9e3bd7398cd153637f084cf4b5e6f01e567b491c.tar.gz
matterbridge-msglm-9e3bd7398cd153637f084cf4b5e6f01e567b491c.tar.bz2
matterbridge-msglm-9e3bd7398cd153637f084cf4b5e6f01e567b491c.zip
Fix #1027: warning when handling inbound webhooks (discord) (#1044)
Diffstat (limited to 'bridge/discord/handlers.go')
-rw-r--r--bridge/discord/handlers.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/bridge/discord/handlers.go b/bridge/discord/handlers.go
index 2527c0db..2313390e 100644
--- a/bridge/discord/handlers.go
+++ b/bridge/discord/handlers.go
@@ -90,12 +90,12 @@ func (b *Bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat
// set channel name
rmsg.Channel = b.getChannelName(m.ChannelID)
- // set username
- if !b.GetBool("UseUserName") {
+ fromWebhook := m.WebhookID != ""
+ if !fromWebhook && !b.GetBool("UseUserName") {
rmsg.Username = b.getNick(m.Author, m.GuildID)
} else {
rmsg.Username = m.Author.Username
- if b.GetBool("UseDiscriminator") {
+ if !fromWebhook && b.GetBool("UseDiscriminator") {
rmsg.Username += "#" + m.Author.Discriminator
}
}