@Azapro0

Как узнать id сообщения которое отправил бот в nextcord?

У меня было так:

@bot.command()
def thisid(ctx):
    msg = await ctx.send(".")
    await msg.edit(msg.id)


А сейчас я решил сделать slash_command.
Так выдаёт ошибку:

@bot.slash_command(name="thisid", description="...")
def thisid(ctx):
    msg = await ctx.response.send_message(".")
    await msg.edit(msg.id)


Ошибка

Ignoring exception in command <nextcord.application_command.SlashApplicationCommand object at 0x7fb6599f1090>:
Traceback (most recent call last):
  File "/home/runner/MajesticRP-API/venv/lib/python3.10/site-packages/nextcord/application_command.py", line 890, in invoke_callback_with_hooks
    await self(interaction, *args, **kwargs)
  File "main.py", line 64, in addTovar
    embed.add_field(name="ID", value=f"`{msg.id}`", inline=False)
AttributeError: 'PartialInteractionMessage' object has no attribute 'id'

The above exception was the direct cause of the following exception:

nextcord.errors.ApplicationInvokeError: Command raised an exception: AttributeError: 'PartialInteractionMessage' object has no attribute 'id'

  • Вопрос задан
  • 52 просмотра
Решения вопроса 1
RimMirK
@RimMirK
Вроде человек. Вроде учусь. Вроде пайтону
точно так же, как и в предыдущий раз
выведи весь объект message, и, покопавшись, найди то, что надо.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы