Merge pull request 'Disable Gurt AI in DMs' (#7) from pr/gurt-dm-check into master

Reviewed-on: #7
This commit is contained in:
slipstream 2025-06-09 11:31:59 -06:00
commit 216ade503b

View File

@ -294,6 +294,11 @@ async def on_message_listener(cog: "GurtCog", message: discord.Message):
and message.reference.resolved.author == cog.bot.user and message.reference.resolved.author == cog.bot.user
) )
gurt_in_message = "gurt" in message.content.lower() gurt_in_message = "gurt" in message.content.lower()
if message.guild is None and (bot_mentioned or replied_to_bot or gurt_in_message):
await message.channel.send("AI functionality is disabled in DMs.")
return
now = time.time() now = time.time()
time_since_last_activity = now - cog.channel_activity.get(channel_id, 0) time_since_last_activity = now - cog.channel_activity.get(channel_id, 0)
time_since_bot_spoke = now - cog.bot_last_spoke.get(channel_id, 0) time_since_bot_spoke = now - cog.bot_last_spoke.get(channel_id, 0)