Thumbnail

rani/matterbridge.git

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

commit 890f2d4afb2fd9a9c4bbcdfde6e40deb3741e99f Author: Wim <wim@42.be> Date: Mon Sep 19 20:53:26 2016 +0000 Add Discord support diff --git a/README.md b/README.md index c9a9fa5..8d14790 100644 --- a/README.md +++ b/README.md @@ -39 +39 @@  :warning: Look at [README-0.6.md] (https://github.com/42wim/matterbridge/blob/master/README-0.6.md) for the documentation of the current stable.  The information below is about the develop version.   -Simple bridge between mattermost, IRC, XMPP, Gitter and Slack +Simple bridge between mattermost, IRC, XMPP, Gitter, Slack and Discord   -* Relays public channel messages between multiple mattermost, IRC, XMPP, Gitter and Slack. Pick and mix. +* Relays public channel messages between multiple mattermost, IRC, XMPP, Gitter, Slack and Discord. Pick and mix.  * Supports multiple channels.  * Matterbridge can also work with private groups on your mattermost.  * Allow for bridging the same bridges, which means you can eg bridge between multiple mattermosts. @@ -246 +247 @@ Accounts to one of the supported bridges  * [XMPP] (https://jabber.org)  * [Gitter] (https://gitter.im)  * [Slack] (https://slack.com) +* [Discord] (https://discordapp.com)    ## Docker  Create your matterbridge.toml file locally eg in ```/tmp/matterbridge.toml``` diff --git a/bridge/bridge.go b/bridge/bridge.go index 719af4f..7f08c60 100644 --- a/bridge/bridge.go +++ b/bridge/bridge.go @@ -26 +27 @@ package bridge    import (   "github.com/42wim/matterbridge/bridge/config" + "github.com/42wim/matterbridge/bridge/discord"   "github.com/42wim/matterbridge/bridge/gitter"   "github.com/42wim/matterbridge/bridge/irc"   "github.com/42wim/matterbridge/bridge/mattermost" @@ -356 +368 @@ func New(cfg *config.Config, bridge *config.Bridge, c chan config.Message) Bridg   return bslack.New(cfg.Slack[name], name, c)   case "xmpp":   return bxmpp.New(cfg.Xmpp[name], name, c) + case "discord": + return bdiscord.New(cfg.Discord[name], name, c)   }   return nil  } diff --git a/bridge/config/config.go b/bridge/config/config.go index ad8a523..e3b7b52 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -166 +167 @@ type Message struct {    type Protocol struct {   BindAddress string // mattermost, slack + Guild string // discord   IconURL string // mattermost, slack   IgnoreNicks string // all protocols   Jid string // xmpp @@ -3211 +3311 @@ type Protocol struct {   PrefixMessagesWithNick bool // mattemost, slack   Protocol string //all protocols   RemoteNickFormat string // all protocols - Server string // IRC,mattermost,XMPP + Server string // IRC,mattermost,XMPP,discord   ShowJoinPart bool // all protocols   SkipTLSVerify bool // IRC, mattermost   Team string // mattermost - Token string // gitter, slack + Token string // gitter, slack, discord   URL string // mattermost, slack   UseAPI bool // mattermost, slack   UseSASL bool // IRC @@ -616 +627 @@ type Config struct {   Slack map[string]Protocol   Gitter map[string]Protocol   Xmpp map[string]Protocol + Discord map[string]Protocol   Gateway []Gateway  }   diff --git a/changelog.md b/changelog.md index e01b8aa..28eff27 100644 --- a/changelog.md +++ b/changelog.md @@ -66 +67 @@ See matterbridge.toml.sample for an example  ## New features  * Allow for bridging the same type of bridge, which means you can eg bridge between multiple mattermosts.  * The bridge is now a gateway which has support multiple in and out bridges. (and supports multiple gateways). +* Discord support added. See matterbridge.toml.sample for more information    # v0.6.1  ## New features diff --git a/gateway/gateway.go b/gateway/gateway.go index 54440d6..6ac36d4 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -1315 +1317 @@ func (gw *Gateway) modifyMessage(msg *config.Message, dest bridge.Bridge) {   setNickFormat(msg, gw.Config.Mattermost[dest.Origin()].RemoteNickFormat)   case "slack":   setNickFormat(msg, gw.Config.Slack[dest.Origin()].RemoteNickFormat) + case "discord": + setNickFormat(msg, gw.Config.Discord[dest.Origin()].RemoteNickFormat)   }  } diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index 5315b41..c83225c 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -2626 +26235 @@ NicksPerRow=4  #OPTIONAL  IgnoreNicks="mmbot spammer2"   +################################################################### +#discord section +################################################################### +[discord] + +#You can configure multiple servers "[discord.name]" or "[discord.name2]" +#In this example we use [discord.game] +#REQUIRED +[discord.game] +#Token to connect with Discord API +#You can get your token by following the instructions on +#https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token +#REQUIRED +Token="Yourtokenhere" + +#REQUIRED +Guild="yourguildname" + +#Nicks you want to ignore. Messages of those users will not be bridged. +#OPTIONAL +IgnoreNicks="spammer1 spammer2" + +#RemoteNickFormat defines how remote users appear on this bridge +#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username. +#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge +#The string "{PROTOCOL}" (case sensitive) will be replaced by the protocol used by the bridge +#OPTIONAL (default {BRIDGE}-{NICK}) +RemoteNickFormat="[{BRIDGE}] <{NICK}> +    ###################################################################  #Gateway configuration