fix(antipolls): fixed the humanize_list typeerror (for real this time)
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 38s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 55s

This commit is contained in:
Seaswimmer 2024-04-16 11:05:37 -04:00
parent 73b0e73ff0
commit 15715dff3c
Signed by: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -101,8 +101,7 @@ class AntiPolls(commands.Cog):
role_whitelist.append(role.id) role_whitelist.append(role.id)
await ctx.tick() await ctx.tick()
if failed: if failed:
mention_list = (role.mention for role in failed) await ctx.send(f"The following roles were already in the whitelist: {humanize_list([role 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_list)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none)
@antipolls_roles.command(name="remove") @antipolls_roles.command(name="remove")
async def antipolls_roles_remove(self, ctx: commands.Context, *roles: discord.Role) -> None: async def antipolls_roles_remove(self, ctx: commands.Context, *roles: discord.Role) -> None:
@ -117,8 +116,7 @@ class AntiPolls(commands.Cog):
role_whitelist.remove(role.id) role_whitelist.remove(role.id)
await ctx.tick() await ctx.tick()
if failed: if failed:
mention_list = (role.mention for role in 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_list)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none)
@antipolls_roles.command(name="list") @antipolls_roles.command(name="list")
async def antipolls_roles_list(self, ctx: commands.Context) -> None: async def antipolls_roles_list(self, ctx: commands.Context) -> None:
@ -127,7 +125,7 @@ class AntiPolls(commands.Cog):
if not role_whitelist: if not role_whitelist:
return await ctx.send("No roles in the whitelist.") return await ctx.send("No roles in the whitelist.")
roles = [ctx.guild.get_role(role) for role in role_whitelist] roles = [ctx.guild.get_role(role) for role in role_whitelist]
await ctx.send(humanize_list(role.mention for role in roles)) await ctx.send(humanize_list([role.mention for role in roles]))
@antipolls.group(name="channels") @antipolls.group(name="channels")
async def antipolls_channels(self, ctx: commands.Context) -> None: async def antipolls_channels(self, ctx: commands.Context) -> None:
@ -146,8 +144,7 @@ class AntiPolls(commands.Cog):
channel_whitelist.append(channel.id) channel_whitelist.append(channel.id)
await ctx.tick() await ctx.tick()
if failed: if failed:
mention_list = (role.mention for role in 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_list)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none)
@antipolls_channels.command(name="remove") @antipolls_channels.command(name="remove")
async def antipolls_channels_remove(self, ctx: commands.Context, *channels: discord.TextChannel) -> None: async def antipolls_channels_remove(self, ctx: commands.Context, *channels: discord.TextChannel) -> None:
@ -162,8 +159,7 @@ class AntiPolls(commands.Cog):
channel_whitelist.remove(channel.id) channel_whitelist.remove(channel.id)
await ctx.tick() await ctx.tick()
if failed: if failed:
mention_list = (role.mention for role in 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_list)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none)
@antipolls_channels.command(name="list") @antipolls_channels.command(name="list")
async def antipolls_channels_list(self, ctx: commands.Context) -> None: async def antipolls_channels_list(self, ctx: commands.Context) -> None:
@ -172,7 +168,7 @@ class AntiPolls(commands.Cog):
if not channel_whitelist: if not channel_whitelist:
return await ctx.send("No channels in the whitelist.") return await ctx.send("No channels in the whitelist.")
channels = [ctx.guild.get_channel(channel) for channel in channel_whitelist] channels = [ctx.guild.get_channel(channel) for channel in channel_whitelist]
await ctx.send(humanize_list(channel.mention for channel in channels)) await ctx.send(humanize_list([channel.mention for channel in channels]))
@antipolls.command(name="managemessages") @antipolls.command(name="managemessages")
async def antipolls_managemessages(self, ctx: commands.Context, enabled: bool) -> None: async def antipolls_managemessages(self, ctx: commands.Context, enabled: bool) -> None: