#AttributeError: 'ApplicationCommandInteraction' object has no attribute 'message'
1 messages · Page 1 of 1 (latest)
should be inter.message.created_at
underscore not .
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
give me a sec
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
Now look at
@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("❎")```
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("❎")
inter.send does no return msg object
oh ye that too
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.
not sure if it makes a difference but you didnt say what was wrong so i just thought maybe that lol
how i can fix it
linked docs
Okay I'm reading
AttributeError: type object 'datetime.datetime' has no attribute 'datetime'