diff --git a/bot.py b/bot.py index c461bbd..d4ad161 100644 --- a/bot.py +++ b/bot.py @@ -83,7 +83,6 @@ async def on_ready(): await load_cogs("wordle") await load_cogs("reminders") - # Sync slash commands after loading cogs try: synced = await bot.tree.sync() diff --git a/events/chain.py b/events/chain.py new file mode 100644 index 0000000..b69338a --- /dev/null +++ b/events/chain.py @@ -0,0 +1,53 @@ +import discord +from discord.ext import commands + +class ChainDetector(commands.Cog): + def __init__(self, bot): + self.bot = bot + # Stores per-channel: + # {channel_id: {"last_message": str, "users": [user_ids]}} + self.cache = {} + + @commands.Cog.listener() + async def on_message(self, message: discord.Message): + # Ignore bot messages + if message.author.bot: + return + + # Ignore images, stickers, files, etc. + if message.attachments or message.stickers: + return + + content = message.content.strip() + if not content: + return + + channel_id = message.channel.id + + # Initialize cache for this channel + if channel_id not in self.cache: + self.cache[channel_id] = { + "last_message": content, + "users": [message.author.id] + } + return + + chain = self.cache[channel_id] + + # If message matches the chain message + if content == chain["last_message"]: + # Only count if it's a DIFFERENT user + if message.author.id not in chain["users"]: + chain["users"].append(message.author.id) + else: + # Reset chain + chain["last_message"] = content + chain["users"] = [message.author.id] + + # If three different users said the same thing + if len(chain["users"]) == 3: + await message.channel.send(content) + chain["users"] = [] + +async def setup(bot): + await bot.add_cog(ChainDetector(bot)) diff --git a/events/goodbot.py b/events/goodbot.py index 1fd61f9..b0e8053 100644 --- a/events/goodbot.py +++ b/events/goodbot.py @@ -1,7 +1,6 @@ import discord from discord.ext import commands - class GoodBotListener(commands.Cog): """Responds to 'good bot' mentions.""" @@ -18,6 +17,5 @@ class GoodBotListener(commands.Cog): if self.bot.user.mentioned_in(message) and "good bot" in message.content.lower(): await message.reply("<:CatgirlLacieBlush:1283389963018440754>") - async def setup(bot: commands.Bot): await bot.add_cog(GoodBotListener(bot)) \ No newline at end of file diff --git a/events/welcome.py b/events/welcome.py index 61ce139..1727323 100644 --- a/events/welcome.py +++ b/events/welcome.py @@ -4,7 +4,6 @@ from discord.ext import commands class Welcome(commands.Cog): def __init__(self, bot): self.bot = bot - self.debug_channel_id = 1424145004976275617 @commands.Cog.listener() async def on_member_join(self, member):