Answer the question
In order to leave comments, you need to log in
How to make it so that if a person does not have rights to the command, then he writes that you do not have rights to this?
I'm new to programming, I'm trying to create a bot, I've almost finished it, but in order to put it on some kind of monitoring, it needs to say about an error that there are no rights. I've searched all over the internet, but I can't find the answer anywhere. Help.
Answer the question
In order to leave comments, you need to log in
permission = True
if(permission != True):
print('нет прав')
Well, there are a couple of options:
1) You can create a list with an ID to whom this command is allowed. And then check whether the ID of the person who entered the command is in the list. I don’t know the discord API commands well, so an approximate view for such a check:
Acces_to_cmd = [273747, 2848, ...]
If message.author.id in Acces_to_cmd:
If role in user.roles:
def check()
permission = 1
if permission == "1":
return(1)
else:
return(0)
def test():
if check() == "1":
a = input()
print(a)
else:
print("Недостаточно прав")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question