本文介紹了允許 Discord Rewrite 機器人響應其他機器人的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我有一個 Discord 機器人和一個用于 Discord 頻道的 webhook 設置,以每小時在 dot 上發送一個命令.然而,默認情況下,Discord Rewrite 似乎忽略了從其他機器人發送的命令.我該如何禁用它?
I have a Discord bot and a webhook setup for a Discord channel to send a command every hour on the dot. However it seems that Discord Rewrite by default ignores commands sent from other bots. How do I go about disabling this?
我需要在 per-command 函數或 on_message 函數上修改某些內容嗎?
Do I need to modify something on a per-command function or the on_message function?
當前消息
@bot.event
async def on_message(message):
await bot.process_commands(message)
找到解決方案
@bot.event
async def on_message(message):
ctx = await bot.get_context(message)
await bot.invoke(ctx)
推薦答案
嘗試為它添加一個檢查,例如:
try adding a check for it, example :
on_message
if message.author.bot == True:
#Do something
命令
if ctx.author.bot == True:
#Do something
這篇關于允許 Discord Rewrite 機器人響應其他機器人的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!