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

Add UseUserName option (discord) (#234)

This commit is contained in:
anon724 2017-08-01 09:18:55 -07:00 committed by Wim
parent f2483af561
commit 67905089ba
3 changed files with 11 additions and 1 deletions

View File

@ -77,6 +77,7 @@ type Protocol struct {
UseSASL bool // IRC UseSASL bool // IRC
UseTLS bool // IRC UseTLS bool // IRC
UseFirstName bool // telegram UseFirstName bool // telegram
UseUserName bool // discord
UseInsecureURL bool // telegram UseInsecureURL bool // telegram
WebhookBindAddress string // mattermost, slack WebhookBindAddress string // mattermost, slack
WebhookURL string // mattermost, slack WebhookURL string // mattermost, slack

View File

@ -181,7 +181,12 @@ func (b *bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat
if b.UseChannelID { if b.UseChannelID {
rmsg.Channel = "ID:" + m.ChannelID rmsg.Channel = "ID:" + m.ChannelID
} }
if !b.Config.UseUserName {
rmsg.Username = b.getNick(m.Author) rmsg.Username = b.getNick(m.Author)
} else {
rmsg.Username = m.Author.Username
}
if b.Config.ShowEmbeds && m.Message.Embeds != nil { if b.Config.ShowEmbeds && m.Message.Embeds != nil {
for _, embed := range m.Message.Embeds { for _, embed := range m.Message.Embeds {

View File

@ -443,6 +443,10 @@ Server="yourservername"
#OPTIONAL (default false) #OPTIONAL (default false)
ShowEmbeds=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. #Specify WebhookURL. If given, will relay messages using the Webhook, which gives a better look to messages.
#OPTIONAL (default empty) #OPTIONAL (default empty)
WebhookURL="Yourwebhooktokenhere" WebhookURL="Yourwebhooktokenhere"