Fixed himbucks

This commit is contained in:
Atridad Lahiji 2024-11-05 00:28:33 -06:00
parent 9a1b3723bc
commit 022686e14f
Signed by: atridad
SSH key fingerprint: SHA256:LGomp8Opq0jz+7kbwNcdfTcuaLRb5Nh0k5AchDDb438

View file

@ -3,6 +3,7 @@ package lib
import (
"database/sql"
"fmt"
"log"
"time"
"github.com/bwmarrin/discordgo"
@ -39,6 +40,13 @@ func ProcessMessage(s *discordgo.Session, m *discordgo.MessageCreate) error {
var userID int
err := DBClient.QueryRow("SELECT id FROM users WHERE discord_id = ?", m.Author.ID).Scan(&userID)
if err != nil {
// Store user in database
dbErr := StoreUser(m.Author.ID, m.Author.Username)
if dbErr != nil {
// Log the error but don't stop command execution
log.Printf("Error storing user: %v", dbErr)
}
return fmt.Errorf("failed to get user: %w", err)
}