Skip to content

Conversation

@Dairus01
Copy link

Description

This PR adds support for a default show_caption_above_media in the Defaults class. This allows users to set a global default for the show_caption_above_media parameter across all bot methods that support it (e.g., send_video, send_photo, edit_message_caption), promoting consistency without needing to specify it on every call.

Changes include:

  • Added show_caption_above_media parameter to Defaults.__init__.
  • Added the corresponding property and slot.
  • Updated _api_defaults to include it.
  • Added unit tests in test_defaults.py for the new property and its inclusion in api_defaults.
  • Updated equality and hash methods to account for the new attribute.
  • Added .. versionadded:: NEXT.VERSION to the docstring.

This addresses the feature request in issue #4306, following the pattern of other default parameters.

Check-list for PRs

  • Added .. versionadded:: NEXT.VERSION to the docstrings for user facing changes
  • Created new or adapted existing unit tests
  • Documented code changes according to the CSI standard
    Reason: Pending - I need to review the CSI standard and add detailed internal documentation comments to the code. Will complete after initial review.
  • Added myself alphabetically to AUTHORS.rst (optional)
    Reason: Optional and not done yet - I'll add my name if the PR is accepted.
  • Added new classes & modules to the docs and all suitable __all__s
    Reason: Not applicable - No new classes or modules were added; only modified existing ones.
  • Checked the Stability Policy in case of deprecations or changes to documented behavior
    Reason: Pending - No deprecations or breaking changes, but I'll confirm against the policy.

If the PR contains API changes (otherwise, you can ignore this passage)
Not applicable - This PR only adds internal defaults support, not API changes.

  • Checked the Bot API specific sections of the Stability Policy

  • Created a PR to remove functionality deprecated in the previous Bot API release (see here)

  • New Classes
    Not applicable - No new classes.

    • Added self._id_attrs and corresponding documentation
    • __init__ accepts api_kwargs as keyword-only
  • Added New Shortcuts
    Not applicable - No new shortcuts.

    • In telegram.Chat & telegram.User for all methods that accept chat_id and message_id
    • In telegram.Message for all methods that accept chat_id and message_id
    • For new telegram.Message shortcuts: Added quote argument if methods accept reply_to_message_id
    • In telegram.CallbackQuery for all methods that accept either chat_id and message_id or inline_message_id
  • If Relevant
    Not fully applicable - No constants, handlers, or major docs updates needed.

    • Added new constants at telegram.constants and shortcuts to them as class variables
    • Linked new and existing constants in docstrings instead of hard-coded numbers and strings
    • Added new message types to telegram.Message.effective_attachment
    • Added new handlers for new update types
    • Added new filters for new message (sub)types
    • Added or updated documentation for the changed class(es) and/or method(s)
      Reason: Pending - Need to update class docs if required.
    • Added the new method(s) to _extbot.py
    • Added or updated bot_methods.rst
    • Updated the Bot API version number in all places: README.rst (including the badge) and telegram.constants.BOT_API_VERSION_INFO
    • Added logic for arbitrary callback data in telegram.ext.ExtBot for new methods that either accept a reply_markup in some form or have a return type that is/contains telegram.Message

Closes #4306

Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=201190161

@Dairus01
Copy link
Author

Dairus01 commented Jan 14, 2026

@Bibo-Joshi Please can you review this PR

Btw I have fixed all the ruff formatting issues

@Bibo-Joshi
Copy link
Member

Hi. The changes in this PR have nothing to do with the PRs description. Moreover there is no such thing as "gift_premium_subscription_text_parse_mode" in the bot API.

@Bibo-Joshi Bibo-Joshi closed this Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add show_caption_above_media parameter to Defaults

2 participants