#AttributeError: 'ApplicationCommandInteraction' object has no attribute 'message'

1 messages · Page 1 of 1 (latest)

vagrant scarab
#
pollEmbed.timestamp = inter.message.created.at```
How I can do fix it if object has no attribute?
wind minnow
#

underscore not .

vagrant scarab
#

it doesn't work

wind minnow
#

oh, sorry i misread the title

#

it's because inter doesnt have the attribute message

#

you cant get the message from inter

#

that was only possible back with prefix commands and ctx.message

vagrant scarab
#

give me a sec

wind minnow
#

you're better off just doing pollEmbed.timestamp = datetime.datetime.now(datetime.timezone.utc)

#

assuming you're implementing this for a slash command or something

vagrant scarab
#
@bot.slash_command(description = "Создать опрос")
@commands.has_permissions( administrator = True) 
async def poll(inter, *, question = None):

    icon_url = inter.author.avatar.url

    pollEmbed = disnake.Embed( title = 'Опрос', description = f'{question}')

    pollEmbed.set_footer(text = f'Опрос был сгенерирован {inter.author}', icon_url = inter.author.avatar.url )

    pollEmbed.timestamp = datetime.datetime.now(datetime.timezone.utc)

    poll_msg = await inter.send(embed = pollEmbed)

    await poll_msg.add_reaction("✅")
    await poll_msg.add_reaction("❎")```
wind minnow
#

switch the top two lines so the @commands.has_permissions( administrator = True) is the top one

#
@commands.has_permissions( administrator = True) 
@bot.slash_command(description = "Создать опрос")
async def poll(inter, *, question = None):

    icon_url = inter.author.avatar.url

    pollEmbed = disnake.Embed( title = 'Опрос', description = f'{question}')

    pollEmbed.set_footer(text = f'Опрос был сгенерирован {inter.author}', icon_url = inter.author.avatar.url )

    pollEmbed.timestamp = datetime.datetime.now(datetime.timezone.utc)

    poll_msg = await inter.send(embed = pollEmbed)

    await poll_msg.add_reaction("✅")
    await poll_msg.add_reaction("❎")
vagrant scarab
#

Oh

#

Why?

lunar crest
#

inter.send does no return msg object

wind minnow
#

oh ye that too

deep inletBOT
#

await edit_original_response(content=..., *, embed=..., embeds=..., file=..., files=..., attachments=..., view=..., components=..., suppress_embeds=..., allowed_mentions=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the original, previously sent interaction response message.

This is a lower level interface to [`InteractionMessage.edit()`](https://docs.disnake.dev/page/api.html#disnake.InteractionMessage.edit "disnake.InteractionMessage.edit") in case you do not want to fetch the message and save an HTTP request.

This method is also the only way to edit the original response if the message sent was ephemeral.

Note

If the original response message has embeds with images that were created from local files (using the `file` parameter with [`Embed.set_image()`](https://docs.disnake.dev/page/api.html#disnake.Embed.set_image "disnake.Embed.set_image") or [`Embed.set_thumbnail()`](https://docs.disnake.dev/page/api.html#disnake.Embed.set_thumbnail "disnake.Embed.set_thumbnail")), those images will be removed if the message’s attachments are edited in any way (i.e. by setting `file`/`files`/`attachments`, or adding an embed with local files).

Changed in version 2.6: This function was renamed from `edit_original_message`.
cont.
wind minnow
# vagrant scarab Why?

not sure if it makes a difference but you didnt say what was wrong so i just thought maybe that lol

vagrant scarab
lunar crest
#

linked docs

vagrant scarab
#

Okay I'm reading

vagrant scarab