2015-07-09 03:33:13 +02:00
|
|
|
#!/usr/bin/env python
|
2015-08-11 21:58:17 +02:00
|
|
|
#
|
|
|
|
# A library that provides a Python interface to the Telegram Bot API
|
2023-01-01 21:31:29 +01:00
|
|
|
# Copyright (C) 2015-2023
|
2016-01-05 14:12:03 +01:00
|
|
|
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
2015-08-11 21:58:17 +02:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Lesser Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Lesser Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser Public License
|
|
|
|
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
2016-12-11 22:44:52 +01:00
|
|
|
"""This module contains an object that represents a Telegram ReplyKeyboardRemove."""
|
2023-02-02 18:55:07 +01:00
|
|
|
from typing import Optional
|
2015-07-09 03:33:13 +02:00
|
|
|
|
2022-05-05 09:27:54 +02:00
|
|
|
from telegram._telegramobject import TelegramObject
|
2022-10-07 11:51:53 +02:00
|
|
|
from telegram._utils.types import JSONDict
|
2020-10-31 16:33:34 +01:00
|
|
|
|
2015-07-09 03:33:13 +02:00
|
|
|
|
2022-01-19 18:00:21 +01:00
|
|
|
class ReplyKeyboardRemove(TelegramObject):
|
2017-07-23 22:33:08 +02:00
|
|
|
"""
|
|
|
|
Upon receiving a message with this object, Telegram clients will remove the current custom
|
|
|
|
keyboard and display the default letter-keyboard. By default, custom keyboards are displayed
|
|
|
|
until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are
|
|
|
|
hidden immediately after the user presses a button (see :class:`telegram.ReplyKeyboardMarkup`).
|
2015-08-28 17:19:30 +02:00
|
|
|
|
2020-12-30 15:59:50 +01:00
|
|
|
Note:
|
|
|
|
User will not be able to summon this keyboard; if you want to hide the keyboard from
|
|
|
|
sight but keep it accessible, use :attr:`telegram.ReplyKeyboardMarkup.one_time_keyboard`.
|
|
|
|
|
Documentation Improvements (#3214, #3217, #3218, #3271, #3289, #3292, #3303, #3312, #3306, #3319, #3326, #3314)
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
Co-authored-by: Simon Fong <44134941+simonfongnt@users.noreply.github.com>
Co-authored-by: Piotr Rogulski <rivinek@gmail.com>
Co-authored-by: poolitzer <25934244+Poolitzer@users.noreply.github.com>
Co-authored-by: Or Bin <or@raftt.io>
Co-authored-by: Sandro <j32g7f67hb@liamekaens.com>
Co-authored-by: Hatim Zahid <63000127+HatimZ@users.noreply.github.com>
Co-authored-by: Robi <53259730+RobiMez@users.noreply.github.com>
Co-authored-by: Dmitry Kolomatskiy <58207913+lemontree210@users.noreply.github.com>
2022-11-15 09:06:23 +01:00
|
|
|
Examples:
|
|
|
|
* Example usage: A user votes in a poll, bot returns confirmation message in reply to
|
|
|
|
the vote and removes the keyboard for that user, while still showing the keyboard with
|
|
|
|
poll options to users who haven't voted yet.
|
|
|
|
* :any:`Conversation Bot <examples.conversationbot>`
|
|
|
|
* :any:`Conversation Bot 2 <examples.conversationbot2>`
|
|
|
|
|
2017-07-23 22:33:08 +02:00
|
|
|
Args:
|
|
|
|
selective (:obj:`bool`, optional): Use this parameter if you want to remove the keyboard
|
|
|
|
for specific users only. Targets:
|
2017-06-07 13:07:45 +02:00
|
|
|
|
Documentation Improvements (#2008)
* Minor doc updates, following official API docs
* Fix spelling in Defaults docstrings
* Clarify Changelog of v12.7 about aware dates
* Fix typo in CHANGES.rst (#2024)
* Fix PicklePersistence.flush() with only bot_data (#2017)
* Update pylint in pre-commit to fix CI (#2018)
* Add Filters.via_bot (#2009)
* feat: via_bot filter
also fixing a small mistake in the empty parameter of the user filter and improve docs slightly
* fix: forgot to set via_bot to None
* fix: redoing subclassing to copy paste solution
* Cosmetic changes
Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
* Update CHANGES.rst
Fixed Typo
Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>
Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
* Update downloads badge, add info on IRC Channel to Getting Help section
* Remove RegexHandler from ConversationHandlers Docs (#1973)
Replaced RegexHandler with MessageHandler, since the former is deprecated
* Fix Filters.via_bot docstrings
* Add notes on Markdown v1 being legacy mode
* Fixed typo in the Regex doc.. (#2036)
* Typo: Spelling
* Minor cleanup from #2043
* Document CommandHandler ignoring channel posts
* Doc fixes for a few telegram.ext classes
* Doc fixes for most `telegram` classes.
* pep-8
forgot the hard wrap is at 99 chars, not 100!
fixed a few spelling mistakes too.
* Address review and made rendering of booleans consistent
True, False, None are now rendered with ``bool`` wherever they weren't in telegram and telegram.ext classes.
* Few doc fixes for inline* classes
As usual, docs were cross-checked with official tg api docs.
* Doc fixes for telegram/files classes
As usual, docs were cross-checked with official tg api docs.
* Doc fixes for telegram.Game
Mostly just added hyperlinks. And fixed message length doc.
As usual, docs were cross-checked with official tg api docs.
* Very minor doc fix for passportfile.py and passportelementerrors.py
Didn't bother changing too much since this seems to be a custom implementation.
* Doc fixes for telegram.payments
As usual, cross-checked with official bot api docs.
* Address review 2
Few tiny other fixes too.
* Changed from ``True/False/None`` to :obj:`True/False/None` project-wide.
Few tiny other doc fixes too.
Co-authored-by: Robert Geislinger <mitachundkrach@gmail.com>
Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
Co-authored-by: GauthamramRavichandran <30320759+GauthamramRavichandran@users.noreply.github.com>
Co-authored-by: Mahesh19 <maheshvagicherla99438@gmail.com>
Co-authored-by: hoppingturtles <ilovebhagwan@gmail.com>
2020-08-24 19:35:57 +02:00
|
|
|
1) Users that are @mentioned in the text of the :class:`telegram.Message` object.
|
2024-02-08 17:12:00 +01:00
|
|
|
2) If the bot's message is a reply to a message in the same chat and forum topic,
|
|
|
|
sender of the original message.
|
2015-08-28 17:19:30 +02:00
|
|
|
|
2020-12-30 15:59:50 +01:00
|
|
|
Attributes:
|
|
|
|
remove_keyboard (:obj:`True`): Requests clients to remove the custom keyboard.
|
2023-01-01 16:24:00 +01:00
|
|
|
selective (:obj:`bool`): Optional. Remove the keyboard for specific users only.
|
|
|
|
Targets:
|
|
|
|
|
|
|
|
1) Users that are @mentioned in the text of the :class:`telegram.Message` object.
|
2024-02-08 17:12:00 +01:00
|
|
|
2) If the bot's message is a reply to a message in the same chat and forum topic,
|
|
|
|
sender of the original message.
|
Documentation Improvements (#2008)
* Minor doc updates, following official API docs
* Fix spelling in Defaults docstrings
* Clarify Changelog of v12.7 about aware dates
* Fix typo in CHANGES.rst (#2024)
* Fix PicklePersistence.flush() with only bot_data (#2017)
* Update pylint in pre-commit to fix CI (#2018)
* Add Filters.via_bot (#2009)
* feat: via_bot filter
also fixing a small mistake in the empty parameter of the user filter and improve docs slightly
* fix: forgot to set via_bot to None
* fix: redoing subclassing to copy paste solution
* Cosmetic changes
Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
* Update CHANGES.rst
Fixed Typo
Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>
Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
* Update downloads badge, add info on IRC Channel to Getting Help section
* Remove RegexHandler from ConversationHandlers Docs (#1973)
Replaced RegexHandler with MessageHandler, since the former is deprecated
* Fix Filters.via_bot docstrings
* Add notes on Markdown v1 being legacy mode
* Fixed typo in the Regex doc.. (#2036)
* Typo: Spelling
* Minor cleanup from #2043
* Document CommandHandler ignoring channel posts
* Doc fixes for a few telegram.ext classes
* Doc fixes for most `telegram` classes.
* pep-8
forgot the hard wrap is at 99 chars, not 100!
fixed a few spelling mistakes too.
* Address review and made rendering of booleans consistent
True, False, None are now rendered with ``bool`` wherever they weren't in telegram and telegram.ext classes.
* Few doc fixes for inline* classes
As usual, docs were cross-checked with official tg api docs.
* Doc fixes for telegram/files classes
As usual, docs were cross-checked with official tg api docs.
* Doc fixes for telegram.Game
Mostly just added hyperlinks. And fixed message length doc.
As usual, docs were cross-checked with official tg api docs.
* Very minor doc fix for passportfile.py and passportelementerrors.py
Didn't bother changing too much since this seems to be a custom implementation.
* Doc fixes for telegram.payments
As usual, cross-checked with official bot api docs.
* Address review 2
Few tiny other fixes too.
* Changed from ``True/False/None`` to :obj:`True/False/None` project-wide.
Few tiny other doc fixes too.
Co-authored-by: Robert Geislinger <mitachundkrach@gmail.com>
Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
Co-authored-by: GauthamramRavichandran <30320759+GauthamramRavichandran@users.noreply.github.com>
Co-authored-by: Mahesh19 <maheshvagicherla99438@gmail.com>
Co-authored-by: hoppingturtles <ilovebhagwan@gmail.com>
2020-08-24 19:35:57 +02:00
|
|
|
|
2015-08-28 17:19:30 +02:00
|
|
|
"""
|
|
|
|
|
2024-02-05 19:24:00 +01:00
|
|
|
__slots__ = ("remove_keyboard", "selective")
|
2021-05-29 16:18:16 +02:00
|
|
|
|
2023-05-18 07:57:59 +02:00
|
|
|
def __init__(self, selective: Optional[bool] = None, *, api_kwargs: Optional[JSONDict] = None):
|
2022-10-07 11:51:53 +02:00
|
|
|
super().__init__(api_kwargs=api_kwargs)
|
2015-08-28 17:19:30 +02:00
|
|
|
# Required
|
2023-02-02 18:55:07 +01:00
|
|
|
self.remove_keyboard: bool = True
|
2015-08-28 17:19:30 +02:00
|
|
|
# Optionals
|
2023-02-02 18:55:07 +01:00
|
|
|
self.selective: Optional[bool] = selective
|
2022-12-15 15:00:36 +01:00
|
|
|
|
|
|
|
self._freeze()
|