【发布时间】:2021-09-10 01:59:19
【问题描述】:
每次我运行一个命令时,该命令都不会给 python 执行器一个错误。它只是打破它。
你们有没有更好的执行者可以推荐?
【问题讨论】:
-
你想到了什么样的错误?
-
另外,在这种情况下,您认为什么是执行者?
每次我运行一个命令时,该命令都不会给 python 执行器一个错误。它只是打破它。
你们有没有更好的执行者可以推荐?
【问题讨论】:
有时会显示错误,有时不会。如果命令不起作用,但控制台没有输出任何内容,您可能需要尝试以下操作:
import discord
from discord.ext import commands
token = "token"
client = commands.Bot(command_prefix='%')
@client.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandError): # Checks if the error was when a command failed
print(error) # Prints out the error in the console
client.run(token)
如果命令失败,这将打印出错误。
【讨论】: