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
1 changed files with 5 additions and 0 deletions

View File

@ -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