From d9c123d441513b33dfc011bf02dbf546127754ac Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Tue, 16 Apr 2024 11:00:05 -0400 Subject: [PATCH] fix(antipolls): more fixes to antipoll's config commands --- antipolls/antipolls.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/antipolls/antipolls.py b/antipolls/antipolls.py index 5c4877d..da7f1cc 100644 --- a/antipolls/antipolls.py +++ b/antipolls/antipolls.py @@ -93,30 +93,30 @@ class AntiPolls(commands.Cog): """Add roles to the whitelist.""" async with self.config.guild(ctx.guild).role_whitelist() as role_whitelist: role_whitelist: list - failed: list[discord.Role] = [] + failed: list[discord.Role.mention] = [] for role in roles: if role.id in role_whitelist: - failed.append(role) + failed.append(role.mention) continue role_whitelist.append(role.id) await ctx.tick() if failed: - await ctx.send(f"The following roles were already in the whitelist: {humanize_list(role.mention for role in failed)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none) + await ctx.send(f"The following roles were already in the whitelist: {humanize_list(mention for mention in failed)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none) @antipolls_roles.command(name="remove") async def antipolls_roles_remove(self, ctx: commands.Context, *roles: discord.Role) -> None: """Remove roles from the whitelist.""" async with self.config.guild(ctx.guild).role_whitelist() as role_whitelist: role_whitelist: list - failed: list[discord.Role] = [] + failed: list[discord.Role.mention] = [] for role in roles: if role.id not in role_whitelist: - failed.append(role) + failed.append(role.mention) continue role_whitelist.remove(role.id) await ctx.tick() if failed: - await ctx.send(f"The following roles were not in the whitelist: {humanize_list(role.mention for role in failed)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none) + await ctx.send(f"The following roles were not in the whitelist: {humanize_list(mention for mention in failed)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none) @antipolls_roles.command(name="list") async def antipolls_roles_list(self, ctx: commands.Context) -> None: @@ -136,7 +136,7 @@ class AntiPolls(commands.Cog): """Add channels to the whitelist.""" async with self.config.guild(ctx.guild).channel_whitelist() as channel_whitelist: channel_whitelist: list - failed: list[discord.TextChannel] = [] + failed: list[discord.TextChannel.mention] = [] for channel in channels: if channel.id in channel_whitelist: failed.append(channel) @@ -144,22 +144,22 @@ class AntiPolls(commands.Cog): channel_whitelist.append(channel.id) await ctx.tick() if failed: - await ctx.send(f"The following channels were already in the whitelist: {humanize_list(channel.mention for channel in failed)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none) + await ctx.send(f"The following channels were already in the whitelist: {humanize_list(mention for mention in failed)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none) @antipolls_channels.command(name="remove") async def antipolls_channels_remove(self, ctx: commands.Context, *channels: discord.TextChannel) -> None: """Remove channels from the whitelist.""" async with self.config.guild(ctx.guild).channel_whitelist() as channel_whitelist: channel_whitelist: list - failed: list[discord.TextChannel] = [] + failed: list[discord.TextChannel.mention] = [] for channel in channels: if channel.id not in channel_whitelist: - failed.append(channel) + failed.append(channel.mention) continue channel_whitelist.remove(channel.id) await ctx.tick() if failed: - await ctx.send(f"The following channels were not in the whitelist: {humanize_list(channel.mention for channel in failed)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none) + await ctx.send(f"The following channels were not in the whitelist: {humanize_list(mention for mention in failed)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none) @antipolls_channels.command(name="list") async def antipolls_channels_list(self, ctx: commands.Context) -> None: