feat(xp): xp and level gain

This commit is contained in:
Anhgelus Morhtuuzh 2024-04-14 17:11:31 +02:00
parent 1f68e69899
commit 1078cf3deb
No known key found for this signature in database
GPG key ID: CF4550297832A29F
7 changed files with 108 additions and 3 deletions

22
xp/member.go Normal file
View file

@ -0,0 +1,22 @@
package xp
import (
"github.com/anhgelus/gokord"
"gorm.io/gorm"
)
type Copaing struct {
gorm.Model
DiscordID string
XP uint
GuildID string
}
func (c *Copaing) Load() *Copaing {
gokord.DB.Where("discord_id = ? and guild_id = ?", c.DiscordID, c.GuildID).FirstOrCreate(c)
return c
}
func (c *Copaing) Save() {
gokord.DB.Save(c)
}