允许 Discord Rewrite 机器人响应其他机器人

Cyn*_*dez 6 python discord discord.py-rewrite

我有一个 Discord bot 和一个用于 Discord 频道的 webhook 设置,可以每小时在点上发送一个命令。然而,默认情况下,Discord Rewrite 似乎忽略了从其他机器人发送的命令。我该如何禁用此功能?

我是否需要修改 per-command 函数或 on_message 函数上的某些内容?

当前消息

@bot.event
async def on_message(message):
    await bot.process_commands(message)
Run Code Online (Sandbox Code Playgroud)

编辑:找到解决方案

@bot.event
async def on_message(message):
    ctx = await bot.get_context(message)
    await bot.invoke(ctx)
Run Code Online (Sandbox Code Playgroud)

Rap*_*iel 1

尝试添加一个检查:

消息上:

if message.author.bot == True:
    #Do something
Run Code Online (Sandbox Code Playgroud)

命令:

if ctx.author.bot == True:
    #Do something
Run Code Online (Sandbox Code Playgroud)