本文介紹了允許 Discord Rewrite 機(jī)器人響應(yīng)其他機(jī)器人的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!
問(wèn)題描述
我有一個(gè) Discord 機(jī)器人和一個(gè)用于 Discord 頻道的 webhook 設(shè)置,以每小時(shí)在 dot 上發(fā)送一個(gè)命令.然而,默認(rèn)情況下,Discord Rewrite 似乎忽略了從其他機(jī)器人發(fā)送的命令.我該如何禁用它?
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 函數(shù)或 on_message 函數(shù)上修改某些內(nèi)容嗎?
Do I need to modify something on a per-command function or the on_message function?
當(dāng)前消息
@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)
推薦答案
嘗試為它添加一個(gè)檢查,例如:
try adding a check for it, example :
on_message
if message.author.bot == True:
#Do something
命令
if ctx.author.bot == True:
#Do something
這篇關(guān)于允許 Discord Rewrite 機(jī)器人響應(yīng)其他機(jī)器人的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!