From 477f07c963705c658489ba2c4ea8512b457880e6 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 26 May 2021 14:38:15 +0200 Subject: [PATCH] Add `whisper` event Signed-off-by: Knut Ahlers --- events.go | 1 + irc.go | 9 +++++++++ wiki/Home.md | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/events.go b/events.go index 08eed98..7482017 100644 --- a/events.go +++ b/events.go @@ -11,4 +11,5 @@ var ( eventTypeResub = ptrStr("resub") eventTypeSub = ptrStr("sub") eventTypeSubgift = ptrStr("subgift") + eventTypeWhisper = ptrStr("whisper") ) diff --git a/irc.go b/irc.go index 6b5cd13..969d2f7 100644 --- a/irc.go +++ b/irc.go @@ -122,6 +122,11 @@ func (i ircHandler) Handle(c *irc.Client, m *irc.Message) { // Announces Twitch-specific events to the channel (for example, a user’s subscription notification). i.handleTwitchUsernotice(m) + case "WHISPER": + // WHISPER (Twitch Commands) + // Delivers whisper-messages received + i.handleTwitchWhisper(m) + default: log.WithFields(log.Fields{ "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 { out := badgeCollection{} diff --git a/wiki/Home.md b/wiki/Home.md index 62c236c..2ea33fe 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -96,7 +96,7 @@ rules: # See below for examples match_users: ['mychannel'] # List of users, all names MUST be all lower-case # 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' # Execute action when the chat message matches this regular expression