Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion features/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ async def cancel(self, interaction: discord.Interaction, button: discord.ui.Butt
class Events(commands.Cog):
def __init__(self, bot):
self.bot = bot
self._warning_msg_ids: dict[int, int] = {} # channel_id → warning message_id
self.cleanup_check_task.start()

def cog_unload(self):
Expand Down Expand Up @@ -415,8 +416,17 @@ async def cleanup_check_task(self):
inline=False,
)

old_msg_id = self._warning_msg_ids.get(channel_id)
if old_msg_id:
try:
old_msg = await staff_channel.fetch_message(old_msg_id)
await old_msg.delete()
except (discord.NotFound, discord.HTTPException):
pass

view = ClearChannelView(channel_id)
await staff_channel.send(embed=embed, view=view)
new_msg = await staff_channel.send(embed=embed, view=view)
self._warning_msg_ids[channel_id] = new_msg.id
print(f"⚠️ Sent cleanup alert for #{name}-event")

break
Expand Down
Loading