Skip to content

Commit fa6cf62

Browse files
committed
Update mention command.
1 parent 20877d9 commit fa6cf62

File tree

2 files changed

+35
-13
lines changed

2 files changed

+35
-13
lines changed

cogs/utility.py

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -673,41 +673,62 @@ async def ping(self, ctx):
673673

674674
@commands.command()
675675
@checks.has_permissions(PermissionLevel.ADMINISTRATOR)
676-
async def mention(self, ctx, *mention: Union[discord.Role, discord.Member, str]):
676+
async def mention(self, ctx, *user_or_role: Union[discord.Role, discord.Member, str]):
677677
"""
678678
Change what the bot mentions at the start of each thread.
679679
680-
Type only `{prefix}mention` to retrieve your current "mention" message.
681-
`{prefix}mention disable` to disable mention.
682-
`{prefix}mention reset` to reset it to default value.
680+
`user_or_role` may be a user ID, mention, name, role ID, mention, or name.
681+
You can also set it to mention multiple users or roles, just separate the arguments with space.
682+
683+
Examples:
684+
- `{prefix}mention @user`
685+
- `{prefix}mention @user @role`
686+
- `{prefix}mention 984301093849028 388218663326449`
687+
- `{prefix}mention everyone`
688+
689+
Do not ping `@everyone` to set mention to everyone, use "everyone" or "all" instead.
690+
691+
Notes:
692+
- Type only `{prefix}mention` to retrieve your current "mention" message.
693+
- `{prefix}mention disable` to disable mention.
694+
- `{prefix}mention reset` to reset it to default value, which is "@here".
683695
"""
684696
current = self.bot.config["mention"]
685-
if not mention:
697+
if not user_or_role:
686698
embed = discord.Embed(
687699
title="Current mention:", color=self.bot.main_color, description=str(current)
688700
)
689701
elif (
690-
len(mention) == 1
691-
and isinstance(mention[0], str)
692-
and mention[0].lower() in ["disable", "reset"]
702+
len(user_or_role) == 1
703+
and isinstance(user_or_role[0], str)
704+
and user_or_role[0].lower() in ("disable", "reset", "all", "everyone")
693705
):
694-
option = mention[0].lower()
706+
option = user_or_role[0].lower()
695707
if option == "disable":
696708
embed = discord.Embed(
697709
description=f"Disabled mention on thread creation.", color=self.bot.main_color,
698710
)
699711
self.bot.config["mention"] = None
700-
else:
712+
elif option == "reset":
701713
embed = discord.Embed(
702714
description="`mention` is reset to default.", color=self.bot.main_color,
703715
)
704716
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"
705724
await self.bot.config.update()
706725
else:
707-
for m in mention:
726+
for m in user_or_role:
708727
if not isinstance(m, (discord.Role, discord.Member)):
709728
raise commands.BadArgument(f'Role or Member "{m}" not found.')
710-
mention = " ".join(i.mention for i in mention)
729+
mention = " ".join(
730+
i.mention if i is not ctx.guild.default_role else str(i) for i in user_or_role
731+
)
711732
embed = discord.Embed(
712733
title="Changed mention!",
713734
description=f'On thread creation the bot now says "{mention}".',

core/config_help.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
"`{prefix}mention Yo~ Here's a new thread for ya!`"
5353
],
5454
"notes": [
55-
"Unfortunately, it's not currently possible to disable mention. You do not have to include a mention."
55+
"To disable mention, use command `{prefix}mention disable`.",
56+
"See also: `{prefix}help mention`."
5657
]
5758
},
5859
"main_color": {

0 commit comments

Comments
 (0)