所以,我目前有這個命令來更改與 discord py 不一致的頻道的標題。該命令在每個通道中運行幾次,然后在每個通道的基礎上中斷(或在大約 6 分鐘后完成命令)。
import api
import discord
from discord.ext import commands
client = discord.Client()
client = commands.Bot(command_prefix=["pp.", "Pp.", "PP.", "pP."])
@client.command(pass_context=True)
async def progress_update(ctx, new_emoji):
if ctx.message.channel.name[0] not in ["??", "??", "??", "??"]:
await ctx.send("That is not a valid channel to run **progress_update** in.\nPlease run this command in a challenge channel")
return
if new_emoji not in ["??", "??", "??", "??"]:
await ctx.send("That is not a valid emoji.\nPlease use one of the following: ??, ??, ??, ??")
return
new_name = new_emoji ctx.message.channel.name[1:]
temp = await ctx.message.channel.edit(name=new_name)
await ctx.send("Progress updated!")
client.run(api.api)
我很難過問題是什么。它似乎只發生在ctx.message.channel.edit命令上,因為not it如果我輸入錯誤的命令,我仍然可以查看錯誤訊息(在陳述句中)。
uj5u.com熱心網友回復:
您很可能達到了速率限制。您每 10 分鐘只能更改兩次頻道的名稱或主題。值得慶幸的是,discord.py 自己處理速率限制,您不會收到錯誤訊息。如果您啟用日志記錄,您也可以看到這一點。
但是,請注意,您的機器人向 discord API 發出的每個請求都會向您的控制臺發送垃圾郵件,您可以設定更具體的日志記錄來緩解這種情況。只是抬頭。
在此處閱讀有關設定日志記錄的更多資訊
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/385836.html
