【问题标题】:Command runs in discord.py, but does not send embed and gives no error命令在 discord.py 中运行,但不发送嵌入且未给出错误
【发布时间】:2022-11-23 23:45:13
【问题描述】:

我在 discord.py where 上遇到了一个奇怪的问题。它的其余部分有效,但它不会毫无错误地回复我的嵌入。 这是行不通的代码:

#The code if the number is incorrect
print(arg1)
    placement = sessions.index(ctx.author.id)
    placement = +1
    if arg1 != str(sessions[placement]):
      if int(arg1) >= sessions[placement]:
       print(sessions)
       placement = sessions.index(ctx.author.id)
       placement = +2
       print(sessions)
       embed=discord.Embed(title="Incorrect", description=f"Your number is too big, you have {str(sessions[placement])} left.", color=0xFF5733)
       embed.set_thumbnail(url="https://simg.nicepng.com/png/small/255-2554736_cancel-cliparts-red-x-transparent.png")
       await ctx.reply(embed=embed)
      else:
        placement = sessions.index(ctx.author.id)
        placement = +2
        print(sessions)
        embed=discord.Embed(title="Incorrect", description=f"Your number is too small you have {str(sessions[placement])} left.", color=0xFF5733)
        embed.set_thumbnail(url="https://simg.nicepng.com/png/small/255-2554736_cancel-cliparts-red-x-transparent.png")
        await ctx.reply(embed=embed)

函数运行但嵌入不会发送并且没有错误被记录。

我正在尝试创建一个随机数猜测游戏机器人,它会为个人用户生成随机会话来猜测数字。但我发现由于某种原因它不会回复嵌入。 我尝试重命名它,但仍然无效,我将其更改为 discord.embed 但仍然无效。我不知道是什么原因造成的。 请注意,命令的其余部分确实有效,除了发送嵌入之外的代码也是如此。 我不知道为什么这两个嵌入是单独的,但其余的消息都会发送。 谁能帮忙?

【问题讨论】:

    标签: python discord.py


    【解决方案1】:

    试试Ctx.sendCtx.message.reply
    我在嵌入中使用Colour名称也尝试更改它

    【讨论】:

      猜你喜欢
      • 2021-10-20
      • 1970-01-01
      • 2021-02-05
      • 2020-10-27
      • 2019-06-21
      • 2021-06-28
      • 2021-02-28
      • 2020-12-30
      • 2021-07-19
      相关资源
      最近更新 更多