Answer the question
In order to leave comments, you need to log in
How do I prevent a bot from replying to private messages on Discord?
I want to make it so that only the bot can write to the server member, and the server member itself cannot. Those. the bot did not respond to commands in private messages, only on the server. How can I do that?
Answer the question
In order to leave comments, you need to log in
Add a check for command execution in the LAN.
Or for the whole bot:
https://discordpy.readthedocs.io/en/stable/ext/com...
@bot.check
async def global_guild_only(ctx):
if not ctx.guild:
raise commands.NoPrivateMessage # replicating guild_only check: https://github.com/Rapptz/discord.py/blob/42a538edda79f92a26afe0ac902b45c1ea20154d/discord/ext/commands/core.py#L1832-L1846
return True
@bot.command()
@commands.guild_only()
async def cmd(ctx, ...):
"""Here we go..."""
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question