mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-08 16:20:02 +00:00
Fix: Log channel in debug / trace messages
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
ddef07120f
commit
b7538d9b93
1 changed files with 10 additions and 0 deletions
10
irc.go
10
irc.go
|
@ -116,6 +116,13 @@ 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 (ircHandler) getChannel(m *irc.Message) string {
|
||||||
|
if len(m.Params) > 0 {
|
||||||
|
return m.Params[0]
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (i ircHandler) handleJoin(m *irc.Message) {
|
func (i ircHandler) handleJoin(m *irc.Message) {
|
||||||
go handleMessage(i.c, m, eventTypeJoin)
|
go handleMessage(i.c, m, eventTypeJoin)
|
||||||
}
|
}
|
||||||
|
@ -142,6 +149,7 @@ func (i ircHandler) handlePermit(m *irc.Message) {
|
||||||
|
|
||||||
func (i ircHandler) handleTwitchNotice(m *irc.Message) {
|
func (i ircHandler) handleTwitchNotice(m *irc.Message) {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
|
"channel": i.getChannel(m),
|
||||||
"tags": m.Tags,
|
"tags": m.Tags,
|
||||||
"trailing": m.Trailing,
|
"trailing": m.Trailing,
|
||||||
}).Debug("IRC NOTICE event")
|
}).Debug("IRC NOTICE event")
|
||||||
|
@ -161,6 +169,7 @@ func (i ircHandler) handleTwitchNotice(m *irc.Message) {
|
||||||
|
|
||||||
func (i ircHandler) handleTwitchPrivmsg(m *irc.Message) {
|
func (i ircHandler) handleTwitchPrivmsg(m *irc.Message) {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
|
"channel": i.getChannel(m),
|
||||||
"name": m.Name,
|
"name": m.Name,
|
||||||
"user": m.User,
|
"user": m.User,
|
||||||
"tags": m.Tags,
|
"tags": m.Tags,
|
||||||
|
@ -186,6 +195,7 @@ func (i ircHandler) handleTwitchPrivmsg(m *irc.Message) {
|
||||||
|
|
||||||
func (i ircHandler) handleTwitchUsernotice(m *irc.Message) {
|
func (i ircHandler) handleTwitchUsernotice(m *irc.Message) {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
|
"channel": i.getChannel(m),
|
||||||
"tags": m.Tags,
|
"tags": m.Tags,
|
||||||
"trailing": m.Trailing,
|
"trailing": m.Trailing,
|
||||||
}).Debug("IRC USERNOTICE event")
|
}).Debug("IRC USERNOTICE event")
|
||||||
|
|
Loading…
Reference in a new issue