Skip to content

Commit

Permalink
fix: Wrong Wii Number function
Browse files Browse the repository at this point in the history
noahpistilli committed Nov 25, 2024
1 parent 74bbbf2 commit 0d38462
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion areas.go
Original file line number Diff line number Diff line change
@@ -255,7 +255,7 @@ func areaList(r *Response) {
}

newAreaCode := GenerateAreaCode(areaCode)
_, err := pool.Exec(context.Background(), InsertUser, newAreaCode, r.wiiNumber.GetHollywoodID())
_, err := pool.Exec(context.Background(), InsertUser, newAreaCode, r.GetHollywoodId())
if err != nil {
r.ReportError(err)
return
12 changes: 6 additions & 6 deletions basket.go
Original file line number Diff line number Diff line change
@@ -32,22 +32,22 @@ func authKey(r *Response) {

// First we query to determine if the user already has an auth key. If they do, reset the basket.
var authExists bool
row := pool.QueryRow(context.Background(), DoesAuthKeyExist, r.wiiNumber.GetHollywoodID())
row := pool.QueryRow(context.Background(), DoesAuthKeyExist, r.GetHollywoodId())
err = row.Scan(&authExists)
if err != nil {
r.ReportError(err)
return
}

if authExists {
_, err = pool.Exec(context.Background(), ClearBasket, "", "", "[]", r.wiiNumber.GetHollywoodID())
_, err = pool.Exec(context.Background(), ClearBasket, "", "", "[]", r.GetHollywoodId())
if err != nil {
r.ReportError(err)
return
}
}

_, err = pool.Exec(context.Background(), InsertAuthkey, authKeyValue.String(), r.wiiNumber.GetHollywoodID())
_, err = pool.Exec(context.Background(), InsertAuthkey, authKeyValue.String(), r.GetHollywoodId())
if err != nil {
r.ReportError(err)
return
@@ -62,7 +62,7 @@ func authKey(r *Response) {
}

func basketReset(r *Response) {
_, err := pool.Exec(context.Background(), ClearBasket, "", "", "[]", r.wiiNumber.GetHollywoodID())
_, err := pool.Exec(context.Background(), ClearBasket, "", "", "[]", r.GetHollywoodId())
if err != nil {
r.ReportError(err)
return
@@ -77,7 +77,7 @@ func basketDelete(r *Response) {
}

var lastBasket string
row := pool.QueryRow(context.Background(), QueryUserBasket, r.wiiNumber.GetHollywoodID())
row := pool.QueryRow(context.Background(), QueryUserBasket, r.GetHollywoodId())
err = row.Scan(&lastBasket, nil)
if err != nil {
r.ReportError(err)
@@ -101,7 +101,7 @@ func basketDelete(r *Response) {
return
}

_, err = pool.Exec(context.Background(), UpdateUserBasket, jsonStr, r.wiiNumber.GetHollywoodID())
_, err = pool.Exec(context.Background(), UpdateUserBasket, jsonStr, r.GetHollywoodId())
if err != nil {
r.ReportError(err)
return
4 changes: 2 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
@@ -200,7 +200,7 @@ func PostDiscordWebhook(title, message, url string, color int) {
// then writes a response for the server to send.
func (r *Response) ReportError(err error) {
var discordId string
row := pool.QueryRow(context.Background(), QueryDiscordID, r.wiiNumber.GetHollywoodID())
row := pool.QueryRow(context.Background(), QueryDiscordID, r.GetHollywoodId())
_err := row.Scan(&discordId)
if _err != nil {
// We assume Discord ID doesn't exist because we will get an error elsewhere if the db is down.
@@ -220,7 +220,7 @@ func (r *Response) ReportError(err error) {

log.Printf("An error has occurred: %s", aurora.Red(err.Error()))

errorString := fmt.Sprintf("%s\nWii ID: %d\nDiscord ID: %s", err.Error(), r.wiiNumber.GetHollywoodID(), discordId)
errorString := fmt.Sprintf("%s\nWii ID: %d\nDiscord ID: %s", err.Error(), r.GetHollywoodId(), discordId)
PostDiscordWebhook("An error has occurred in Demae Domino's!", errorString, config.ErrorWebhook, 16711711)

// With the new patches I created, we can now send the error to the channel.

0 comments on commit 0d38462

Please sign in to comment.