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

Class ForceReply

src/telegram/_forcereply.py:28–106  ·  view source on GitHub ↗

Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to s

Source from the content-addressed store, hash-verified

26
27
28class ForceReply(TelegramObject):
29 """
30 Upon receiving a message with this object, Telegram clients will display a reply interface to
31 the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be
32 extremely useful if you want to create user-friendly step-by-step interfaces without having
33 to sacrifice `privacy mode <https://core.telegram.org/bots/features#privacy-mode>`_. Not
34 supported in channels and for messages sent on behalf of a user account.
35
36 Objects of this class are comparable in terms of equality. Two objects of this class are
37 considered equal, if their :attr:`selective` is equal.
38
39 .. versionchanged:: 20.0
40 The (undocumented) argument ``force_reply`` was removed and instead :attr:`force_reply`
41 is now always set to :obj:`True` as expected by the Bot API.
42
43 Args:
44 selective (:obj:`bool`, optional): Use this parameter if you want to force reply from
45 specific users only. Targets:
46
47 1) Users that are @mentioned in the :attr:`~telegram.Message.text` of the
48 :class:`telegram.Message` object.
49 2) If the bot&#x27;s message is a reply to a message in the same chat and forum topic,
50 sender of the original message.
51
52 input_field_placeholder (:obj:`str`, optional): The placeholder to be shown in the input
53 field when the reply is active;
54 :tg-const:`telegram.ForceReply.MIN_INPUT_FIELD_PLACEHOLDER`-
55 :tg-const:`telegram.ForceReply.MAX_INPUT_FIELD_PLACEHOLDER`
56 characters.
57
58 .. versionadded:: 13.7
59
60 Attributes:
61 force_reply (:obj:`True`): Shows reply interface to the user, as if they manually selected
62 the bots message and tapped 'Reply'.
63 selective (:obj:`bool`): Optional. Force reply from specific users only. Targets:
64
65 1) Users that are @mentioned in the :attr:`~telegram.Message.text` of the
66 :class:`telegram.Message` object.
67 2) If the bot&#x27;s message is a reply to a message in the same chat and forum topic,
68 sender of the original message.
69 input_field_placeholder (:obj:`str`): Optional. The placeholder to be shown in the input
70 field when the reply is active;
71 :tg-const:`telegram.ForceReply.MIN_INPUT_FIELD_PLACEHOLDER`-
72 :tg-const:`telegram.ForceReply.MAX_INPUT_FIELD_PLACEHOLDER`
73 characters.
74
75 .. versionadded:: 13.7
76
77 """
78
79 __slots__ = ("force_reply", "input_field_placeholder", "selective")
80
81 def __init__(
82 self,
83 selective: bool | None = None,
84 input_field_placeholder: str | None = None,
85 *,

Callers 3

force_replyFunction · 0.90
test_equalityMethod · 0.90
startFunction · 0.90

Calls

no outgoing calls

Tested by 2

force_replyFunction · 0.72
test_equalityMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…