Reputation: 558
In first place, sorry for confusing title guys, but i've got no Idea, how to call it more precisely.
So here's my problem: I have code that's used to get discord.Embed
object from previous message:
Creation of Embed:
channel = bot.get_channel(780735930579288115)
embed = discord.Embed(title="December 2020", color=0x6687ff)
embed.set_author(name="New theme voting")
embed.add_field(name="\u200b", value="Nothing Interesting atm", inline=False)
sent = await channel.send("@.everyone We're starting new voting", embed=embed)
config[str(ctx.message.guild.id)]['quiz'] = str(ctx.sent.id)
with open('config.ini', 'w') as configfile:
config.write(configfile)
Getting Embed object:
config.read("config.ini")
uzenet = await ctx.fetch_message(int(config[str(ctx.message.guild.id)]['quiz']))
embed = uzenet.embeds[0]
await ctx.send(embed=embed)
Error:
And there is this strange error that says that discord.Embed
object is not discord.Embed
object(I guess?)
Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\CoronaBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:/Users/user/PycharmProjects/CoronaBot/bot.py", line 476, in newOption
await ctx.send(embed=embed)
AttributeError: type object 'Embed' has no attribute 'from_data'
And I have no Idea what else I can do to make python treat it like an discord.Embed
object
Upvotes: 0
Views: 325
Reputation: 118
I am assuming ctx.sent.id
is referring to the message id, you should use ctx.message.id
Upvotes: 0
Reputation: 3994
I think you'd need to write sent.id
instead of ctx.sent.id
:
channel = bot.get_channel(780735930579288115)
embed = discord.Embed(title="December 2020", color=0x6687ff)
embed.set_author(name="New theme voting")
embed.add_field(name="\u200b", value="Nothing Interesting atm", inline=False)
sent = await channel.send("@.everyone We're starting new voting", embed=embed)
config[str(ctx.message.guild.id)]['quiz'] = str(sent.id) # Here
with open('config.ini', 'w') as configfile:
config.write(configfile)
If you still have any error, please provide more code as that's everything I can find with the sample you gave.
Upvotes: 2