Compare commits

...

2 Commits

Author SHA1 Message Date
Chris Sexton 338293cf42 counter: use channel in api update 2021-11-18 17:21:04 -05:00
Chris Sexton fd670339c0 counter: api should update goals 2021-11-18 16:50:50 -05:00
1 changed files with 9 additions and 3 deletions

View File

@ -86,6 +86,8 @@ func (p *CounterPlugin) mkIncrementAPI(delta int) func(w http.ResponseWriter, r
userName, itemName, delta, item.Count, p.cfg.Get("nick", "catbase"))
for _, ch := range p.cfg.GetArray("channels", []string{}) {
p.b.Send(p.b.DefaultConnector(), bot.Message, ch, msg)
req.Msg.Channel = ch
sendUpdate(req, userName, itemName, item.Count)
}
j, _ := json.Marshal(struct{ Status bool }{true})
fmt.Fprint(w, string(j))
@ -159,8 +161,12 @@ func (p *CounterPlugin) handleCounterAPI(w http.ResponseWriter, r *http.Request)
fmt.Fprint(w, string(data))
}
// Update represents a change that gets sent off to other plugins such as goals
type Update struct {
// Username to be displayed/recorded
Who string `json:"who"`
// Counter Item
What string `json:"what"`
// Total counter amount
Amount int `json:"amount"`
}