fix(antipolls): use append instead of extend
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 37s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 54s

This commit is contained in:
Seaswimmer 2024-04-16 10:56:10 -04:00
parent 602d759e67
commit 4f38fc1f7d
Signed by: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -96,9 +96,9 @@ class AntiPolls(commands.Cog):
failed: list[discord.Role] = [] failed: list[discord.Role] = []
for role in roles: for role in roles:
if role.id in role_whitelist: if role.id in role_whitelist:
failed.extend(role) failed.append(role)
continue continue
role_whitelist.extend(role.id) role_whitelist.append(role.id)
await ctx.tick() await ctx.tick()
if failed: 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(role.mention for role in failed)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none)
@ -111,7 +111,7 @@ class AntiPolls(commands.Cog):
failed: list[discord.Role] = [] failed: list[discord.Role] = []
for role in roles: for role in roles:
if role.id not in role_whitelist: if role.id not in role_whitelist:
failed.extend(role) failed.append(role)
continue continue
role_whitelist.remove(role.id) role_whitelist.remove(role.id)
await ctx.tick() await ctx.tick()
@ -139,9 +139,9 @@ class AntiPolls(commands.Cog):
failed: list[discord.TextChannel] = [] failed: list[discord.TextChannel] = []
for channel in channels: for channel in channels:
if channel.id in channel_whitelist: if channel.id in channel_whitelist:
failed.extend(channel) failed.append(channel)
continue continue
channel_whitelist.extend(channel.id) channel_whitelist.append(channel.id)
await ctx.tick() await ctx.tick()
if failed: 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(channel.mention for channel in failed)}", delete_after=10, allowed_mentions=discord.AllowedMentions.none)
@ -154,7 +154,7 @@ class AntiPolls(commands.Cog):
failed: list[discord.TextChannel] = [] failed: list[discord.TextChannel] = []
for channel in channels: for channel in channels:
if channel.id not in channel_whitelist: if channel.id not in channel_whitelist:
failed.extend(channel) failed.append(channel)
continue continue
channel_whitelist.remove(channel.id) channel_whitelist.remove(channel.id)
await ctx.tick() await ctx.tick()