mirror of https://github.com/velour/catbase.git
Compare commits
No commits in common. "802911203fb397e99456b810b934504246614f50" and "4c669e520f43d592f880046ab0630a9f4ab6a9aa" have entirely different histories.
802911203f
...
4c669e520f
|
@ -5,8 +5,6 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/velour/catbase/config"
|
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
|
@ -17,7 +15,6 @@ import (
|
||||||
type LastPlugin struct {
|
type LastPlugin struct {
|
||||||
b bot.Bot
|
b bot.Bot
|
||||||
db *sqlx.DB
|
db *sqlx.DB
|
||||||
c *config.Config
|
|
||||||
|
|
||||||
handlers bot.HandlerTable
|
handlers bot.HandlerTable
|
||||||
channels map[string]bool
|
channels map[string]bool
|
||||||
|
@ -27,7 +24,6 @@ func New(b bot.Bot) *LastPlugin {
|
||||||
p := &LastPlugin{
|
p := &LastPlugin{
|
||||||
b: b,
|
b: b,
|
||||||
db: b.DB(),
|
db: b.DB(),
|
||||||
c: b.Config(),
|
|
||||||
channels: map[string]bool{},
|
channels: map[string]bool{},
|
||||||
}
|
}
|
||||||
if err := p.migrate(); err != nil {
|
if err := p.migrate(); err != nil {
|
||||||
|
@ -102,17 +98,6 @@ func (p *LastPlugin) recordLast(r bot.Request) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.Msg.Body == "" {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
invalidUsers := p.c.GetArray("last.invalidUsers", []string{"unknown"})
|
|
||||||
for _, u := range invalidUsers {
|
|
||||||
if who == u {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := p.db.Exec(
|
_, err := p.db.Exec(
|
||||||
`insert into last values (?, ?, ?, ?, ?)
|
`insert into last values (?, ?, ?, ?, ?)
|
||||||
on conflict(day) do update set
|
on conflict(day) do update set
|
||||||
|
|
Loading…
Reference in New Issue