【发布时间】:2020-08-07 02:58:13
【问题描述】:
我正在尝试从消息 ID 重新发送嵌入,这是我的代码
@commands.command()
async def test(self, ctx, messageID: int):
channel = self.client.get_channel(740951313482907748)
message = await channel.fetch_message(messageID)
embed = message.embeds[0]
embed = discord.Embed.from_dict(embed)
await ctx.send(embed=embed)
每当我运行它时,就会出现这个错误:
Ignoring exception in command take:
Traceback (most recent call last):
File "C:\Users\kwiecinski\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 83, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\kwiecinski\Desktop\test_bot\cogs\channels.py", line 61, in take
embed = discord.Embed.from_dict(embedfrommessage)
File "C:\Users\kwiecinski\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\embeds.py", line 147, in from_dict
self.title = data.get('title', EmptyEmbed)
AttributeError: 'Embed' object has no attribute 'get'
print(type(embed))
>>> <class 'discord.embeds.Embed'>
我怎样才能摆脱这个错误?
【问题讨论】:
标签: python-3.x discord.py-rewrite