From beb0ea0ca44c96083a2ba2f683accc68ad30f1b1 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Mon, 15 Apr 2024 14:42:08 +0200 Subject: feat(config): base of guild config --- xp/member.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'xp/member.go') diff --git a/xp/member.go b/xp/member.go index 578e533..280b9e0 100644 --- a/xp/member.go +++ b/xp/member.go @@ -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 -- cgit v1.2.3