achievements: add award struct and db table

This commit is contained in:
Chris Sexton 2020-04-21 11:17:16 -04:00 committed by Chris Sexton
parent 30077d1b6c
commit 888216647f
1 changed files with 25 additions and 4 deletions

View File

@ -2,6 +2,7 @@ package achievements
import (
"fmt"
"time"
"github.com/jmoiron/sqlx"
@ -45,9 +46,15 @@ func New(b bot.Bot) *AchievementsPlugin {
}
func (p *AchievementsPlugin) mkDB() error {
q := `
create table if not exists achievements
`
q := `create table if not exists achievements (
id integer primary key,
achievement string,
emojy string,
image_url string,
current_holder string,
amount integer,
expires integer
);`
tx, err := p.db.Beginx()
if err != nil {
return err
@ -76,6 +83,20 @@ func (p *AchievementsPlugin) help(c bot.Connector, kind bot.Kind, message msg.Me
}
// Award is used by other plugins to register a particular award for a user
func Award(nick, thing string, category Category) error {
func Grant(nick, thing string, category Category) error {
return nil
}
type Award struct {
ID int
Achievement string
Emojy string
ImageURL string
CurrentHolder string
Amount int
Expires *time.Time
}
func (a *Award) Save() error {
return nil
}