MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / _do_quote

Method _do_quote

src/telegram/_message.py:1916–1940  ·  view source on GitHub ↗

Modify kwargs for replying with or without quoting.

(
        self, do_quote: bool | None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE
    )

Source from the content-addressed store, hash-verified

1914 return self._effective_attachment # type: ignore[return-value]
1915
1916 def _do_quote(
1917 self, do_quote: bool | None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE
1918 ) -> ReplyParameters | None:
1919 """Modify kwargs for replying with or without quoting."""
1920 # `Defaults` handling for allow_sending_without_reply is not necessary, as
1921 # `ReplyParameters` have special defaults handling in (ExtBot)._insert_defaults
1922 if do_quote is not None:
1923 if do_quote:
1924 return ReplyParameters(
1925 self.message_id, allow_sending_without_reply=allow_sending_without_reply
1926 )
1927
1928 else:
1929 # Unfortunately we need some ExtBot logic here because it's hard to move shortcut
1930 # logic into ExtBot
1931 if hasattr(self.get_bot(), "defaults") and self.get_bot().defaults: # type: ignore
1932 default_quote = self.get_bot().defaults.do_quote # type: ignore[attr-defined]
1933 else:
1934 default_quote = None
1935 if (default_quote is None and self.chat.type != Chat.PRIVATE) or default_quote:
1936 return ReplyParameters(
1937 self.message_id, allow_sending_without_reply=allow_sending_without_reply
1938 )
1939
1940 return None
1941
1942 def compute_quote_position_and_entities(
1943 self, quote: str, index: int | None = None

Callers 1

Calls 2

ReplyParametersClass · 0.90
get_botMethod · 0.80

Tested by

no test coverage detected