feat(config): base of guild config
This commit is contained in:
parent
48ca185105
commit
beb0ea0ca4
7 changed files with 238 additions and 13 deletions
11
xp/member.go
11
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue