Compare commits

..
54 Commits
Author SHA1 Message Date
Davte 6b489363de Compliance with bot API 7.2
- Included python version in `/version` command
- Added the parameter `business_connection_id` to the methods sendMessage, sendPhoto, sendVideo, sendAnimation, sendAudio, sendDocument, sendSticker, sendVideoNote, sendVoice, sendLocation, sendVenue, sendContact, sendPoll, sendDice, sendGame, and sendMediaGroup, sendChatAction.
- Moved the parameter `format` to Sticker instead of StickerSet (and related methods)
2024-04-13 11:15:42 +02:00
Davte a343e095e8 Compliance with bot API 7.1
- Added the class ReplyParameters and replaced parameters reply_to_message_id and allow_sending_without_reply in the methods copyMessage, sendMessage, sendPhoto, sendVideo, sendAnimation, sendAudio, sendDocument, sendSticker, sendVideoNote, sendVoice, sendLocation, sendVenue, sendContact, sendPoll, sendDice, sendInvoice, sendGame, and sendMediaGroup with the field reply_parameters of type ReplyParameters.
- Added the class LinkPreviewOptions and replaced the parameter disable_web_page_preview with link_preview_options in the methods sendMessage and editMessageText.
2024-03-10 20:22:05 +01:00
Davte a3b28bc1d6 Allow to overwrite file when using bot.download_file method 2024-03-05 18:50:03 +01:00
Davte 3969794075 download_file behaves differently if a local bot API server is used. Wrong default API url was being used 2024-02-17 15:44:04 +01:00
Davte 748ba624a4 Support Local Bot API Server (with custom api_url). 2024-02-17 14:47:09 +01:00
Davte 41507067be download_file method updated to handle exceptions and return information about downloaded file 2024-02-14 19:30:35 +01:00
Davte ec747bef1d Specify encoding in send_part_of_text_file function 2023-12-17 10:22:12 +01:00
Davte 199fe29cf1 Compliance with bot API 6.8 and 6.9
Added the method `unpinAllGeneralForumTopicMessages` (6.8).

Added the new administrator privileges `can_post_stories`, `can_edit_stories` and `can_delete_stories` to the class `ChatAdministratorRights` and to the method `promoteChatMember` (6.9).
2023-11-12 11:56:16 +01:00
Davte 41f38d0b23 Method to add table columns if missing 2023-08-23 18:23:17 +02:00
Davte cf492f0c8b Allow non-null standard output and/or error pipe to be passed to aio_subprocess_shell function 2023-08-23 17:17:26 +02:00
Davte eab81b065d When answering inline queries, prevent invalid InlineQueryResultsButton instantiation 2023-08-07 20:19:09 +02:00
Davte 51a77c695b Better variable regex: accept only one decimal separator in float numbers 2023-07-25 18:58:31 +02:00
Davte febe5cee3f Config command implemented, allowing administrators to add variables to configuration files 2023-07-25 16:41:22 +02:00
Davte fb04211e81 Whitespace and type mismatch 2023-04-29 20:56:32 +02:00
Davte 3bd1a9b679 Compliance with Telegram Bot API 6.6 and new command line interface to run bot or send a single message 2023-04-29 20:38:33 +02:00
Davte 0c3ed2070d Compliance with Telegram Bot API 6.5 2023-02-03 21:38:20 +01:00
Davte 5c30dafd4c Compliance with Telegram Bot API 6.4 2023-01-06 10:29:44 +01:00
davte 27f9d62cf9 Make the regex dot match any character at all, including a newline, when cleaning HTML strings (so multiline tag bodies are allowed, as they are in Telegram HTML markdown). 2022-12-26 14:05:33 +01:00
Davte fafa639328 HTML parse_mode check upgraded.
All supported tags permitted, malformed tags replaced with escaped characters
2022-12-12 22:43:44 +01:00
Davte 55b47ed1f7 Method to add a table and its columns to and ObjectWithDatabase 2022-12-10 18:46:20 +01:00
Davte 881d249256 Compliance with Telegram Bot API 6.3 2022-12-08 16:18:22 +01:00
Davte fc486c60ce When admin A requests profile picture of user B, send B's picture and not A's. 2022-12-06 22:18:51 +01:00
Davte e813d37c8f Browse users via /auth command 2022-12-05 22:10:30 +01:00
Davte 21f91fb07c Syntax-breaking typo 2022-10-12 14:12:39 +02:00
Davte 50c2f92e8e asyncio get_event_loop method is being deprecated; use new_event_loop / get_running_loop and asyncio.run instead
Major version change because it may not be backward-compatible
2022-10-12 14:08:46 +02:00
Davte d77c416ea6 send_document method should not require a chat_id since it can be passed an update object 2020-12-20 20:30:59 +01:00
Davte e487764aad send_photo method should not require a chat_id since it can be passed an update object 2020-12-11 08:22:16 +01:00
Davte 4bf00f0cc5 Avoid relative import statements 2020-11-19 15:18:44 +01:00
Davte ed7e335d4e Items in __all__ must be str, not module 2020-11-19 14:37:25 +01:00
Davte d6a4a1d69a Document can be None if document_path is provided 2020-11-19 12:32:58 +01:00
Davte 668822fc21 Do not log chardet INFO and DEBUG levels 2020-11-16 23:05:18 +01:00
Davte 135442dcd6 Compliance with Telegram Bot API 5.0 and improved type hinting for API methods. 2020-11-16 22:56:12 +01:00
Davte eb11160a02 Version number 2020-11-15 21:35:38 +01:00
Davte fda4cac348 Import statements refactored 2020-11-15 21:34:18 +01:00
Davte 773fe1fdb1 web should not be imported from aiohttp; use aiohttp.web instead 2020-11-15 20:55:43 +01:00
Davte ddf25f8dd1 Store user profile pictures in bot database and show them in authorization panel 2020-10-07 16:32:51 +02:00
Davte 17b26ec23e MySQL compatibility: specify VARCHAR length
`db.types.string` becomes now `db.types.string(n)`
`db.types.text` is the wrong type to use (text blobs)
2020-10-07 16:32:50 +02:00
Davte 68974c4c40 Pass all information to command handler when using /start 2020-09-26 19:28:18 +02:00
Davte 92e39e7ed7 Make general_handler handle photo updates 2020-09-05 10:36:00 +02:00
Davte 48b7e1e4a2 Updated examples 2020-08-23 14:21:45 +02:00
Davte b797f3fffe Remove argument parameter from parser decorator 2020-08-23 14:08:06 +02:00
Davte 3e19ba4c81 In text message handler, make available both lowered and original text and inspect condition parameters 2020-08-23 14:03:52 +02:00
Davte e29bb08b7b Accept language directly 2020-08-20 15:51:00 +02:00
Davte 7233f9e478 General handler implemented and applied to contact updates 2020-08-17 23:51:50 +02:00
Davte e481623a75 Document handlers implemented 2020-08-16 15:18:02 +02:00
Davte 88835955ef Update default help messages with given ones, instead of replacing them 2020-07-17 09:48:39 +02:00
Davte 8c37d00602 In default keyboard, show only buttons for commands the user is authorized to call 2020-07-16 10:06:32 +02:00
Davte ada375b766 Prevent decoding None objects 2020-07-15 13:15:48 +02:00
Davte ed05d843bc Async function to run shell commands 2020-07-15 13:11:45 +02:00
Davte bc51ed109a Split outgoing documents bigger than 50 MB and send chunks 2020-06-22 22:56:21 +02:00
Davte 76204ccd69 Script to merge split files 2020-06-22 22:56:16 +02:00
Davte 293a831958 Typos 2020-06-20 15:43:22 +02:00
Davte fafc3de090 Send error message if database could not be sent - new version 2020-06-20 15:35:24 +02:00
Davte 5fe875e49c Send error message if database could not be sent 2020-06-20 15:32:37 +02:00
4 changed files with 7 additions and 227 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ __author__ = "Davide Testa"
__email__ = "davide@davte.it" __email__ = "davide@davte.it"
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
__license__ = "GNU General Public License v3.0" __license__ = "GNU General Public License v3.0"
__version__ = "2.10.6" __version__ = "2.10.2"
__maintainer__ = "Davide Testa" __maintainer__ = "Davide Testa"
__contact__ = "t.me/davte" __contact__ = "t.me/davte"
+5 -65
View File
@@ -18,7 +18,6 @@ import re
import types import types
from collections import OrderedDict from collections import OrderedDict
from importlib.metadata import version as get_package_version_from_metadata
from typing import Union, List, Tuple from typing import Union, List, Tuple
# Third party modules # Third party modules
@@ -29,8 +28,8 @@ from davtelepot.messages import default_admin_messages, default_talk_messages
from davtelepot.bot import Bot from davtelepot.bot import Bot
from davtelepot.utilities import ( from davtelepot.utilities import (
async_wrapper, CachedPage, Confirmator, extract, get_cleaned_text, async_wrapper, CachedPage, Confirmator, extract, get_cleaned_text,
get_secure_key, get_user, clean_html_string, line_drawing_unordered_list, get_user, clean_html_string, line_drawing_unordered_list, make_button,
make_button, make_inline_keyboard, remove_html_tags, send_part_of_text_file, make_inline_keyboard, remove_html_tags, send_part_of_text_file,
send_csv_file, make_lines_of_buttons, join_path send_csv_file, make_lines_of_buttons, join_path
) )
@@ -45,13 +44,6 @@ variable_regex = re.compile(r"(?P<name>[a-zA-Z]\w*)\s*=\s*"
r"\"[^\"]*\")") r"\"[^\"]*\")")
def get_package_version(package: types.ModuleType):
"""Get version of given package."""
if hasattr(package, '__version__'):
return package.__version__
return get_package_version_from_metadata(package.__name__)
async def _forward_to(update, async def _forward_to(update,
bot: Bot, bot: Bot,
sender, sender,
@@ -873,12 +865,7 @@ async def get_new_versions(bot: Bot,
"skipping...") "skipping...")
continue continue
new_version = web_page['info']['version'] new_version = web_page['info']['version']
try: current_version = package.__version__
current_version = get_package_version(package)
except TypeError:
current_version = "NA"
logging.error("Could not get current version of "
"package %s", package.__name__)
notification_record = bot.db['updates_notifications'].find_one( notification_record = bot.db['updates_notifications'].find_one(
package=package.__name__, package=package.__name__,
order_by=['-id'], order_by=['-id'],
@@ -908,7 +895,7 @@ async def version_command(bot: Bot, update: dict,
text += f'<b>Python: </b> <code>{platform.python_version()}</code>\n' text += f'<b>Python: </b> <code>{platform.python_version()}</code>\n'
text += '\n'.join( text += '\n'.join(
f"<b>{package.__name__}</b>: " f"<b>{package.__name__}</b>: "
f"<code>{get_package_version(package)}</code>" f"<code>{package.__version__}</code>"
for package in bot.packages for package in bot.packages
) )
temporary_message = await bot.send_message( temporary_message = await bot.send_message(
@@ -952,7 +939,7 @@ async def notify_new_version(bot: Bot):
order_by=['-id'] order_by=['-id']
) )
current_versions = { current_versions = {
f"{package.__name__}_version": get_package_version(package) f"{package.__name__}_version": package.__version__
for package in bot.packages for package in bot.packages
} }
current_versions['last_commit'] = last_commit current_versions['last_commit'] = last_commit
@@ -1859,50 +1846,6 @@ async def config_command(bot: Bot, update: dict,
language=language) language=language)
async def become_administrator(bot: Bot, update: dict,
user_record: dict, language: str):
"""When the bot has no administrator, become one providing a token.
The token will be printed to the stdout on the machine running the bot.
"""
if len(bot.administrators) > 0:
return
def _get_message(*args):
return bot.get_message('admin', 'become_admin', *args,
update=update, user_record=user_record,
language=language)
token = get_cleaned_text(update=update, bot=bot,
replace=['become_administrator',
'00become_administrator'],
strip='/ @_')
if token != bot.administration_token:
return _get_message('wrong_token')
with bot.db as db:
db['users'].update({**user_record, 'privileges': 1},
['id'])
return _get_message('success')
async def create_promotion_command(bot: Bot):
"""If bot has no administrators, users can elevate themselves.
To do so, they need to provide a token, that will be printed to the stdout
of the machine running the bot.
"""
await bot.get_me()
bot.administration_token = get_secure_key(length=10)
print(f"To become administrator click "
f"https://t.me/{bot.name}?start="
f"00become_administrator_{bot.administration_token}")
@bot.command(command='become_administrator',
authorization_level='everybody',
aliases=['00become_administrator'])
async def _become_administrator(bot, update, user_record, language):
return await become_administrator(bot=bot, update=update,
user_record=user_record,
language=language)
def init(telegram_bot: Bot, def init(telegram_bot: Bot,
talk_messages: dict = None, talk_messages: dict = None,
admin_messages: dict = None, admin_messages: dict = None,
@@ -2132,6 +2075,3 @@ def init(telegram_bot: Bot,
update=update, update=update,
user_record=user_record, user_record=user_record,
language=language) language=language)
if len(telegram_bot.administrators) == 0:
asyncio.ensure_future(create_promotion_command(bot=telegram_bot))
+1 -151
View File
@@ -425,38 +425,6 @@ class ReactionType(DictToDump):
) )
class InputPaidMedia(DictToDump):
def __init__(self,
type_: str,
media: str):
assert type_ in ('photo', 'video'), f"Invalid paid media type `{type_}`"
super().__init__()
self['type'] = type_
self['media'] = media
class InputPaidMediaPhoto(InputPaidMedia):
def __init__(self,
media: str):
super().__init__('photo', media)
class InputPaidMediaVideo(InputPaidMedia):
def __init__(self,
media: str,
thumbnail: str = None,
width: int = None,
height: int = None,
duration: int = None,
supports_streaming: bool = None):
super().__init__('video', media)
self['thumbnail'] = thumbnail
self['width'] = width
self['height'] = height
self['duration'] = duration
self['supports_streaming'] = supports_streaming
def handle_deprecated_disable_web_page_preview(parameters: dict, def handle_deprecated_disable_web_page_preview(parameters: dict,
kwargs: dict): kwargs: dict):
if 'disable_web_page_preview' in kwargs: if 'disable_web_page_preview' in kwargs:
@@ -914,7 +882,6 @@ class TelegramBot:
link_preview_options: LinkPreviewOptions = None, link_preview_options: LinkPreviewOptions = None,
disable_notification: bool = None, disable_notification: bool = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -955,12 +922,10 @@ class TelegramBot:
caption: str = None, caption: str = None,
parse_mode: str = None, parse_mode: str = None,
caption_entities: List[dict] = None, caption_entities: List[dict] = None,
show_caption_above_media: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
disable_notification: bool = None, disable_notification: bool = None,
has_spoiler: bool = None, has_spoiler: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -989,7 +954,6 @@ class TelegramBot:
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -1021,7 +985,6 @@ class TelegramBot:
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -1052,12 +1015,10 @@ class TelegramBot:
caption: str = None, caption: str = None,
parse_mode: str = None, parse_mode: str = None,
caption_entities: List[dict] = None, caption_entities: List[dict] = None,
show_caption_above_media: bool = None,
supports_streaming: bool = None, supports_streaming: bool = None,
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: str = None,
has_spoiler: bool = None, has_spoiler: bool = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
@@ -1089,11 +1050,9 @@ class TelegramBot:
caption: str = None, caption: str = None,
parse_mode: str = None, parse_mode: str = None,
caption_entities: List[dict] = None, caption_entities: List[dict] = None,
show_caption_above_media: bool = None,
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: str = None,
has_spoiler: bool = None, has_spoiler: bool = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
@@ -1125,7 +1084,6 @@ class TelegramBot:
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -1151,7 +1109,6 @@ class TelegramBot:
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -1178,7 +1135,6 @@ class TelegramBot:
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
**kwargs): **kwargs):
"""Send a group of photos or videos as an album. """Send a group of photos or videos as an album.
@@ -1206,7 +1162,6 @@ class TelegramBot:
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -1232,9 +1187,7 @@ class TelegramBot:
) )
async def editMessageLiveLocation(self, latitude: float, longitude: float, async def editMessageLiveLocation(self, latitude: float, longitude: float,
live_period: int = None,
chat_id: Union[int, str] = None, chat_id: Union[int, str] = None,
business_connection_id: str = None,
message_id: int = None, message_id: int = None,
inline_message_id: str = None, inline_message_id: str = None,
horizontal_accuracy: float = None, horizontal_accuracy: float = None,
@@ -1265,7 +1218,6 @@ class TelegramBot:
async def stopMessageLiveLocation(self, async def stopMessageLiveLocation(self,
chat_id: Union[int, str] = None, chat_id: Union[int, str] = None,
business_connection_id: str = None,
message_id: int = None, message_id: int = None,
inline_message_id: int = None, inline_message_id: int = None,
reply_markup=None): reply_markup=None):
@@ -1293,7 +1245,6 @@ class TelegramBot:
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -1320,7 +1271,6 @@ class TelegramBot:
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -1341,8 +1291,6 @@ class TelegramBot:
chat_id: Union[int, str], chat_id: Union[int, str],
question: str, question: str,
options: List[str], options: List[str],
question_parse_mode: str = None,
question_entities: list = None,
business_connection_id: str = None, business_connection_id: str = None,
is_anonymous: bool = True, is_anonymous: bool = True,
type_: str = 'regular', type_: str = 'regular',
@@ -1357,7 +1305,6 @@ class TelegramBot:
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -1593,7 +1540,6 @@ class TelegramBot:
) )
async def pinChatMessage(self, chat_id: Union[int, str], message_id, async def pinChatMessage(self, chat_id: Union[int, str], message_id,
business_connection_id: str = None,
disable_notification: bool = None): disable_notification: bool = None):
"""Pin a message in a group, a supergroup, or a channel. """Pin a message in a group, a supergroup, or a channel.
@@ -1609,7 +1555,6 @@ class TelegramBot:
) )
async def unpinChatMessage(self, chat_id: Union[int, str], async def unpinChatMessage(self, chat_id: Union[int, str],
business_connection_id: str = None,
message_id: int = None): message_id: int = None):
"""Unpin a message in a group, a supergroup, or a channel. """Unpin a message in a group, a supergroup, or a channel.
@@ -1734,7 +1679,6 @@ class TelegramBot:
async def editMessageText(self, text: str, async def editMessageText(self, text: str,
chat_id: Union[int, str] = None, chat_id: Union[int, str] = None,
business_connection_id: str = None,
message_id: int = None, message_id: int = None,
inline_message_id: str = None, inline_message_id: str = None,
parse_mode: str = None, parse_mode: str = None,
@@ -1759,13 +1703,11 @@ class TelegramBot:
async def editMessageCaption(self, async def editMessageCaption(self,
chat_id: Union[int, str] = None, chat_id: Union[int, str] = None,
business_connection_id: str = None,
message_id: int = None, message_id: int = None,
inline_message_id: str = None, inline_message_id: str = None,
caption: str = None, caption: str = None,
parse_mode: str = None, parse_mode: str = None,
caption_entities: List[dict] = None, caption_entities: List[dict] = None,
show_caption_above_media: bool = None,
reply_markup=None): reply_markup=None):
"""Edit captions of messages. """Edit captions of messages.
@@ -1780,7 +1722,6 @@ class TelegramBot:
async def editMessageMedia(self, async def editMessageMedia(self,
chat_id: Union[int, str] = None, chat_id: Union[int, str] = None,
business_connection_id: str = None,
message_id: int = None, message_id: int = None,
inline_message_id: str = None, inline_message_id: str = None,
media=None, media=None,
@@ -1803,7 +1744,6 @@ class TelegramBot:
async def editMessageReplyMarkup(self, async def editMessageReplyMarkup(self,
chat_id: Union[int, str] = None, chat_id: Union[int, str] = None,
business_connection_id: str = None,
message_id: int = None, message_id: int = None,
inline_message_id: str = None, inline_message_id: str = None,
reply_markup=None): reply_markup=None):
@@ -1819,10 +1759,7 @@ class TelegramBot:
parameters=locals() parameters=locals()
) )
async def stopPoll(self, async def stopPoll(self, chat_id: Union[int, str], message_id,
chat_id: Union[int, str],
message_id,
business_connection_id: str = None,
reply_markup=None): reply_markup=None):
"""Stop a poll which was sent by the bot. """Stop a poll which was sent by the bot.
@@ -1878,7 +1815,6 @@ class TelegramBot:
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
emoji: str = None, emoji: str = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -2097,7 +2033,6 @@ class TelegramBot:
send_email_to_provider: bool = None, send_email_to_provider: bool = None,
is_flexible: bool = None, is_flexible: bool = None,
disable_notification: bool = None, disable_notification: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -2177,7 +2112,6 @@ class TelegramBot:
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
disable_notification: bool = None, disable_notification: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -2244,7 +2178,6 @@ class TelegramBot:
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: str = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
**kwargs): **kwargs):
@@ -2392,7 +2325,6 @@ class TelegramBot:
caption: str = None, caption: str = None,
parse_mode: str = None, parse_mode: str = None,
caption_entities: list = None, caption_entities: list = None,
show_caption_above_media: bool = None,
disable_notification: bool = None, disable_notification: bool = None,
reply_parameters: ReplyParameters = None, reply_parameters: ReplyParameters = None,
reply_markup=None, reply_markup=None,
@@ -3106,85 +3038,3 @@ class TelegramBot:
'replaceStickerInSet', 'replaceStickerInSet',
parameters=locals() parameters=locals()
) )
async def sendPaidMedia(self, chat_id: Union[int, str], star_count: int,
media: List[InputPaidMedia],
business_connection_id: str = None,
caption: str = None, parse_mode: str = None,
caption_entities: List[dict] = None,
show_caption_above_media: bool = None,
disable_notification: bool = None,
protect_content: bool = None,
reply_parameters: ReplyParameters = None,
reply_markup = None):
"""Send paid media to channel chats.
On success, the sent Message is returned.
See https://core.telegram.org/bots/api#sendpaidmedia for details.
"""
return await self.api_request(
'sendPaidMedia',
parameters=locals()
)
async def getStarTransactions(self,
offset: int = None,
limit: int = None):
"""Returns the bot's Telegram Star transactions in chronological order.
On success, returns a StarTransactions object.
See https://core.telegram.org/bots/api#getstartransactions for details.
`offset`: number of transactions to skip in the response (defaults to 0)
`limit`: maximum number of transactions to be retrieved.
Values between 1-100 are accepted (defaults to 100).
"""
return await self.api_request(
'getStarTransactions',
parameters=locals()
)
async def refundStarPayment(self,
user_id: int,
telegram_payment_charge_id: str):
"""Refunds a successful payment in Telegram Stars.
Returns True on success.
See https://core.telegram.org/bots/api#refundstarpayment for details.
"""
return await self.api_request(
'refundStarPayment',
parameters=locals()
)
async def createChatSubscriptionInviteLink(self, chat_id: Union[int, str],
name: str,
subscription_period: int,
subscription_price: int):
"""Create a subscription invite link for a channel chat.
The bot must have the can_invite_users administrator rights.
The link can be edited using the method editChatSubscriptionInviteLink
or revoked using the method revokeChatInviteLink.
Returns the new invite link as a ChatInviteLink object.
See https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
for details.
"""
return await self.api_request(
'createChatSubscriptionInviteLink',
parameters=locals()
)
async def editChatSubscriptionInviteLink(self, chat_id: Union[int, str],
invite_link: str, name: str):
"""Edit a subscription invite link created by the bot.
The bot must have the can_invite_users administrator rights.
Returns the edited invite link as a ChatInviteLink object.
See https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
for details.
"""
return await self.api_request(
'editChatSubscriptionInviteLink',
parameters=locals()
)
-10
View File
@@ -22,16 +22,6 @@ davtelepot_messages = {
} }
default_admin_messages = { default_admin_messages = {
'become_admin': {
'success': {
'en': "🎉 You are now administrator! 👑",
'it': "🎉 Ora hai diritti di amministrazione! 👑",
},
'wrong_token': {
'en': "❌ Wrong token 🚷",
'it': "❌ Password errata 🚷",
},
},
'cancel': { 'cancel': {
'button': { 'button': {
'en': "↩️ Cancel", 'en': "↩️ Cancel",