[Python] Why does the message not have the properties it should have? Aiogram

Discussão em 'Python' iniciado por Stack, Março 17, 2025.

  1. Stack

    Stack Membro Participativo

    @dp.message(WriteAppeal.message)
    async def wrote(message: Message, state: FSMContext):
    await bot.forward_message(chat_id=CHANNEL_ID, from_chat_id=message.chat.id, message_id=message.message_id)
    await message.answer('Обращение благополучно отправлено!')


    @dp.message(Command('answer'))
    async def answering(message: Message):
    try:
    msg = message.reply_to_message
    except AttributeError: return

    print(msg.forward_from_chat)
    print(msg.message_thread_id, msg.sender_chat)

    await bot.send_message(msg.chat.id, f'Ответ на ваше обращение: \n {message.text}', reply_to_message_id=msg.message_id)


    A message that is forwarded to another chat does not have the properties of the forwarded message.

    Print data returns None everywhere.

    How can I get the message id and the chat id from which the message was forwarded?

    I tried to take all these id from forward_origin, but it only gave me MessageOriginUser, which doesn't contain anything I need. And I tried to try the method that is written in print

    Continue reading...

Compartilhe esta Página