mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +00:00
Add part
event
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
fe4ef6f2fc
commit
e66eb2ce82
3 changed files with 11 additions and 1 deletions
|
@ -5,6 +5,7 @@ func ptrStr(s string) *string { return &s }
|
||||||
var (
|
var (
|
||||||
eventTypeJoin = ptrStr("join")
|
eventTypeJoin = ptrStr("join")
|
||||||
eventTypeHost = ptrStr("host")
|
eventTypeHost = ptrStr("host")
|
||||||
|
eventTypePart = ptrStr("part")
|
||||||
eventTypePermit = ptrStr("permit")
|
eventTypePermit = ptrStr("permit")
|
||||||
eventTypeRaid = ptrStr("raid")
|
eventTypeRaid = ptrStr("raid")
|
||||||
eventTypeResub = ptrStr("resub")
|
eventTypeResub = ptrStr("resub")
|
||||||
|
|
9
irc.go
9
irc.go
|
@ -103,6 +103,11 @@ func (i ircHandler) Handle(c *irc.Client, m *irc.Message) {
|
||||||
// General notices from the server.
|
// General notices from the server.
|
||||||
i.handleTwitchNotice(m)
|
i.handleTwitchNotice(m)
|
||||||
|
|
||||||
|
case "PART":
|
||||||
|
// PART (Default IRC Command)
|
||||||
|
// User leaves the channel, might be triggered multiple times
|
||||||
|
i.handlePart(m)
|
||||||
|
|
||||||
case "PRIVMSG":
|
case "PRIVMSG":
|
||||||
i.handleTwitchPrivmsg(m)
|
i.handleTwitchPrivmsg(m)
|
||||||
|
|
||||||
|
@ -140,6 +145,10 @@ func (i ircHandler) handleJoin(m *irc.Message) {
|
||||||
go handleMessage(i.c, m, eventTypeJoin)
|
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) {
|
func (i ircHandler) handlePermit(m *irc.Message) {
|
||||||
badges := i.ParseBadgeLevels(m)
|
badges := i.ParseBadgeLevels(m)
|
||||||
if !badges.Has(badgeBroadcaster) && (!config.PermitAllowModerator || !badges.Has(badgeModerator)) {
|
if !badges.Has(badgeBroadcaster) && (!config.PermitAllowModerator || !badges.Has(badgeModerator)) {
|
||||||
|
|
|
@ -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, permit, raid, resub, sub, subgift
|
# Available events: join, host, part, permit, raid, resub, sub, subgift
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue