summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZomboy Alfrir <zomboy@dancodes.com.ar>2019-01-14 15:27:49 -0300
committerWim <wim@42.be>2019-01-14 19:27:49 +0100
commit62e55214fc3edf75455554c6ddff366f8369b60e (patch)
treedf4f9711ce10ac8427557bc69f88c7441a97a5bb
parent464d27ad7e6ea30c9cff8931657de8412c206726 (diff)
downloadmatterbridge-msglm-62e55214fc3edf75455554c6ddff366f8369b60e.tar.gz
matterbridge-msglm-62e55214fc3edf75455554c6ddff366f8369b60e.tar.bz2
matterbridge-msglm-62e55214fc3edf75455554c6ddff366f8369b60e.zip
Allow to bridge non-bot Discord users (discord) (#689)
If you prefix a token with `User ` it'll treat is as a user token. Co-Authored-By: zomboy-alfrir <zomboy@dancodes.com.ar>
-rw-r--r--bridge/discord/discord.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go
index a4eb2bfd..e6f939e6 100644
--- a/bridge/discord/discord.go
+++ b/bridge/discord/discord.go
@@ -61,6 +61,11 @@ func (b *Bdiscord) Connect() error {
if !strings.HasPrefix(b.GetString("Token"), "Bot ") {
token = "Bot " + b.GetString("Token")
}
+ // if we have a User token, remove the `Bot` prefix
+ if strings.HasPrefix(b.GetString("Token"),"User ") {
+ token = strings.Replace(token,"Bot ","",-1)
+ }
+
b.c, err = discordgo.New(token)
if err != nil {
return err