Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user #35

Merged
merged 1 commit into from
Nov 13, 2021
Merged

user #35

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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