Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 674afdc4e2e255df8cf5815f768d6044a35edd0c Author: anon724 <30612019+anon724@users.noreply.github.com> Date: Tue Aug 01 09:18:55 2017 +0000 Add UseUserName option (discord) (#234) diff --git a/bridge/config/config.go b/bridge/config/config.go index c03a3ab..a90cb9a 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -776 +777 @@ type Protocol struct {   UseSASL bool // IRC   UseTLS bool // IRC   UseFirstName bool // telegram + UseUserName bool // discord   UseInsecureURL bool // telegram   WebhookBindAddress string // mattermost, slack   WebhookURL string // mattermost, slack diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go index 926aa80..4b32565 100644 --- a/bridge/discord/discord.go +++ b/bridge/discord/discord.go @@ -1817 +18112 @@ func (b *bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat   if b.UseChannelID {   rmsg.Channel = "ID:" + m.ChannelID   } - rmsg.Username = b.getNick(m.Author) + + if !b.Config.UseUserName { + rmsg.Username = b.getNick(m.Author) + } else { + rmsg.Username = m.Author.Username + }     if b.Config.ShowEmbeds && m.Message.Embeds != nil {   for _, embed := range m.Message.Embeds { diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index dac68da..e31c23e 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -4436 +44310 @@ Server="yourservername"  #OPTIONAL (default false)  ShowEmbeds=false   +#Shows the username (minus the discriminator) instead of the server nickname +#OPTIONAL (default false) +UseUserName=false +  #Specify WebhookURL. If given, will relay messages using the Webhook, which gives a better look to messages.  #OPTIONAL (default empty)  WebhookURL="Yourwebhooktokenhere"