首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >嵌入到命令中不会发送,所有其他嵌入都会发送

嵌入到命令中不会发送,所有其他嵌入都会发送
EN

Stack Overflow用户
提问于 2019-04-16 17:48:20
回答 1查看 113关注 0票数 0

尽管所有其他嵌入都能正常工作,但"await bot.send_message(ctx.message.channel,embed=embed)“仍然在日志中发送错误,我不理解它。“机器人”是大多数人称之为客户端的东西。

我已经尝试使用bot.say()来查看通道是否是问题所在,并且尝试重新排列embed语句,使其声明得尽可能靠近发送。代码中的所有其他嵌入都使用相同的格式,几乎没有任何更改,我甚至复制-粘贴它以使其准确。我尝试注释掉它的所有部分,可能导致它的唯一部分要么是add_field语句之一,要么是初始设置,但我以前使用过这一点。

代码语言:javascript
复制
                title = "Rock Paper Scissors", 
                description = ctx.message.author.name, 
                color = discord.Color.red()
            )

            if(winner == "tie"):

                embed.set_thumbnail(url = "//https://i.imgur.com/RcnDdIR.png")
                embed.add_field(name= "Winner", value= "It was a tie! Both chose " + choice + "!", inline=False)
                embed.add_field(name= "Chips", value= users[ctx.message.author.id]["chips"], inline=False)

                await bot.send_message(ctx.message.channel, embed=embed)
                economy["rps"]["played"] += 1

                print (ctx.message.author.name + " Played Rock Paper Scissors, but tied")

                f = open(logname, "a")
                f.write(ctx.message.author.name + " Played Rock Paper Scissors, but tied\n")
                f.close()

"THE ERROR CODE
The Casiino is open
Running on Casiino
ID: 566778084175642635
Wildcard Played Rock Paper Scissors, but tied
Ignoring exception in command rps
Traceback (most recent call last):
  File "C:\Users\cjwil\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 50, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "C:\Users\cjwil\Desktop\casiino\bot.py", line 479, in rps
    await bot.send_message(ctx.message.channel, embed=embed)
  File "C:\Users\cjwil\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 1152, in send_message
    data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
  File "C:\Users\cjwil\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\http.py", line 200, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\cjwil\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\bot.py", line 846, in process_commands
    yield from command.invoke(ctx)
  File "C:\Users\cjwil\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 374, in invoke
    yield from injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\cjwil\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 54, in wrapped
    raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: BAD REQUEST (status code: 400)"```

"I want The embed to send without any issues and without throwing errors."
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55705261

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档