5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 23:00:28 +00:00

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>
This commit is contained in:
Zomboy Alfrir 2019-01-14 15:27:49 -03:00 committed by Wim
parent 464d27ad7e
commit 62e55214fc

View File

@ -61,6 +61,11 @@ func (b *Bdiscord) Connect() error {
if !strings.HasPrefix(b.GetString("Token"), "Bot ") { if !strings.HasPrefix(b.GetString("Token"), "Bot ") {
token = "Bot " + b.GetString("Token") 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) b.c, err = discordgo.New(token)
if err != nil { if err != nil {
return err return err