mod/nickname: Handle permission issues
I vape
This commit is contained in:
parent
341e7e61c9
commit
3d4c0ecacf
1 changed files with 11 additions and 5 deletions
16
cogs/mod.py
16
cogs/mod.py
|
@ -481,12 +481,18 @@ class Mod(Cog):
|
||||||
|
|
||||||
Just send .nickname <user> to wipe the nickname."""
|
Just send .nickname <user> to wipe the nickname."""
|
||||||
|
|
||||||
if nick:
|
try:
|
||||||
await target.edit(nick=nick, reason=str(ctx.author))
|
if nick:
|
||||||
else:
|
await target.edit(nick=nick, reason=str(ctx.author))
|
||||||
await target.edit(nick=None, reason=str(ctx.author))
|
else:
|
||||||
|
await target.edit(nick=None, reason=str(ctx.author))
|
||||||
|
|
||||||
await ctx.send("Successfully set nickname.")
|
await ctx.send("Successfully set nickname.")
|
||||||
|
except discord.errors.Forbidden:
|
||||||
|
await ctx.send(
|
||||||
|
"I don't have the permission to set that user's nickname.\n"
|
||||||
|
"User's top role may be above mine, or I may lack Manage Nicknames permission."
|
||||||
|
)
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.check(check_if_staff)
|
@commands.check(check_if_staff)
|
||||||
|
|
Loading…
Reference in a new issue