Skip to content
Advertisement

How can I make sue only I can use certain commands on my Discord bot? (Python)

So my Discord bot can now kick people from my server. But right now everyone can use the kick command. And I don’t want that. How can I fix this?

This is the code so far:

JavaScript

Thanks in advance!

Advertisement

Answer

I have done that before, this answer may help.

First, import the necessary modules first

JavaScript

I assume you already set up and defined the bot. Here’s the whole code that you should replace with:

JavaScript

What I added was simply @has_permissions(administrator=True). The answer you got previously in this post missed the s after permission, so it should be @has_permissions instead of @has_permission.

I hope this works! Let me know if you it works!

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement