0

i have this code in my disnake project:

    @bot.event
    async def on_button_click(inter: disnake.MessageInteraction):
        embedMessageText = inter.message.embeds[0]
        embedFieldText = inter.message.embeds[0].content

And this code in other file:

        emb = disnake.Embed(title='**Koshki.TaskManager**', colour=disnake.Color.purple())
        emb.add_field(name=f'Задание для', value = f'Задание для {member.name}')
        emb.add_field(name=f'**Задача от {inter.author.name}**: ', value=task)
        emb.add_field(name='**Дедлайн**', value=time_end)
        emb.add_field(name=f'**Спрашивает:**', value=f'-')
        emb.set_footer(text = f'Дата: {times_start.strftime("%Y-%m-%d, %H:%M:%S")}')
        emb.set_author(
    name="Koshki.Moderator",
    url="https://github.com/YaFlay",
    icon_url="https://cdn.discordapp.com/avatars/979671843264938045/d472f30d59568db6fdeff0f1e1ca2b5c.png?size=256",
)

        buttons = disnake.ui.View()
        buttons.add_item(disnake.ui.Button(style=disnake.ButtonStyle.secondary, custom_id="checkmark", emoji="<:checkmark:905943731067305996>"))
        buttons.add_item(disnake.ui.Button(style=disnake.ButtonStyle.secondary, custom_id="deletesign", emoji="<:deletesign:905943741775368272>"))
        buttons.add_item(disnake.ui.Button(style=disnake.ButtonStyle.secondary, custom_id='question', emoji=f"❔"))
        await channel.send(content=member.mention, embed=emb, allowed_mentions=disnake.AllowedMentions(roles=True), view=buttons)
        await inter.response.send_message('Done.', ephemeral=True)

I wanna take value in this field, using embedFieldText = inter.message.embeds[0].content:

emb.add_field(name=f'Задание для', value = f'Задание для {member.name}')

but i take only

<disnake.embeds.Embed object at 0x7f60b565bac0>

UPD: I found a way how to read the data

Code:

embedMessage = inter.message.embeds[0]
embedMessageValue = embedMessage.fields[0].value
  • it can suggests that you get object and now you ha to get value(s) from this object - or check `print( dir(object) )` to see what function and values are in this object – furas Oct 06 '22 at 20:29

0 Answers0