Make discord user token work correctly (discord) #689

This commit is contained in:
Wim 2019-01-19 20:39:58 +01:00
parent fb713ed91b
commit e3cb665d92
1 changed files with 2 additions and 2 deletions

View File

@ -50,8 +50,8 @@ func New(cfg *bridge.Config) bridge.Bridger {
func (b *Bdiscord) Connect() error { func (b *Bdiscord) Connect() error {
var err error var err error
var token string
var guildFound bool var guildFound bool
token := b.GetString("Token")
b.Log.Info("Connecting") b.Log.Info("Connecting")
if b.GetString("WebhookURL") == "" { if b.GetString("WebhookURL") == "" {
b.Log.Info("Connecting using token") b.Log.Info("Connecting using token")
@ -63,7 +63,7 @@ func (b *Bdiscord) Connect() error {
} }
// if we have a User token, remove the `Bot` prefix // if we have a User token, remove the `Bot` prefix
if strings.HasPrefix(b.GetString("Token"), "User ") { if strings.HasPrefix(b.GetString("Token"), "User ") {
token = strings.Replace(token, "Bot ", "", -1) token = strings.Replace(b.GetString("Token"), "User ", "", -1)
} }
b.c, err = discordgo.New(token) b.c, err = discordgo.New(token)