1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-11 01:22:48 +00:00

use permissions from database - updated bot-scripts

This commit is contained in:
2018-10-20 13:42:37 -05:00
parent 3f650e7c65
commit b004d4f29a
15 changed files with 126 additions and 57 deletions

View File

@@ -9,8 +9,6 @@ import (
log "github.com/sirupsen/logrus"
)
const cashGuildID = "101198129352691712"
type oauthReq struct {
Code string `json:"code"`
}
@@ -50,6 +48,15 @@ func oauthHandler(c *gin.Context) {
return
}
// save/update user in database
err = model.UserSave(db.GetConn(), &user)
if err != nil {
log.Error(err)
c.JSON(500, err)
return
}
// generate json web token
token, err := middleware.GetJWT(user)
@@ -59,12 +66,5 @@ func oauthHandler(c *gin.Context) {
return
}
// save/update user in database
err = model.UserSave(db.GetConn(), &user)
if err != nil {
log.Error(err)
}
c.JSON(200, token)
}