From 95c303dac7d1affdfcfde580881c547992e37751 Mon Sep 17 00:00:00 2001 From: Bharat Kathi Date: Sat, 8 Aug 2026 13:04:25 -0700 Subject: [PATCH 1/2] feat(discord): post reopen notice when keeping threads alive --- discord/service/thread_keepalive.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/discord/service/thread_keepalive.go b/discord/service/thread_keepalive.go index 7ddfb59..6a44122 100644 --- a/discord/service/thread_keepalive.go +++ b/discord/service/thread_keepalive.go @@ -5,10 +5,13 @@ import ( "github.com/gaucho-racing/sentinel/discord/pkg/logger" ) +const threadReopenNotice = "This thread was archived due to inactivity, so I've automatically reopened it. " + + "If this thread is no longer needed, lock it before closing and I'll leave it alone." + // KeepThreadAlive unarchives a thread that Discord just auto-archived and // bumps its auto-archive window to the maximum (7 days) so the gateway only -// re-archives it weekly instead of on the channel's default window. The -// unarchive is silent — no message is posted and members aren't notified. +// re-archives it weekly instead of on the channel's default window. A notice +// is posted in the thread explaining the reopen and the lock-to-close opt-out. // Requires the bot to have MANAGE_THREADS in the guild. func KeepThreadAlive(thread *discordgo.Channel) { archived := false @@ -21,4 +24,7 @@ func KeepThreadAlive(thread *discordgo.Channel) { return } logger.SugarLogger.Infof("thread keepalive: unarchived thread %s (%s)", thread.ID, thread.Name) + if _, err := Discord.ChannelMessageSend(thread.ID, threadReopenNotice); err != nil { + logger.SugarLogger.Errorf("thread keepalive: failed to send reopen notice in thread %s (%s): %v", thread.ID, thread.Name, err) + } } From c124d54012ab0790f307457529a1e11ff1133937 Mon Sep 17 00:00:00 2001 From: Bharat Kathi Date: Sat, 8 Aug 2026 13:07:18 -0700 Subject: [PATCH 2/2] feat(discord): auto-delete thread reopen notice after an hour --- discord/service/thread_keepalive.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/discord/service/thread_keepalive.go b/discord/service/thread_keepalive.go index 6a44122..2d1d2c2 100644 --- a/discord/service/thread_keepalive.go +++ b/discord/service/thread_keepalive.go @@ -1,6 +1,8 @@ package service import ( + "time" + "github.com/bwmarrin/discordgo" "github.com/gaucho-racing/sentinel/discord/pkg/logger" ) @@ -11,8 +13,9 @@ const threadReopenNotice = "This thread was archived due to inactivity, so I've // KeepThreadAlive unarchives a thread that Discord just auto-archived and // bumps its auto-archive window to the maximum (7 days) so the gateway only // re-archives it weekly instead of on the channel's default window. A notice -// is posted in the thread explaining the reopen and the lock-to-close opt-out. -// Requires the bot to have MANAGE_THREADS in the guild. +// explaining the reopen and the lock-to-close opt-out is posted in the thread +// and auto-deleted after an hour. Requires the bot to have MANAGE_THREADS in +// the guild. func KeepThreadAlive(thread *discordgo.Channel) { archived := false _, err := Discord.ChannelEdit(thread.ID, &discordgo.ChannelEdit{ @@ -24,7 +27,5 @@ func KeepThreadAlive(thread *discordgo.Channel) { return } logger.SugarLogger.Infof("thread keepalive: unarchived thread %s (%s)", thread.ID, thread.Name) - if _, err := Discord.ChannelMessageSend(thread.ID, threadReopenNotice); err != nil { - logger.SugarLogger.Errorf("thread keepalive: failed to send reopen notice in thread %s (%s): %v", thread.ID, thread.Name, err) - } + SendDisappearingMessage(thread.ID, threadReopenNotice, time.Hour) }