mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-20 20:01:17 +00:00
Make join events available to handlers
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
1ade654a13
commit
31ca8ee35c
2 changed files with 11 additions and 0 deletions
|
@ -3,6 +3,7 @@ package main
|
||||||
func ptrStr(s string) *string { return &s }
|
func ptrStr(s string) *string { return &s }
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
eventTypeJoin = ptrStr("join")
|
||||||
eventTypeHost = ptrStr("host")
|
eventTypeHost = ptrStr("host")
|
||||||
eventTypePermit = ptrStr("permit")
|
eventTypePermit = ptrStr("permit")
|
||||||
eventTypeRaid = ptrStr("raid")
|
eventTypeRaid = ptrStr("raid")
|
||||||
|
|
10
irc.go
10
irc.go
|
@ -79,6 +79,12 @@ func (i ircHandler) Handle(c *irc.Client, m *irc.Message) {
|
||||||
})
|
})
|
||||||
i.ExecuteJoins(config.Channels)
|
i.ExecuteJoins(config.Channels)
|
||||||
|
|
||||||
|
case "JOIN":
|
||||||
|
// JOIN (Default IRC Command)
|
||||||
|
// User enters the channel, might be triggered multiple times
|
||||||
|
// should not be used to greet users
|
||||||
|
i.handleJoin(m)
|
||||||
|
|
||||||
case "NOTICE":
|
case "NOTICE":
|
||||||
// NOTICE (Twitch Commands)
|
// NOTICE (Twitch Commands)
|
||||||
// General notices from the server.
|
// General notices from the server.
|
||||||
|
@ -110,6 +116,10 @@ func (i ircHandler) Handle(c *irc.Client, m *irc.Message) {
|
||||||
|
|
||||||
func (i ircHandler) Run() error { return errors.Wrap(i.c.Run(), "running IRC client") }
|
func (i ircHandler) Run() error { return errors.Wrap(i.c.Run(), "running IRC client") }
|
||||||
|
|
||||||
|
func (i ircHandler) handleJoin(m *irc.Message) {
|
||||||
|
go handleMessage(i.c, m, eventTypeJoin)
|
||||||
|
}
|
||||||
|
|
||||||
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)) {
|
||||||
|
|
Loading…
Reference in a new issue