diff --git a/events.go b/events.go index 6cfb42f..08eed98 100644 --- a/events.go +++ b/events.go @@ -5,6 +5,7 @@ func ptrStr(s string) *string { return &s } var ( eventTypeJoin = ptrStr("join") eventTypeHost = ptrStr("host") + eventTypePart = ptrStr("part") eventTypePermit = ptrStr("permit") eventTypeRaid = ptrStr("raid") eventTypeResub = ptrStr("resub") diff --git a/irc.go b/irc.go index e56dd15..6b5cd13 100644 --- a/irc.go +++ b/irc.go @@ -103,6 +103,11 @@ func (i ircHandler) Handle(c *irc.Client, m *irc.Message) { // General notices from the server. i.handleTwitchNotice(m) + case "PART": + // PART (Default IRC Command) + // User leaves the channel, might be triggered multiple times + i.handlePart(m) + case "PRIVMSG": i.handleTwitchPrivmsg(m) @@ -140,6 +145,10 @@ func (i ircHandler) handleJoin(m *irc.Message) { go handleMessage(i.c, m, eventTypeJoin) } +func (i ircHandler) handlePart(m *irc.Message) { + go handleMessage(i.c, m, eventTypePart) +} + func (i ircHandler) handlePermit(m *irc.Message) { badges := i.ParseBadgeLevels(m) if !badges.Has(badgeBroadcaster) && (!config.PermitAllowModerator || !badges.Has(badgeModerator)) { diff --git a/wiki/Home.md b/wiki/Home.md index 5500fa4..62c236c 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, permit, raid, resub, sub, subgift + # Available events: join, host, part, permit, raid, resub, sub, subgift match_event: 'permit' # Execute action when the chat message matches this regular expression