1
0
forked from lug/matterbridge

Compare commits

..

3 Commits

Author SHA1 Message Date
Wim
ad4d461606 Release v1.0.0 2017-08-05 15:50:21 +02:00
anon724
67905089ba Add UseUserName option (discord) (#234) 2017-08-01 18:18:55 +02:00
Wim
f2483af561 Do not modify username in action (discord) 2017-07-31 21:37:19 +02:00
6 changed files with 21 additions and 11 deletions

View File

@@ -53,7 +53,7 @@ See https://github.com/42wim/matterbridge/wiki
# Installing # Installing
## Binaries ## Binaries
* Latest stable release [v1.0.0-rc1](https://github.com/42wim/matterbridge/releases/latest) * Latest stable release [v1.0.0](https://github.com/42wim/matterbridge/releases/latest)
* Development releases (follows master) can be downloaded [here](https://dl.bintray.com/42wim/nightly/) * Development releases (follows master) can be downloaded [here](https://dl.bintray.com/42wim/nightly/)
## Building ## Building

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

@@ -114,18 +114,14 @@ func (b *bdiscord) Send(msg config.Message) error {
flog.Errorf("Could not find channelID for %v", msg.Channel) flog.Errorf("Could not find channelID for %v", msg.Channel)
return nil return nil
} }
if msg.Event == config.EVENT_USER_ACTION {
msg.Text = "_" + msg.Text + "_"
}
if b.Config.WebhookURL == "" { if b.Config.WebhookURL == "" {
flog.Debugf("Broadcasting using token (API)") flog.Debugf("Broadcasting using token (API)")
if msg.Event == config.EVENT_USER_ACTION {
msg.Username = "_" + msg.Username
msg.Text = msg.Text + "_"
}
b.c.ChannelMessageSend(channelID, msg.Username+msg.Text) b.c.ChannelMessageSend(channelID, msg.Username+msg.Text)
} else { } else {
flog.Debugf("Broadcasting using Webhook") flog.Debugf("Broadcasting using Webhook")
if msg.Event == config.EVENT_USER_ACTION {
msg.Text = "_" + msg.Text + "_"
}
b.c.WebhookExecute( b.c.WebhookExecute(
b.webhookID, b.webhookID,
b.webhookToken, b.webhookToken,
@@ -185,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
} }
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 { if b.Config.ShowEmbeds && m.Message.Embeds != nil {
for _, embed := range m.Message.Embeds { for _, embed := range m.Message.Embeds {

View File

@@ -1,3 +1,8 @@
# v1.0.0
## New features
* general: Add action support for slack,mattermost,irc,gitter,matrix,xmpp,discord. #199
* discord: Shows the username instead of the server nickname #234
# v1.0.0-rc1 # v1.0.0-rc1
## New features ## New features
* general: Add action support for slack,mattermost,irc,gitter,matrix,xmpp,discord. #199 * general: Add action support for slack,mattermost,irc,gitter,matrix,xmpp,discord. #199

View File

@@ -5,14 +5,13 @@ import (
"fmt" "fmt"
"github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/bridge/config"
"github.com/42wim/matterbridge/gateway" "github.com/42wim/matterbridge/gateway"
//"github.com/42wim/matterbridge/gateway/samechannel"
log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus"
"github.com/google/gops/agent" "github.com/google/gops/agent"
"strings" "strings"
) )
var ( var (
version = "1.0.0-rc1" version = "1.0.0"
githash string githash string
) )

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"