feat(config): base of guild config

This commit is contained in:
Anhgelus Morhtuuzh 2024-04-15 14:42:08 +02:00
parent 48ca185105
commit beb0ea0ca4
No known key found for this signature in database
GPG key ID: CF4550297832A29F
7 changed files with 238 additions and 13 deletions

View file

@ -10,13 +10,18 @@ import (
type Copaing struct {
gorm.Model
DiscordID string
XP uint
GuildID string
DiscordID string `gorm:"not null"`
XP uint `gorm:"default:0"`
GuildID string `gorm:"not null"`
}
var r *redis.Client
func GetCopaing(discordID string, guildID string) *Copaing {
c := Copaing{DiscordID: discordID, GuildID: guildID}
return c.Load()
}
func (c *Copaing) Load() *Copaing {
gokord.DB.Where("discord_id = ? and guild_id = ?", c.DiscordID, c.GuildID).FirstOrCreate(c)
return c