From b818e3ec183e2a188f592f0e8777c8c16dbd97fc Mon Sep 17 00:00:00 2001 From: Lilac-Rose Date: Sun, 14 Dec 2025 15:19:42 +0100 Subject: [PATCH] added 'pop' to the exclusion list of words --- commands/role_color.py | 59 ++++++++++++++++++++++++++++++++++++++++++ stats/stats.py | 1 + 2 files changed, 60 insertions(+) diff --git a/commands/role_color.py b/commands/role_color.py index 225c2fb..e66aa37 100644 --- a/commands/role_color.py +++ b/commands/role_color.py @@ -56,6 +56,39 @@ class ColorRoles(commands.Cog): msg = f"❌ Error: `{e}`" if DEBUG else "❌ Something went wrong." await interaction.followup.send(msg, ephemeral=True) + @color_group.command(name="setfor", description="[ADMIN] Set a color role for another user.") + @app_commands.describe( + user="The user to set the color for.", + color="The color role to assign." + ) + @app_commands.choices(color=[app_commands.Choice(name=name, value=name) for name in COLOR_ROLE_NAMES]) + @ModerationBase.is_admin() + async def set_color_for(self, interaction: discord.Interaction, user: discord.Member, color: app_commands.Choice[str]): + await interaction.response.defer(ephemeral=False) + try: + guild = interaction.guild + + selected_role = discord.utils.get(guild.roles, name=color.value) + if not selected_role: + await interaction.followup.send(f"⚠️ The role **{color.value}** doesn't exist on this server.", ephemeral=True) + return + + # Remove any existing color roles + previous = [r for r in user.roles if r.name in COLOR_ROLE_NAMES] + if previous: + await user.remove_roles(*previous, reason=f"Admin {interaction.user} changing color role") + + # Add the new color role + await user.add_roles(selected_role, reason=f"Admin {interaction.user} set color role") + await interaction.followup.send( + f"✅ Set **{selected_role.name}** color role for {user.mention}!", + ephemeral=False + ) + except Exception as e: + print(f"[ERROR] /color setfor\n{traceback.format_exc()}") + msg = f"❌ Error: `{e}`" if DEBUG else "❌ Something went wrong." + await interaction.followup.send(msg, ephemeral=True) + @color_group.command(name="remove", description="Remove your current color role.") async def remove_color(self, interaction: discord.Interaction): await interaction.response.defer(ephemeral=True) @@ -85,6 +118,32 @@ class ColorRoles(commands.Cog): msg = f"❌ Error: `{e}`" if DEBUG else "❌ Something went wrong." await interaction.followup.send(msg, ephemeral=True) + @color_group.command(name="removefor", description="[ADMIN] Remove color role(s) from another user.") + @app_commands.describe(user="The user to remove color roles from.") + @ModerationBase.is_admin() + async def remove_color_for(self, interaction: discord.Interaction, user: discord.Member): + await interaction.response.defer(ephemeral=False) + try: + color_roles = [r for r in user.roles if r.name in COLOR_ROLE_NAMES] + + if not color_roles: + await interaction.followup.send( + f"ℹ️ {user.mention} doesn't have any color role to remove.", + ephemeral=False + ) + return + + await user.remove_roles(*color_roles, reason=f"Admin {interaction.user} removed color role") + removed_names = ", ".join([r.name for r in color_roles]) + await interaction.followup.send( + f"✅ Removed color role(s) from {user.mention}: **{removed_names}**", + ephemeral=False + ) + except Exception as e: + print(f"[ERROR] /color removefor\n{traceback.format_exc()}") + msg = f"❌ Error: `{e}`" if DEBUG else "❌ Something went wrong." + await interaction.followup.send(msg, ephemeral=True) + @color_group.command(name="list", description="Show all available role colors") async def list_colors(self, interaction: discord.Interaction): await interaction.response.defer(ephemeral=False) diff --git a/stats/stats.py b/stats/stats.py index 419be11..5d88465 100644 --- a/stats/stats.py +++ b/stats/stats.py @@ -36,6 +36,7 @@ class Stats(commands.Cog): 'here', 'there', 'when', 'where', 'why', 'how', 'all', 'any', 'both', 'each', 'few', 'more', 'most', 'other', 'some', 'such', 'no', 'nor', 'only', 'own', 'same', 'than', 'too', 'very', 's', 't', 'don', 'don\'t', 'like', + 'pop', # URL-related words 'http', 'https', 'www', 'com', 'org', 'net', 'io', 'gif', 'png', 'jpg', 'jpeg', 'tenor', 'giphy', 'imgur', 'discord', 'cdn', 'media', 'attachments'