Compare commits

..

No commits in common. "c8e195609910cfd249b3b9a51e16fdc49b8fe4ee" and "d7839c96d8a18c011a3d8a80e3a5e8c425b7e516" have entirely different histories.

2 changed files with 3 additions and 5 deletions

View File

@ -15,7 +15,6 @@ import (
"github.com/velour/catbase/plugins/achievements" "github.com/velour/catbase/plugins/achievements"
"github.com/velour/catbase/plugins/aoc" "github.com/velour/catbase/plugins/aoc"
"github.com/velour/catbase/plugins/countdown"
"github.com/velour/catbase/plugins/goals" "github.com/velour/catbase/plugins/goals"
"github.com/velour/catbase/plugins/meme" "github.com/velour/catbase/plugins/meme"
"github.com/velour/catbase/plugins/sms" "github.com/velour/catbase/plugins/sms"
@ -153,7 +152,6 @@ func main() {
b.AddPlugin(meme.New(b)) b.AddPlugin(meme.New(b))
b.AddPlugin(achievements.New(b)) b.AddPlugin(achievements.New(b))
b.AddPlugin(sms.New(b)) b.AddPlugin(sms.New(b))
b.AddPlugin(countdown.New(b))
b.AddPlugin(gpt2.New(b)) b.AddPlugin(gpt2.New(b))
// catches anything left, will always return true // catches anything left, will always return true
b.AddPlugin(fact.New(b)) b.AddPlugin(fact.New(b))

View File

@ -12,8 +12,7 @@ import (
"github.com/velour/catbase/config" "github.com/velour/catbase/config"
) )
var nextYear = time.Date(time.Now().Year()+1, time.January, 0, 0, 0, 0, 0, time.Local) var nextYear = time.Date(time.Now().Year()+1, 0, 0, 0, 0, 0, 0, time.Local)
var thisYear = time.Now().Year()
type CountdownPlugin struct { type CountdownPlugin struct {
b bot.Bot b bot.Bot
@ -53,7 +52,8 @@ func (p *CountdownPlugin) newYearRollover() {
logError(err, "error getting transaction") logError(err, "error getting transaction")
return return
} }
q := fmt.Sprintf(`create table counter_%d as select * from counter`, thisYear) year := time.Now().Year() - 1
q := fmt.Sprintf(`insert into counter_%d select * from counter`, year)
_, err = tx.Exec(q) _, err = tx.Exec(q)
if err != nil { if err != nil {
logError(err, "error running insert into") logError(err, "error running insert into")