Skip to content

Commit

Permalink
Merge pull request #35 from EdVraz/master
Browse files Browse the repository at this point in the history
user
  • Loading branch information
EepyElvyra authored Nov 13, 2021
2 parents b7aecbe + 08e70bc commit 8b1d41e
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions cogs/server_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,50 @@ async def _unban(self, ctx: SlashContext, user_id: str,
await ctx.send(f"unbanned {user.mention}!")

# @cog_ext.cog_subcommand(base="server", subcommand_group="user", name="un-punish", description="un-punishes a user")
# @cog_ext.cog_subcommand(base="server", subcommand_group="user", name="add-role", description="adds a role to a user")
# @cog_ext.cog_subcommand(base="server", subcommand_group="user", name="remove-role", description="removes a role from a user")

radd_opt = [
{
"name": "user",
"description": "the user to add the role to",
"required": True,
"type": 6,
},
{
"name": "role",
"description": "the role to add",
"type": 8
}
]

@cog_ext.cog_subcommand(base="server", subcommand_group="user", name="add-role",
description="adds a role to a user", options=radd_opt)
async def _role_add(self, ctx: SlashContext, user: discord.Member, role: discord.Role):
if not ctx.author.guild_permissions.manage_roles:
raise discord.ext.commands.MissingPermissions(missing_perms=["manage_roles"])
await user.add_roles([role])
await ctx.send("Done!")

rrem_opt = [
{
"name": "user",
"description": "the user to remove the role from",
"required": True,
"type": 6,
},
{
"name": "role",
"description": "the role to remove",
"type": 8
}
]

@cog_ext.cog_subcommand(base="server", subcommand_group="user", name="remove-role",
description="removes a role from a user", options=rrem_opt)
async def _role_remove(self, ctx: SlashContext, user: discord.Member, role: discord.Role):
if not ctx.author.guild_permissions.manage_roles:
raise discord.ext.commands.MissingPermissions(missing_perms=["manage_roles"])
await user.remove_roles([role])
await ctx.send("Done!")

rcre_opt = [
{
Expand Down

0 comments on commit 8b1d41e

Please sign in to comment.