[core] Add "bits" event
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
a2518c26fd
commit
b6e65a1f6d
3 changed files with 18 additions and 0 deletions
|
@ -3,6 +3,7 @@ package main
|
||||||
func ptrStr(s string) *string { return &s }
|
func ptrStr(s string) *string { return &s }
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
eventTypeBits = ptrStr("bits")
|
||||||
eventTypeJoin = ptrStr("join")
|
eventTypeJoin = ptrStr("join")
|
||||||
eventTypeHost = ptrStr("host")
|
eventTypeHost = ptrStr("host")
|
||||||
eventTypePart = ptrStr("part")
|
eventTypePart = ptrStr("part")
|
||||||
|
|
7
irc.go
7
irc.go
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
@ -251,6 +252,12 @@ func (i ircHandler) handleTwitchPrivmsg(m *irc.Message) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if bits, err := strconv.ParseInt(string(m.Tags["bits"]), 10, 64); err == nil {
|
||||||
|
go handleMessage(i.c, m, eventTypeBits, plugins.FieldCollection{
|
||||||
|
"bits": bits,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
go handleMessage(i.c, m, nil, nil)
|
go handleMessage(i.c, m, nil, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
# Available Events
|
# Available Events
|
||||||
|
|
||||||
|
## `bits`
|
||||||
|
|
||||||
|
User spent bits in the channel. The full message is available like in a normal chat message, additionally the `{{ .bits }}` field is added with the total amount of bits spent.
|
||||||
|
|
||||||
|
Fields:
|
||||||
|
|
||||||
|
- `bits` - Total amount of bits spent in the message
|
||||||
|
- `channel` - The channel the event occurred in
|
||||||
|
- `username` - The login-name of the user who spent the bits
|
||||||
|
|
||||||
## `category_update`
|
## `category_update`
|
||||||
|
|
||||||
The current category for the channel was changed. (This event has some delay to the real category change!)
|
The current category for the channel was changed. (This event has some delay to the real category change!)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue