【问题标题】:good output/executer for discord.pydiscord.py 的良好输出/执行器
【发布时间】:2021-09-10 01:59:19
【问题描述】:

每次我运行一个命令时,该命令都不会给 python 执行器一个错误。它只是打破它。

你们有没有更好的执行者可以推荐?

【问题讨论】:

  • 你想到了什么样的错误
  • 另外,在这种情况下,您认为什么是执行者

标签: python command executor


【解决方案1】:

有时会显示错误,有时不会。如果命令不起作用,但控制台没有输出任何内容,您可能需要尝试以下操作:

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)

如果命令失败,这将打印出错误。

【讨论】:

    猜你喜欢
    • 2020-04-15
    • 1970-01-01
    • 2014-01-23
    • 2013-10-17
    • 2016-01-26
    • 1970-01-01
    • 1970-01-01
    • 2017-11-07
    • 1970-01-01
    相关资源
    最近更新 更多