Adding debug

This commit is contained in:
AllfatherHatt 2025-02-23 20:56:33 +01:00
parent b4e4437171
commit 316ff36b8f

View File

@ -51,11 +51,10 @@ class ReginaldCog(commands.Cog):
) )
@commands.Cog.listener() @commands.Cog.listener()
async def on_message(self, message): async def on_message(self, message, ctx):
if message.author.bot or not message.guild: if message.author.bot or not message.guild:
return # Ignore bots and DMs return # Ignore bots and DMs
await self.bot.process_commands(message) # ✅ Ensure commands still work
guild = message.guild guild = message.guild
channel_id = str(message.channel.id) channel_id = str(message.channel.id)
@ -66,6 +65,7 @@ class ReginaldCog(commands.Cog):
# ✅ Fetch the stored listening channel or fall back to default # ✅ Fetch the stored listening channel or fall back to default
allowed_channel_id = await self.config.guild(guild).listening_channel() allowed_channel_id = await self.config.guild(guild).listening_channel()
if not allowed_channel_id: if not allowed_channel_id:
ctx.send("<deciding channel is not cool>")
allowed_channel_id = self.default_listening_channel allowed_channel_id = self.default_listening_channel
await self.config.guild(guild).listening_channel.set(allowed_channel_id) await self.config.guild(guild).listening_channel.set(allowed_channel_id)
@ -91,13 +91,14 @@ class ReginaldCog(commands.Cog):
await message.channel.send(random.choice(["Yes?", "How may I assist?", "You rang?"])) await message.channel.send(random.choice(["Yes?", "How may I assist?", "You rang?"]))
return return
explicit_invocation = True explicit_invocation = True
# ✅ Passive Listening: Check if the message contains relevant keywords # ✅ Passive Listening: Check if the message contains relevant keywords
elif self.should_reginald_interject(message_content): elif self.should_reginald_interject(message_content):
prompt = message_content prompt = message_content
explicit_invocation = False explicit_invocation = False
else: else:
ctx.send("<decided not to interject>")
return # Ignore irrelevant messages return # Ignore irrelevant messages
# ✅ Context Handling: Maintain conversation flow # ✅ Context Handling: Maintain conversation flow