Attempt to insert user into db before creating tag

This commit is contained in:
Dustin Pianalto
2020-10-09 23:21:35 -08:00
parent 05d4096766
commit a93139fcf2
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -7,7 +7,9 @@ import (
"strings"
"github.com/dustinpianalto/disgoman"
"github.com/dustinpianalto/goff"
"github.com/dustinpianalto/goff/internal/postgres"
"github.com/dustinpianalto/goff/internal/services"
)
var AddTagCommand = &disgoman.Command{
@@ -55,6 +57,10 @@ func addTagCommandFunc(ctx disgoman.Context, input []string) {
}
return
}
err = services.UserService.CreateUser(&goff.User{ID: ctx.User.ID})
if err != nil {
log.Printf("Error creating user %s: %s", ctx.User.ID, err.Error())
}
queryString = `INSERT INTO tags (tag, content, creator, guild_id) VALUES ($1, $2, $3, $4);`
_, err := postgres.DB.Exec(queryString, tag, value, ctx.Message.Author.ID, ctx.Guild.ID)
if err != nil {