From d7b74f4d6cbb7aa23e33ce5a46f7cdf8729eb8d6 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Tue, 31 Aug 2021 10:54:05 +0200 Subject: [PATCH] [liveposting] Add some debug logging to post creation Signed-off-by: Knut Ahlers --- mod_livePosting.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mod_livePosting.go b/mod_livePosting.go index 7cc9d19..e36124f 100644 --- a/mod_livePosting.go +++ b/mod_livePosting.go @@ -223,6 +223,11 @@ func (m *modLivePosting) sendLivePost(username, displayName, title, game, previe m.lock.Lock() defer m.lock.Unlock() + logger := log.WithFields(log.Fields{ + "user": username, + "game": game, + }) + postText := strings.NewReplacer( "${displayname}", displayName, "${username}", username, @@ -246,6 +251,7 @@ func (m *modLivePosting) sendLivePost(username, displayName, title, game, previe return errors.Wrap(err, "parsing message timestamp") } if msg.Content == postText && time.Since(mt) < ignoreTime { + logger.Debug("Not creating live-post, it's already there") return nil } } @@ -290,6 +296,8 @@ func (m *modLivePosting) sendLivePost(username, displayName, title, game, previe URL: strings.Join([]string{"https://www.twitch.tv", username}, "/"), } + logger.Debug("Creating live-post") + msg, err := m.discord.ChannelMessageSendComplex(channelID, &discordgo.MessageSend{ Content: postText, Embed: msgEmbed, @@ -300,6 +308,7 @@ func (m *modLivePosting) sendLivePost(username, displayName, title, game, previe // @attr auto_publish optional bool "false" Automatically publish (crosspost) the message to followers of the channel if m.attrs.MustBool("auto_publish", ptrBoolFalse) { + logger.Debug("Auto-Publishing live-post") if _, err = m.discord.ChannelMessageCrosspost(channelID, msg.ID); err != nil { return errors.Wrap(err, "publishing message") }