mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
Make [p]selfrole without subcommand "toggle" the selfrole (#4826)
* Merge selfrole and remove into one command replacement pr * docs add to the docs * Update admin.py remove register name * Update admin.rst * Fixes * Fix the duplicated command decorators * Minimize the diff Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
parent
1be7435fb5
commit
bee022d1bb
@ -46,13 +46,16 @@ selfrole
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
[p]selfrole
|
||||
[p]selfrole <selfrole>
|
||||
|
||||
**Description**
|
||||
|
||||
Add or remove roles to yourself. Those roles must have been configured as user
|
||||
settable by admins using the :ref:`selfroleset command
|
||||
<admin-command-selfroleset>`.
|
||||
Add or remove a role from yourself. It must have been configured as user settable
|
||||
by admins using the :ref:`selfroleset command <admin-command-selfroleset>`.
|
||||
|
||||
**Arguments**
|
||||
|
||||
* ``<selfrole>``: The role you want to attribute or remove from yourself. |role-input|
|
||||
|
||||
.. _admin-command-selfrole-add:
|
||||
|
||||
|
||||
@ -391,12 +391,20 @@ class Admin(commands.Cog):
|
||||
return valid_roles
|
||||
|
||||
@commands.guild_only()
|
||||
@commands.group()
|
||||
async def selfrole(self, ctx: commands.Context):
|
||||
"""Apply selfroles."""
|
||||
pass
|
||||
@commands.group(invoke_without_command=True)
|
||||
async def selfrole(self, ctx: commands.Context, *, selfrole: SelfRole):
|
||||
"""
|
||||
Add or remove a selfrole from yourself.
|
||||
|
||||
@selfrole.command(name="add")
|
||||
Server admins must have configured the role as user settable.
|
||||
NOTE: The role is case sensitive!
|
||||
"""
|
||||
if selfrole in ctx.author.roles:
|
||||
return await self._removerole(ctx, ctx.author, selfrole, check_user=False)
|
||||
else:
|
||||
return await self._addrole(ctx, ctx.author, selfrole, check_user=False)
|
||||
|
||||
@selfrole.command(name="add", hidden=True)
|
||||
async def selfrole_add(self, ctx: commands.Context, *, selfrole: SelfRole):
|
||||
"""
|
||||
Add a selfrole to yourself.
|
||||
@ -407,7 +415,7 @@ class Admin(commands.Cog):
|
||||
# noinspection PyTypeChecker
|
||||
await self._addrole(ctx, ctx.author, selfrole, check_user=False)
|
||||
|
||||
@selfrole.command(name="remove")
|
||||
@selfrole.command(name="remove", hidden=True)
|
||||
async def selfrole_remove(self, ctx: commands.Context, *, selfrole: SelfRole):
|
||||
"""
|
||||
Remove a selfrole from yourself.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user