feat(xp): xp and level gain
This commit is contained in:
parent
1f68e69899
commit
1078cf3deb
7 changed files with 108 additions and 3 deletions
22
xp/member.go
Normal file
22
xp/member.go
Normal 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)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue