【问题标题】:Discord.py More than 1 Int neededDiscord.py 需要超过 1 个 Int
【发布时间】:2021-01-24 11:38:17
【问题描述】:

我正在尝试为我的 Discord Bot 创建垃圾邮件命令,但我需要超过 1 个整数,因此我无法设置标题描述和垃圾邮件数量...如果您能提供帮助会很好

@bot.command()
    async def spam(ctx, amount: int, title: int, *, message):

错误: 参数“title”转换为“int”失败。

【问题讨论】:

  • 你为什么要将标题作为整数?
  • 我想做类似 >spam 2 "That the Title" "This is the Description of the embed"
  • 如果你想要标题str,你为什么要title: int

标签: python discord.py embed discord.py-rewrite


【解决方案1】:

问题是,您将标题设置为整数(仅接受数字),如果您不希望它是任何东西,就这样做

@bot.command()
async def spam(ctx, amount: int, title: str, *, message):

你可能需要一个 Embed 的标题,如果你不使用 embed,就这样做

@bot.command()
   async def spam(ctx, amount: int, *, message):

您的代码正在尝试将标题从字符串转换为整数(这将引发错误)。

【讨论】:

    猜你喜欢
    • 2011-05-29
    • 2012-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多