Add whisper event

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-05-26 14:38:15 +02:00
parent b09404cef6
commit 477f07c963
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D
3 changed files with 11 additions and 1 deletions

View file

@ -11,4 +11,5 @@ var (
eventTypeResub = ptrStr("resub") eventTypeResub = ptrStr("resub")
eventTypeSub = ptrStr("sub") eventTypeSub = ptrStr("sub")
eventTypeSubgift = ptrStr("subgift") eventTypeSubgift = ptrStr("subgift")
eventTypeWhisper = ptrStr("whisper")
) )

9
irc.go
View file

@ -122,6 +122,11 @@ func (i ircHandler) Handle(c *irc.Client, m *irc.Message) {
// Announces Twitch-specific events to the channel (for example, a users subscription notification). // Announces Twitch-specific events to the channel (for example, a users subscription notification).
i.handleTwitchUsernotice(m) i.handleTwitchUsernotice(m)
case "WHISPER":
// WHISPER (Twitch Commands)
// Delivers whisper-messages received
i.handleTwitchWhisper(m)
default: default:
log.WithFields(log.Fields{ log.WithFields(log.Fields{
"command": m.Command, "command": m.Command,
@ -247,6 +252,10 @@ func (i ircHandler) handleTwitchUsernotice(m *irc.Message) {
} }
} }
func (i ircHandler) handleTwitchWhisper(m *irc.Message) {
go handleMessage(i.c, m, eventTypeWhisper)
}
func (ircHandler) ParseBadgeLevels(m *irc.Message) badgeCollection { func (ircHandler) ParseBadgeLevels(m *irc.Message) badgeCollection {
out := badgeCollection{} out := badgeCollection{}

View file

@ -96,7 +96,7 @@ rules: # See below for examples
match_users: ['mychannel'] # List of users, all names MUST be all lower-case match_users: ['mychannel'] # List of users, all names MUST be all lower-case
# Execute actions when this event occurs # Execute actions when this event occurs
# Available events: join, host, part, permit, raid, resub, sub, subgift # Available events: join, host, part, permit, raid, resub, sub, subgift, whisper
match_event: 'permit' match_event: 'permit'
# Execute action when the chat message matches this regular expression # Execute action when the chat message matches this regular expression