Skip to content

Commit ac2e0c6

Browse files
committed
Cleaner code :D
1 parent fa6cf62 commit ac2e0c6

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

cogs/utility.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -701,34 +701,32 @@ async def mention(self, ctx, *user_or_role: Union[discord.Role, discord.Member,
701701
elif (
702702
len(user_or_role) == 1
703703
and isinstance(user_or_role[0], str)
704-
and user_or_role[0].lower() in ("disable", "reset", "all", "everyone")
704+
and user_or_role[0].lower() in ("disable", "reset")
705705
):
706706
option = user_or_role[0].lower()
707707
if option == "disable":
708708
embed = discord.Embed(
709709
description=f"Disabled mention on thread creation.", color=self.bot.main_color,
710710
)
711711
self.bot.config["mention"] = None
712-
elif option == "reset":
712+
else:
713713
embed = discord.Embed(
714714
description="`mention` is reset to default.", color=self.bot.main_color,
715715
)
716716
self.bot.config.remove("mention")
717-
else:
718-
embed = discord.Embed(
719-
title="Changed mention!",
720-
description=f'On thread creation the bot now says "@everyone".',
721-
color=self.bot.main_color,
722-
)
723-
self.bot.config["mention"] = "@everyone"
724717
await self.bot.config.update()
725718
else:
719+
mention = []
720+
everyone = ("all", "everyone")
726721
for m in user_or_role:
727-
if not isinstance(m, (discord.Role, discord.Member)):
722+
if not isinstance(m, (discord.Role, discord.Member)) and m not in everyone:
728723
raise commands.BadArgument(f'Role or Member "{m}" not found.')
729-
mention = " ".join(
730-
i.mention if i is not ctx.guild.default_role else str(i) for i in user_or_role
731-
)
724+
elif m == ctx.guild.default_role or m in everyone:
725+
mention.append("@everyone")
726+
continue
727+
mention.append(m.mention)
728+
729+
mention = " ".join(mention)
732730
embed = discord.Embed(
733731
title="Changed mention!",
734732
description=f'On thread creation the bot now says "{mention}".',

0 commit comments

Comments
 (0)