@@ -261,9 +261,7 @@ async def snooze(self, moderator=None, command_used=None, snooze_for=None):
261261 {"channel_id" : str (self .channel .id )},
262262 {"$set" : {"snoozed" : True , "snooze_data" : self .snooze_data }},
263263 )
264- import logging
265-
266- logging .info (f"[SNOOZE] DB update result: { result .modified_count } " )
264+ logger .info ("[SNOOZE] DB update result: %s" , result .modified_count )
267265
268266 # Dispatch thread_snoozed event for plugins
269267 self .bot .dispatch ("thread_snoozed" , self , moderator , snooze_for )
@@ -729,9 +727,7 @@ async def _ensure_genesis(force: bool = False):
729727 "$unset" : {"snoozed" : "" , "snooze_data" : "" },
730728 },
731729 )
732- import logging
733-
734- logging .info (f"[UNSNOOZE] DB update result: { result .modified_count } " )
730+ logger .info ("[UNSNOOZE] DB update result: %s" , result .modified_count )
735731 # Notify in the configured channel
736732 notify_channel = self .bot .config .get ("unsnooze_notify_channel" ) or "thread"
737733 notify_text = self .bot .config .get ("unsnooze_text" ) or "This thread has been unsnoozed and restored."
@@ -3037,16 +3033,19 @@ async def callback(self, interaction: discord.Interaction):
30373033 # If channel isn't ready, we can't really invoke a command in it.
30383034 continue
30393035
3040- from unittest .mock import MagicMock
3041-
3042- # Create a mock message strictly for command invocation context
3043- mock_msg = MagicMock (spec = discord .Message )
3044- mock_msg .id = 0
3045- mock_msg .channel = ch
3046- mock_msg .guild = self .outer_thread .bot .modmail_guild
3047- mock_msg .content = self .outer_thread .bot .prefix + al
3048- mock_msg .author = self .outer_thread .bot .user
3049- synthetic = DummyMessage (mock_msg )
3036+ # Create a minimal message-like object for command invocation context
3037+ stub_msg = SimpleNamespace (
3038+ id = 0 ,
3039+ channel = ch ,
3040+ guild = self .outer_thread .bot .modmail_guild ,
3041+ content = self .outer_thread .bot .prefix + al ,
3042+ author = self .outer_thread .bot .user ,
3043+ attachments = [],
3044+ embeds = [],
3045+ stickers = [],
3046+ type = discord .MessageType .default ,
3047+ )
3048+ synthetic = DummyMessage (stub_msg )
30503049
30513050 try :
30523051 synthetic .author = (
0 commit comments