【发布时间】:2022-07-16 03:45:24
【问题描述】:
所以,任何人都可以邀请我的个人机器人到他们的服务器。所以,我希望该命令可以在特定频道或特定服务器上使用 @bot.event 而不是客户端。
【问题讨论】:
标签: javascript python discord
所以,任何人都可以邀请我的个人机器人到他们的服务器。所以,我希望该命令可以在特定频道或特定服务器上使用 @bot.event 而不是客户端。
【问题讨论】:
标签: javascript python discord
如果你使用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 中添加检查,这样机器人就不会回复自己
【讨论】: