From 267566fc5cc4eed0da70735407ae05cdf4b2a968 Mon Sep 17 00:00:00 2001 From: genekogan Date: Wed, 5 Jun 2024 00:53:22 -0700 Subject: [PATCH] turn on again --- src/cogs/Eden2Cog.py | 16 +++++++++++----- src/common/discord.py | 4 ---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/cogs/Eden2Cog.py b/src/cogs/Eden2Cog.py index 2f03c81..7325885 100644 --- a/src/cogs/Eden2Cog.py +++ b/src/cogs/Eden2Cog.py @@ -28,13 +28,13 @@ EdenConfig, ) -ALLOWED_CHANNELS = [int(c) for c in os.getenv("ALLOWED_CHANNELS", "").split(",")] +# ALLOWED_CHANNELS = [int(c) for c in os.getenv("ALLOWED_CHANNELS", "").split(",")] EDEN_CHARACTER_ID = os.getenv("EDEN_CHARACTER_ID") client = EdenClient() client.api_key = "2e4c65fb98622ca2aec8dae6ff07aae2eec3300aeab890e5" print(client.api_url) -thread_id = None +thread_id = "665161a77df49de2c24fc225" import asyncio @@ -48,15 +48,21 @@ def __init__( @commands.Cog.listener("on_message") async def on_message(self, message: discord.Message) -> None: + print("ok???") print("ON MESSAGE", message.content) if ( - message.channel.id not in ALLOWED_CHANNELS - or message.author.id == self.bot.user.id + # message.channel.id not in ALLOWED_CHANNELS + #or message.author.id == self.bot.user.id + message.author.id == self.bot.user.id or message.author.bot ): return - if message.channel.id != 1186378591118839808: + trigger_reply = is_mentioned(message, self.bot.user) + if not trigger_reply: + return + + if message.channel.id != 1186378591118839808 and message.channel.id != 1006143747588898849: return global thread_id diff --git a/src/common/discord.py b/src/common/discord.py index a9ca77a..8eaeae1 100644 --- a/src/common/discord.py +++ b/src/common/discord.py @@ -20,10 +20,6 @@ def is_mentioned(message: discord.Message, user: discord.User) -> bool: :param user: The user to check. :return: True if the user is mentioned, False otherwise. """ - print("--======") - print(message) - print(message.content) - print("mentions", [m.id for m in message.mentions], "---", user.id) return user.id in [m.id for m in message.mentions]