changes + a secret

This commit is contained in:
Lilac-Rose
2025-11-24 20:49:37 +01:00
parent b19738cf88
commit 233de94118
4 changed files with 53 additions and 4 deletions

1
bot.py
View File

@@ -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()

53
events/chain.py Normal file
View File

@@ -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))

View File

@@ -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))

View File

@@ -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):