Skip to content

'InputPaidMedia' object has no attribute 'parse_mode' #4753

@ngrogolev

Description

@ngrogolev

Steps to Reproduce

  1. Initialize the application with default settings, including a parse_mode key
  2. Attempt to call send_paid_media with the Sequence of InputPaidMedia in media parameter

Expected behaviour

The send_paid_media method should successfully send the specified paid media to the target chat using the default parse_mode

Actual behaviour

Sending the media fails with an exception::
AttributeError: 'InputPaidMedia' object has no attribute 'parse_mode'

Operating System

Linux

Version of Python, python-telegram-bot & dependencies

python-telegram-bot 22.0
Bot API 8.3
Python 3.12.6 (tags/v3.12.6:a4a2d2b, Sep  6 2024, 20:11:23) [MSC v.1940 64 bit (AMD64)]

Relevant log output

Traceback (most recent call last):
  File "/path/to/the/project/.venv/lib/site-packages/telegram/ext/_application.py", line 1298, in process_update
    await coroutine
  File "/path/to/the/project/.venv/lib/site-packages/telegram/ext/_handlers/conversationhandler.py", line 842, in handle_update
    new_state: object = await handler.handle_update(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/the/project/.venv/lib/site-packages/telegram/ext/_handlers/basehandler.py", line 158, in handle_update
    return await self.callback(update, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/the/project/bot/handlers/producer/producer_media_handler.py", line 110, in set_price_handler
    paid_media_message = await context.bot.send_paid_media(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/the/project/.venv/lib/site-packages/telegram/ext/_extbot.py", line 4385, in send_paid_media
    return await super().send_paid_media(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/the/project/.venv/lib/site-packages/telegram/_bot.py", line 9675, in send_paid_media
    return await self._send_message(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/the/project/.venv/lib/site-packages/telegram/ext/_extbot.py", line 618, in _send_message
    result = await super()._send_message(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/the/project/.venv/lib/site-packages/telegram/_bot.py", line 803, in _send_message
    result = await self._post(
             ^^^^^^^^^^^^^^^^^
  File "/path/to/the/project/.venv/lib/site-packages/telegram/_bot.py", line 686, in _post
    self._insert_defaults(data)
  File "/path/to/the/project/.venv/lib/site-packages/telegram/ext/_extbot.py", line 473, in _insert_defaults
    if media.parse_mode is DEFAULT_NONE:
       ^^^^^^^^^^^^^^^^
AttributeError: 'InputPaidMedia' object has no attribute 'parse_mode'

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ⚙️ bot-apiaffected functionality: bot-api

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions