Add part event

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-05-26 14:03:37 +02:00
parent fe4ef6f2fc
commit e66eb2ce82
Signed by: luzifer
GPG Key ID: 0066F03ED215AD7D
3 changed files with 11 additions and 1 deletions

View File

@ -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")

9
irc.go
View File

@ -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)) {

View File

@ -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