[英]How can I make my discord bot only send a message if a user starts typing in a specific channel?
[英]in discord.py How can i make my bot that the commands only can be use in specific channel or specific server?
因此,任何人都可以邀请我的个人机器人到他们的服务器。 所以,我希望该命令将在特定频道或特定服务器上使用@bot.event 而不是客户端。
如果你使用await bot.process_commands(message)
你可以试试这个
@bot.event
async def on_message(message):
if message.channel.id == yourchannelid:
await bot.process_commands(message)
if message.guild.id = yourguildid:
await bot.process_commands(message)
您可以在 on_message 中添加检查,这样机器人就不会回复自己
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.