From df317691420a3a1cc5b8f21ed8599424a5791b85 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 12 May 2021 17:47:03 +0200 Subject: [PATCH] Add sub events, document available event types Signed-off-by: Knut Ahlers --- .gitignore | 1 + events.go | 12 +++++++----- irc.go | 6 ++++++ wiki/Home.md | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index a22c6f6..2af104a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +config config.yaml .env storage.json.gz diff --git a/events.go b/events.go index dcb828d..6cfb42f 100644 --- a/events.go +++ b/events.go @@ -3,9 +3,11 @@ package main func ptrStr(s string) *string { return &s } var ( - eventTypeJoin = ptrStr("join") - eventTypeHost = ptrStr("host") - eventTypePermit = ptrStr("permit") - eventTypeRaid = ptrStr("raid") - eventTypeResub = ptrStr("resub") + eventTypeJoin = ptrStr("join") + eventTypeHost = ptrStr("host") + eventTypePermit = ptrStr("permit") + eventTypeRaid = ptrStr("raid") + eventTypeResub = ptrStr("resub") + eventTypeSub = ptrStr("sub") + eventTypeSubgift = ptrStr("subgift") ) diff --git a/irc.go b/irc.go index 53aea21..e56dd15 100644 --- a/irc.go +++ b/irc.go @@ -229,6 +229,12 @@ func (i ircHandler) handleTwitchUsernotice(m *irc.Message) { case "resub": go handleMessage(i.c, m, eventTypeResub) + case "sub": + go handleMessage(i.c, m, eventTypeSub) + + case "subgift", "anonsubgift": + go handleMessage(i.c, m, eventTypeSubgift) + } } diff --git a/wiki/Home.md b/wiki/Home.md index 64e4f1b..8a71101 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -76,6 +76,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, permit, raid, resub, sub, subgift match_event: 'permit' # Execute action when the chat message matches this regular expression