N
N
Nyxoy2021-12-03 12:54:40
Python
Nyxoy, 2021-12-03 12:54:40

How to blacklist discord.py?

you need to make a black list of servers, that is, so that the commands on a certain discord server would not work (what would I specify the id and that's it)
Example:
me: .help
Bot: I do not work on this server!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Simple Developer, 2021-12-03
@Andriy-Kosmenyuk

Here it is correct to ask a question, how to learn the basics of Python? Then this question would not arise. Just do a check before executing the command. If the command was sent from a blacklisted server in the form of a list with guild IDs, then send the required message and do not execute the command.

M
Maxim Nevzorov, 2021-12-15
@fixator10

Create a global check:
commands.Bot.check

BLACKLISTED_GUILDS = [803958338191541161, ...]

...

@bot.check
def check_commands(ctx):
    return ctx.guild.id not in BLACKLISTED_GUILDS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question