Answer the question
In order to leave comments, you need to log in
How to make the discord.py bot write that he has no rights?
I am writing a bot for discord, for the test I created a command that gives a role to the user, and added the "command_error" event to it.
As planned, the bot will simply write that it does not have rights, but alas, it does not write this :s
I'm worried about this for a very long time , I look through the documentation of both discord and python itself a million times in search of an answer.
As a result, I turn to connoisseurs)
Code:
@Bot.command()
async def rtest(ctx, *, member = discord.Member, role = discord.Role):
roll = discord.utils.get(ctx.guild.roles, id = role.id)
await member.add_roles(roll)
await ctx.send("+")
@rtest.error
async def rtest_error(ctx, error):
if isinstance(error, commands.BotMissingPermissions):
await ctx.send("I don't have sufficient permissions!")
else:
pass
Answer the question
In order to leave comments, you need to log in
Well for starters
async def rtest(ctx, *, member = discord.Member, role = discord.Role):
await member.add_roles(role)
await ctx.send("+")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question