counter: fix bug where user ID was not passed to resolveUser

This commit is contained in:
Chris Sexton 2022-07-17 13:48:35 -04:00
parent aa7d377c08
commit df0b5d709b
1 changed files with 13 additions and 1 deletions

View File

@ -211,7 +211,19 @@ func (p *CounterPlugin) handleCounterAPI(w http.ResponseWriter, r *http.Request)
w.Write(j) w.Write(j)
return return
} }
nick, id := p.resolveUser(bot.Request{Conn: p.b.DefaultConnector()}, info.User) req := bot.Request{
Conn: p.b.DefaultConnector(),
Kind: bot.Message,
Msg: msg.Message{
User: &user.User{
ID: "",
Name: info.User,
Admin: false,
},
},
}
// resolveUser requires a "full" request object so we are faking it
nick, id := p.resolveUser(req, info.User)
item, err := GetUserItem(p.db, nick, id, info.Thing) item, err := GetUserItem(p.db, nick, id, info.Thing)
if err != nil { if err != nil {
log.Error(). log.Error().