Compare commits
112 Commits
Author | SHA1 | Date |
---|---|---|
_run | e10517e088 | |
Artin GH | 1946393c36 | |
Badiboy | 0f52ca688f | |
Badiboy | b18bcd494a | |
Badiboy | 8f41df0ee4 | |
Kourva | cb7f6a8c99 | |
_run | 3960115ec7 | |
_run | 916569cdc5 | |
_run | 75d3fa2eba | |
_run | 67e3774e8e | |
_run | f799157314 | |
coder2020official | af3a98057f | |
_run | 447fc1d461 | |
_run | fb98df3dfe | |
Badiboy | 0b34da3900 | |
Artem Lukin | 5ea1abaadd | |
Badiboy | 5a81353420 | |
dependabot[bot] | eaf90cce7f | |
Badiboy | b219218c8d | |
Badiboy | 2dac17aa75 | |
Badiboy | 48377ac905 | |
Alexey Isaev | 14294d1aa3 | |
_run | ea3c159044 | |
AmirW | 58d53e1a54 | |
Badiboy | abec3dc60e | |
coder2020official | ecb5d9b4f6 | |
coder2020official | 26575dc5e7 | |
coder2020official | be69feb252 | |
coder2020official | 1d62adc262 | |
coder2020official | 77e1928628 | |
coder2020official | d6f4987197 | |
coder2020official | 966b451869 | |
coder2020official | d1417e5616 | |
_run | a7cafd1f24 | |
Badiboy | 92907ced30 | |
Badiboy | 1b2ed0e2f7 | |
_run | 370f0370c7 | |
Cub11k | e4bddd91cb | |
Cub11k | d466da3542 | |
Badiboy | e64c06b7bc | |
Badiboy | 7d168ebbd8 | |
Francisco Griman | c5689f383b | |
Francisco Griman | 8796168efb | |
_run | 100659fecd | |
_run | 7bf87a306a | |
_run | 351d021e01 | |
Badiboy | 4ffe0f8833 | |
Badiboy | 3f07dc4ce8 | |
Badiboy | 2e589ab6e1 | |
Badiboy | 8b63f6a6ef | |
Badiboy | dc98aca173 | |
Badiboy | 39360e0640 | |
Badiboy | b1c172c421 | |
Badiboy | 6b5c263ee8 | |
Badiboy | 46100edd97 | |
Badiboy | 018b89cdc0 | |
Badiboy | f3486b3730 | |
Badiboy | b0e64d828c | |
Badiboy | 14434b398e | |
_run | 1d62bf2ac8 | |
Badiboy | fe2e9a7a30 | |
Badiboy | c9ef0d71f0 | |
Badiboy | b0740a920a | |
Badiboy | 6a9c25cf80 | |
Badiboy | e56c60ac00 | |
Badiboy | 7c7a063fb6 | |
Mike Lei | bd69492ed4 | |
C̷̱̺͙͓̪͔̹͉͉̯̖̟̀͆́̽̔̈̚͠͝o̶̥̻̻̖̮͚͒̂̒͌̾̇͗͘͝d̸̢̡͈̮̦͈͙̖͔̦̭̩̰͎͉̣̰͆̈́͘͝e̸͖͆̎̏͒̀̈́͛́̍̀̀̿̚͝B̵̨̯̹̝͙͉̲̟̳̟͎̪̫̪̤̒͋̉̑̐̒̅̅̋͜y̵̞͚͕̭̤̱͖̟̫̜̓͐̏̕ͅZ̸͎̫̖͍̪̓̐͆e̶͈͇̽̔͂̉͊̈́ņ̶̣̣͎̤̯͖͉͍̳͇͈̘̳̗͚́̄̊̂̊̏̄͐͐̿̓́̽̃̄̚͝ | 37cdb52ed2 | |
C̷̱̺͙͓̪͔̹͉͉̯̖̟̀͆́̽̔̈̚͠͝o̶̥̻̻̖̮͚͒̂̒͌̾̇͗͘͝d̸̢̡͈̮̦͈͙̖͔̦̭̩̰͎͉̣̰͆̈́͘͝e̸͖͆̎̏͒̀̈́͛́̍̀̀̿̚͝B̵̨̯̹̝͙͉̲̟̳̟͎̪̫̪̤̒͋̉̑̐̒̅̅̋͜y̵̞͚͕̭̤̱͖̟̫̜̓͐̏̕ͅZ̸͎̫̖͍̪̓̐͆e̶͈͇̽̔͂̉͊̈́ņ̶̣̣͎̤̯͖͉͍̳͇͈̘̳̗͚́̄̊̂̊̏̄͐͐̿̓́̽̃̄̚͝ | d8569394b0 | |
_run | da57174635 | |
_run | 776ce0a7eb | |
coder2020official | 886806135e | |
coder2020official | 1e450ebd15 | |
_run | 41521f5618 | |
_run | 603a7cf9f2 | |
_run | 535a14ca0c | |
_run | 67a52b2e98 | |
Arash Nemat Zadeh | c47c26d2b0 | |
coder2020official | 9d2f7c02a4 | |
coder2020official | 991679bedc | |
coder2020official | 3b4e6fed04 | |
coder2020official | 5c6b867582 | |
coder2020official | 715aabaf49 | |
coder2020official | 9fa5b91e58 | |
coder2020official | de5a32e45c | |
coder2020official | db087427fc | |
coder2020official | 385fc6a6da | |
coder2020official | ac0b386625 | |
coder2020official | ae44b0022d | |
coder2020official | 73135d6012 | |
coder2020official | 19dcce0d5b | |
coder2020official | f527fc91f6 | |
coder2020official | c0185dad44 | |
coder2020official | 8a858cac4e | |
coder2020official | f30457bd75 | |
coder2020official | 54caf30f69 | |
coder2020official | 09e4a2a437 | |
coder2020official | 9b81a29a6a | |
coder2020official | 65dcd67140 | |
coder2020official | c84b771e5a | |
_run | 2bd81a5f5c | |
Badiboy | 5d9a76b0dd | |
Badiboy | 6459f13f25 | |
Badiboy | c9b6d3f868 | |
Badiboy | 80c1a4798d | |
Dmitry | 7a67d5f9f9 | |
zeldpol | d12ea91e12 | |
orocane | 4f2c89c4a8 | |
_run | fb7d60f09d | |
coder2020official | 8dc4e77287 | |
Badiboy | a999161384 | |
Badiboy | b4196f5891 |
|
@ -0,0 +1,22 @@
|
|||
# .readthedocs.yaml
|
||||
# Read the Docs configuration file
|
||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||
|
||||
# Required
|
||||
version: 2
|
||||
|
||||
# Set the version of Python and other tools you might need
|
||||
build:
|
||||
os: ubuntu-22.04
|
||||
tools:
|
||||
python: "3.9"
|
||||
|
||||
# Build documentation in the docs/ directory with Sphinx
|
||||
sphinx:
|
||||
configuration: docs/conf.py
|
||||
|
||||
# We recommend specifying your dependencies to enable reproducible builds:
|
||||
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
||||
python:
|
||||
install:
|
||||
- requirements: docs/requirements.txt
|
|
@ -2,7 +2,6 @@
|
|||
[![PyPi Package Version](https://img.shields.io/pypi/v/pyTelegramBotAPI.svg)](https://pypi.python.org/pypi/pyTelegramBotAPI)
|
||||
[![Supported Python versions](https://img.shields.io/pypi/pyversions/pyTelegramBotAPI.svg)](https://pypi.python.org/pypi/pyTelegramBotAPI)
|
||||
[![Documentation Status](https://readthedocs.org/projects/pytba/badge/?version=latest)](https://pytba.readthedocs.io/en/latest/?badge=latest)
|
||||
[![Build Status](https://travis-ci.org/eternnoir/pyTelegramBotAPI.svg?branch=master)](https://travis-ci.org/eternnoir/pyTelegramBotAPI)
|
||||
[![PyPi downloads](https://img.shields.io/pypi/dm/pyTelegramBotAPI.svg)](https://pypi.org/project/pyTelegramBotAPI/)
|
||||
[![PyPi status](https://img.shields.io/pypi/status/pytelegrambotapi.svg?style=flat-square)](https://pypi.python.org/pypi/pytelegrambotapi)
|
||||
|
||||
|
@ -11,7 +10,7 @@
|
|||
<p align="center">A simple, but extensible Python implementation for the <a href="https://core.telegram.org/bots/api">Telegram Bot API</a>.</p>
|
||||
<p align="center">Both synchronous and asynchronous.</p>
|
||||
|
||||
## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#february-3-2023">6.5</a>!
|
||||
## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#april-21-2023">6.7</a>!
|
||||
|
||||
<h2><a href='https://pytba.readthedocs.io/en/latest/index.html'>Official documentation</a></h2>
|
||||
<h2><a href='https://pytba.readthedocs.io/ru/latest/index.html'>Official ru documentation</a></h2>
|
||||
|
@ -889,5 +888,9 @@ Here are some examples of template:
|
|||
* [TeleServ](https://github.com/ablakely/TeleServ) by [ablakely](https://github.com/ablakely) This is a Telegram to IRC bridge which links as an IRC server and makes Telegram users appear as native IRC users.
|
||||
* [Simple Store Bot](https://github.com/AntonGlyzin/myshopbot) by [Anton Glyzin](https://github.com/AntonGlyzin) This is a simple telegram-store with an admin panel. Designed according to a template.
|
||||
* [Media Rating Bot](https://t.me/mediaratingbot) ([source](https://github.com/CommanderCRM/MediaRatingBot))by [CommanderCRM](https://github.com/CommanderCRM). This bot aggregates media (movies, TV series, etc.) ratings from IMDb, Rotten Tomatoes, Metacritic, TheMovieDB, FilmAffinity and also provides number of votes of said media on IMDb.
|
||||
* [Spot Seek Bot](https://t.me/SpotSeekBot) ([source](https://github.com/arashnm80/spot-seek-bot)) by [Arashnm80](https://github.com/arashnm80). This is a free & open source telegram bot for downloading tracks, albums or playlists from spotify.
|
||||
* [CalendarIT Bot](https://t.me/calendarit_bot) ([source](https://github.com/codebyzen/CalendarIT_Telegram_Bot))by [CodeByZen](https://github.com/codebyzen). A simple, but extensible Python Telegram bot, can post acquainted with what is happening today, tomorrow or what happened 20 years ago to channel.
|
||||
* [DownloadMusicBOT](https://github.com/fcoagz/DownloadMusicBOT) by *Francisco Griman* - It is a simple bot that downloads audio from YouTube videos on Telegram.
|
||||
* [AwesomeChatGPTBot](https://github.com/Kourva/AwesomeChatGPTBot) - Simple ChatGTP-3.5 bot. It is FREE and can remember chat history for a while With pre-defined roles!
|
||||
|
||||
**Want to have your bot listed here? Just make a pull request. Only bots with public source code are accepted.**
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = 'pyTelegramBotAPI Documentation'
|
||||
copyright = '2022, coder2020official'
|
||||
copyright = '2022-2023, coder2020official'
|
||||
author = 'coder2020official'
|
||||
|
||||
# The full version, including alpha/beta/rc tags
|
||||
release = '4.10.0'
|
||||
release = '4.12.0'
|
||||
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
|
|
|
@ -9,7 +9,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-01-02 19:24+0400\n"
|
||||
"POT-Creation-Date: 2023-07-08 23:07+0500\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -105,6 +105,7 @@ msgstr ""
|
|||
#: telebot.async_telebot.AsyncTeleBot.delete_my_commands
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_state
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_sticker_from_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_sticker_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_webhook
|
||||
#: telebot.async_telebot.AsyncTeleBot.download_file
|
||||
#: telebot.async_telebot.AsyncTeleBot.edit_chat_invite_link
|
||||
|
@ -131,6 +132,9 @@ msgstr ""
|
|||
#: telebot.async_telebot.AsyncTeleBot.get_game_high_scores
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_my_commands
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_my_default_administrator_rights
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_my_description
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_my_name
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_my_short_description
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_state
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_sticker_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_updates
|
||||
|
@ -196,12 +200,20 @@ msgstr ""
|
|||
#: telebot.async_telebot.AsyncTeleBot.set_chat_photo
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_sticker_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_title
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_custom_emoji_sticker_set_thumbnail
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_game_score
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_commands
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_default_administrator_rights
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_description
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_name
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_short_description
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_state
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_emoji_list
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_keywords
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_mask_position
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_position_in_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumb
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumbnail
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_title
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_update_listener
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_webhook
|
||||
#: telebot.async_telebot.AsyncTeleBot.setup_middleware
|
||||
|
@ -304,6 +316,7 @@ msgstr ""
|
|||
#: telebot.async_telebot.AsyncTeleBot.delete_my_commands
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_state
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_sticker_from_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_sticker_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_webhook
|
||||
#: telebot.async_telebot.AsyncTeleBot.download_file
|
||||
#: telebot.async_telebot.AsyncTeleBot.edit_chat_invite_link
|
||||
|
@ -329,6 +342,9 @@ msgstr ""
|
|||
#: telebot.async_telebot.AsyncTeleBot.get_game_high_scores
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_my_commands
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_my_default_administrator_rights
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_my_description
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_my_name
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_my_short_description
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_state
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_sticker_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_updates
|
||||
|
@ -392,12 +408,20 @@ msgstr ""
|
|||
#: telebot.async_telebot.AsyncTeleBot.set_chat_photo
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_sticker_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_title
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_custom_emoji_sticker_set_thumbnail
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_game_score
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_commands
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_default_administrator_rights
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_description
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_name
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_short_description
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_state
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_emoji_list
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_keywords
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_mask_position
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_position_in_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumb
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumbnail
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_title
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_update_listener
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_webhook
|
||||
#: telebot.async_telebot.AsyncTeleBot.setup_middleware
|
||||
|
@ -477,32 +501,45 @@ msgstr ""
|
|||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:1
|
||||
msgid ""
|
||||
"Use this method to add a new sticker to a set created by the bot. It's "
|
||||
"required to pass `png_sticker` or `tgs_sticker`. Returns True on success."
|
||||
"Use this method to add a new sticker to a set created by the bot. The "
|
||||
"format of the added sticker must match the format of the other stickers "
|
||||
"in the set. Emoji sticker sets can have up to 200 stickers. Animated and "
|
||||
"video sticker sets can have up to 50 stickers. Static sticker sets can "
|
||||
"have up to 120 stickers. Returns True on success."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:5
|
||||
msgid "Telegram documentation: https://core.telegram.org/bots/api#addstickertoset"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:7
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:7
|
||||
msgid "User identifier of created sticker set owner"
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:8
|
||||
msgid ""
|
||||
"**_sticker, mask_position, emojis parameters are deprecated, use stickers"
|
||||
" instead"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:10
|
||||
msgid "Telegram documentation: https://core.telegram.org/bots/api#addstickertoset"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:12
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:10
|
||||
msgid "User identifier of created sticker set owner"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:15
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_sticker_set:3
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_sticker_set:5
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumb:6
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_custom_emoji_sticker_set_thumbnail:4
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_emoji_list:4
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumbnail:6
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_title:4
|
||||
msgid "Sticker set name"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:13
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:18
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:18
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:21
|
||||
msgid "One or more emoji corresponding to the sticker"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:16
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:21
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:21
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:24
|
||||
msgid ""
|
||||
"PNG image with the sticker, must be up to 512 kilobytes in size, "
|
||||
"dimensions must not exceed 512px, and either width or height must be "
|
||||
|
@ -512,36 +549,43 @@ msgid ""
|
|||
"/form-data."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:21
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:26
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:26
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:29
|
||||
msgid "TGS animation with the sticker, uploaded using multipart/form-data."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:24
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:29
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:29
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:32
|
||||
msgid "WebM animation with the sticker, uploaded using multipart/form-data."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:27
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:40
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:32
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:42
|
||||
msgid ""
|
||||
"A JSON-serialized object for position where the mask should be placed on "
|
||||
"faces"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:30
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:35
|
||||
msgid ""
|
||||
"A JSON-serialized list of 1-50 initial stickers to be added to the "
|
||||
"sticker set"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:38
|
||||
#: telebot.async_telebot.AsyncTeleBot.answer_callback_query:22
|
||||
#: telebot.async_telebot.AsyncTeleBot.answer_inline_query:35
|
||||
#: telebot.async_telebot.AsyncTeleBot.answer_inline_query:38
|
||||
#: telebot.async_telebot.AsyncTeleBot.answer_pre_checkout_query:21
|
||||
#: telebot.async_telebot.AsyncTeleBot.answer_shipping_query:18
|
||||
#: telebot.async_telebot.AsyncTeleBot.close_forum_topic:13
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:43
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:56
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_forum_topic:13
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_sticker_from_set:6
|
||||
#: telebot.async_telebot.AsyncTeleBot.edit_forum_topic:22
|
||||
#: telebot.async_telebot.AsyncTeleBot.reopen_forum_topic:13
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_keywords:11
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_position_in_set:11
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumb:15
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumbnail:15
|
||||
#: telebot.async_telebot.AsyncTeleBot.unpin_all_forum_topic_messages:13
|
||||
msgid "On success, True is returned."
|
||||
msgstr ""
|
||||
|
@ -568,6 +612,7 @@ msgstr ""
|
|||
#: telebot.async_telebot.AsyncTeleBot.delete_message
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_my_commands
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_sticker_from_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_sticker_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_webhook
|
||||
#: telebot.async_telebot.AsyncTeleBot.download_file
|
||||
#: telebot.async_telebot.AsyncTeleBot.edit_chat_invite_link
|
||||
|
@ -627,11 +672,16 @@ msgstr ""
|
|||
#: telebot.async_telebot.AsyncTeleBot.set_chat_photo
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_sticker_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_title
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_custom_emoji_sticker_set_thumbnail
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_game_score
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_commands
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_default_administrator_rights
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_emoji_list
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_keywords
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_mask_position
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_position_in_set
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumb
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumbnail
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_title
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_webhook
|
||||
#: telebot.async_telebot.AsyncTeleBot.stop_message_live_location
|
||||
#: telebot.async_telebot.AsyncTeleBot.stop_poll
|
||||
|
@ -644,9 +694,9 @@ msgstr ""
|
|||
msgid "Return type"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:31
|
||||
#: of telebot.async_telebot.AsyncTeleBot.add_sticker_to_set:39
|
||||
#: telebot.async_telebot.AsyncTeleBot.answer_callback_query:23
|
||||
#: telebot.async_telebot.AsyncTeleBot.answer_inline_query:36
|
||||
#: telebot.async_telebot.AsyncTeleBot.answer_inline_query:39
|
||||
#: telebot.async_telebot.AsyncTeleBot.answer_pre_checkout_query:22
|
||||
#: telebot.async_telebot.AsyncTeleBot.answer_shipping_query:19
|
||||
#: telebot.async_telebot.AsyncTeleBot.approve_chat_join_request:15
|
||||
|
@ -654,7 +704,7 @@ msgstr ""
|
|||
#: telebot.async_telebot.AsyncTeleBot.ban_chat_sender_chat:17
|
||||
#: telebot.async_telebot.AsyncTeleBot.close:9
|
||||
#: telebot.async_telebot.AsyncTeleBot.close_forum_topic:14
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:44
|
||||
#: telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:57
|
||||
#: telebot.async_telebot.AsyncTeleBot.decline_chat_join_request:15
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_chat_photo:13
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_chat_sticker_set:11
|
||||
|
@ -662,6 +712,7 @@ msgstr ""
|
|||
#: telebot.async_telebot.AsyncTeleBot.delete_message:23
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_my_commands:17
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_sticker_from_set:7
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_sticker_set:7
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_webhook:13
|
||||
#: telebot.async_telebot.AsyncTeleBot.edit_forum_topic:23
|
||||
#: telebot.async_telebot.AsyncTeleBot.leave_chat:8
|
||||
|
@ -669,18 +720,23 @@ msgstr ""
|
|||
#: telebot.async_telebot.AsyncTeleBot.pin_chat_message:19
|
||||
#: telebot.async_telebot.AsyncTeleBot.promote_chat_member:61
|
||||
#: telebot.async_telebot.AsyncTeleBot.reopen_forum_topic:14
|
||||
#: telebot.async_telebot.AsyncTeleBot.restrict_chat_member:48
|
||||
#: telebot.async_telebot.AsyncTeleBot.restrict_chat_member:61
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_chat_action:26
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_administrator_custom_title:18
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_description:14
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_menu_button:15
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_permissions:15
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_permissions:21
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_photo:16
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_title:17
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_custom_emoji_sticker_set_thumbnail:11
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_commands:18
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_default_administrator_rights:18
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_emoji_list:11
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_keywords:12
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_mask_position:12
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_position_in_set:12
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumb:16
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumbnail:16
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_title:11
|
||||
#: telebot.async_telebot.AsyncTeleBot.unban_chat_member:20
|
||||
#: telebot.async_telebot.AsyncTeleBot.unban_chat_sender_chat:15
|
||||
#: telebot.async_telebot.AsyncTeleBot.unpin_all_chat_messages:12
|
||||
|
@ -795,6 +851,12 @@ msgid ""
|
|||
"switch button"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.answer_inline_query:35
|
||||
msgid ""
|
||||
"A JSON-serialized object describing a button to be shown above inline "
|
||||
"query results"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.answer_pre_checkout_query:1
|
||||
msgid ""
|
||||
"Once the user has confirmed their payment and shipping details, the Bot "
|
||||
|
@ -920,7 +982,7 @@ msgstr ""
|
|||
#: telebot.async_telebot.AsyncTeleBot.get_chat_member:8
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_user_profile_photos:6
|
||||
#: telebot.async_telebot.AsyncTeleBot.promote_chat_member:11
|
||||
#: telebot.async_telebot.AsyncTeleBot.restrict_chat_member:11
|
||||
#: telebot.async_telebot.AsyncTeleBot.restrict_chat_member:14
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_administrator_custom_title:10
|
||||
#: telebot.async_telebot.AsyncTeleBot.unban_chat_member:13
|
||||
msgid "Unique identifier of the target user"
|
||||
|
@ -941,6 +1003,9 @@ msgstr ""
|
|||
#: telebot.async_telebot.AsyncTeleBot.set_chat_title:16
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_commands:17
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_default_administrator_rights:17
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_description:12
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_name:12
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_my_short_description:12
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_webhook:46
|
||||
#: telebot.async_telebot.AsyncTeleBot.unban_chat_sender_chat:14
|
||||
#: telebot.async_telebot.AsyncTeleBot.unpin_all_chat_messages:11
|
||||
|
@ -961,7 +1026,7 @@ msgid "Telegram documentation: https://core.telegram.org/bots/api#banchatmember"
|
|||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.ban_chat_member:8
|
||||
#: telebot.async_telebot.AsyncTeleBot.restrict_chat_member:7
|
||||
#: telebot.async_telebot.AsyncTeleBot.restrict_chat_member:10
|
||||
msgid ""
|
||||
"Unique identifier for the target group or username of the target "
|
||||
"supergroup or channel (in the format @channelusername)"
|
||||
|
@ -985,8 +1050,13 @@ msgstr ""
|
|||
#: of telebot.async_telebot.AsyncTeleBot.ban_chat_member:24
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_chat_sticker_set:10
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_message:22
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_sticker_set:6
|
||||
#: telebot.async_telebot.AsyncTeleBot.delete_webhook:12
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_chat_action:25
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_custom_emoji_sticker_set_thumbnail:10
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_emoji_list:10
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_mask_position:11
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_title:10
|
||||
msgid "Returns True on success."
|
||||
msgstr ""
|
||||
|
||||
|
@ -1394,21 +1464,21 @@ msgstr ""
|
|||
#: of telebot.async_telebot.AsyncTeleBot.copy_message:45
|
||||
#: telebot.async_telebot.AsyncTeleBot.forward_message:26
|
||||
#: telebot.async_telebot.AsyncTeleBot.reply_to:11
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_animation:63
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_audio:63
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_animation:66
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_audio:66
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_contact:44
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_dice:35
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_document:56
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_document:59
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_game:32
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_invoice:101
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_location:49
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_message:46
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_photo:48
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_poll:70
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_sticker:39
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_sticker:42
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_venue:57
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_video:64
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_video_note:48
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_video:67
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_video_note:51
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_voice:49
|
||||
msgid "On success, the sent Message is returned."
|
||||
msgstr ""
|
||||
|
@ -1416,18 +1486,18 @@ msgstr ""
|
|||
#: of telebot.async_telebot.AsyncTeleBot.copy_message:46
|
||||
#: telebot.async_telebot.AsyncTeleBot.forward_message:27
|
||||
#: telebot.async_telebot.AsyncTeleBot.reply_to:12
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_animation:64
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_audio:64
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_animation:67
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_audio:67
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_contact:45
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_dice:36
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_document:57
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_document:60
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_location:50
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_message:47
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_photo:49
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_sticker:40
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_sticker:43
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_venue:58
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_video:65
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_video_note:49
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_video:68
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_video_note:52
|
||||
msgid ":class:`telebot.types.Message`"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1680,7 +1750,13 @@ msgid ""
|
|||
"https://core.telegram.org/bots/api#createnewstickerset"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:10
|
||||
#: of telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:8
|
||||
msgid ""
|
||||
"Fields *_sticker are deprecated, pass a list of stickers to stickers "
|
||||
"parameter instead."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:13
|
||||
msgid ""
|
||||
"Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., "
|
||||
"animals). Can contain only English letters, digits and underscores. Must "
|
||||
|
@ -1689,21 +1765,38 @@ msgid ""
|
|||
"characters."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:15
|
||||
#: of telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:18
|
||||
msgid "Sticker set title, 1-64 characters"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:32
|
||||
#: of telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:35
|
||||
msgid ""
|
||||
"Pass True, if a set of mask stickers should be created. Deprecated since "
|
||||
"Bot API 6.2, use sticker_type instead."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:36
|
||||
#: of telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:39
|
||||
msgid ""
|
||||
"Optional, Type of stickers in the set, pass “regular” or “mask”. Custom "
|
||||
"emoji sticker sets can't be created via the Bot API at the moment. By "
|
||||
"default, a regular sticker set is created."
|
||||
"Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. "
|
||||
"By default, a regular sticker set is created."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:45
|
||||
msgid ""
|
||||
"Pass True if stickers in the sticker set must be repainted to the color "
|
||||
"of text when used in messages, the accent color if used as emoji status, "
|
||||
"white on chat photos, or another appropriate color based on context; for "
|
||||
"custom emoji sticker sets only"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:50
|
||||
msgid "List of stickers to be added to the set"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.create_new_sticker_set:53
|
||||
msgid ""
|
||||
"Format of stickers in the set, must be one of “static”, “animated”, "
|
||||
"“video”"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.decline_chat_join_request:1
|
||||
|
@ -1846,6 +1939,10 @@ msgstr ""
|
|||
msgid "File identifier of the sticker"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.delete_sticker_set:1
|
||||
msgid "Use this method to delete a sticker set. Returns True on success."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.delete_webhook:1
|
||||
msgid ""
|
||||
"Use this method to remove webhook integration if you decide to switch "
|
||||
|
@ -2396,7 +2493,7 @@ msgid "File identifier"
|
|||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.get_file:12
|
||||
#: telebot.async_telebot.AsyncTeleBot.upload_sticker_file:14
|
||||
#: telebot.async_telebot.AsyncTeleBot.upload_sticker_file:21
|
||||
msgid ":class:`telebot.types.File`"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2457,7 +2554,7 @@ msgstr ""
|
|||
#: of telebot.async_telebot.AsyncTeleBot.get_game_high_scores:10
|
||||
#: telebot.async_telebot.AsyncTeleBot.retrieve_data:3
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_game_score:5
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumb:9
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumbnail:9
|
||||
msgid "User identifier"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2518,6 +2615,49 @@ msgstr ""
|
|||
msgid ":class:`telebot.types.ChatAdministratorRights`"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.get_my_description:1
|
||||
msgid ""
|
||||
"Use this method to get the current bot description for the given user "
|
||||
"language. Returns BotDescription on success."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.get_my_description:4
|
||||
#: telebot.async_telebot.AsyncTeleBot.get_my_short_description:4
|
||||
msgid "A two-letter ISO 639-1 language code or an empty string"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.get_my_description:7
|
||||
msgid ":class:`telebot.types.BotDescription`"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.get_my_name:1
|
||||
msgid ""
|
||||
"Use this method to get the current bot name for the given user language. "
|
||||
"Returns BotName on success."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.get_my_name:4
|
||||
msgid "Telegram documentation: https://core.telegram.org/bots/api#getmyname"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.get_my_name:6
|
||||
msgid "Optional. A two-letter ISO 639-1 language code or an empty string"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.get_my_name:9
|
||||
msgid ":class:`telebot.types.BotName`"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.get_my_short_description:1
|
||||
msgid ""
|
||||
"Use this method to get the current bot short description for the given "
|
||||
"user language. Returns BotShortDescription on success."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.get_my_short_description:7
|
||||
msgid ":class:`telebot.types.BotShortDescription`"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.get_state:1
|
||||
msgid ""
|
||||
"Gets current state of a user. Not recommended to use this method. But it "
|
||||
|
@ -2589,7 +2729,7 @@ msgid "Array of string. List the types of updates you want your bot to receive."
|
|||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.get_updates:21
|
||||
msgid "Timeout in seconds for long polling."
|
||||
msgid "Timeout in seconds for request."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.get_updates:24
|
||||
|
@ -3178,61 +3318,85 @@ msgid ""
|
|||
"https://core.telegram.org/bots/api#restrictchatmember"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:14
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:8
|
||||
msgid ""
|
||||
"Individual parameters are deprecated and will be removed, use "
|
||||
"'permissions' instead"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:17
|
||||
msgid ""
|
||||
"Date when restrictions will be lifted for the user, unix time. If user is"
|
||||
" restricted for more than 366 days or less than 30 seconds from the "
|
||||
"current time, they are considered to be restricted forever"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:19
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:22
|
||||
msgid ""
|
||||
"Pass True, if the user can send text messages, contacts, locations and "
|
||||
"venues"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:22
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:25
|
||||
msgid ""
|
||||
"Pass True, if the user can send audios, documents, photos, videos, video "
|
||||
"notes and voice notes, implies can_send_messages"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:26
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:29
|
||||
msgid "Pass True, if the user is allowed to send polls, implies can_send_messages"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:29
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:32
|
||||
msgid ""
|
||||
"Pass True, if the user can send animations, games, stickers and use "
|
||||
"inline bots, implies can_send_media_messages"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:32
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:35
|
||||
msgid ""
|
||||
"Pass True, if the user may add web page previews to their messages, "
|
||||
"implies can_send_media_messages"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:36
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:39
|
||||
msgid ""
|
||||
"Pass True, if the user is allowed to change the chat title, photo and "
|
||||
"other settings. Ignored in public supergroups"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:40
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:43
|
||||
msgid ""
|
||||
"Pass True, if the user is allowed to invite new users to the chat, "
|
||||
"implies can_invite_users"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:44
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:47
|
||||
msgid ""
|
||||
"Pass True, if the user is allowed to pin messages. Ignored in public "
|
||||
"supergroups"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:47
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:50
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_permissions:14
|
||||
msgid ""
|
||||
"Pass True if chat permissions are set independently. Otherwise, the "
|
||||
"can_send_other_messages and can_add_web_page_previews permissions will "
|
||||
"imply the can_send_messages, can_send_audios, can_send_documents, "
|
||||
"can_send_photos, can_send_videos, can_send_video_notes, and "
|
||||
"can_send_voice_notes permissions; the can_send_polls permission will "
|
||||
"imply the can_send_messages permission."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:56
|
||||
msgid ""
|
||||
"Pass ChatPermissions object to set all permissions at once. Use this "
|
||||
"parameter instead of passing all boolean parameters to avoid backward "
|
||||
"compatibility problems in future."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.restrict_chat_member:60
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_chat_permissions:20
|
||||
#: telebot.async_telebot.AsyncTeleBot.unban_chat_member:19
|
||||
msgid "True on success"
|
||||
msgstr ""
|
||||
|
@ -3275,27 +3439,27 @@ msgstr ""
|
|||
msgid "IP address to listen to. Defaults to 0.0.0.0"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:5
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:4
|
||||
msgid "A port which will be used to listen to webhooks."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:6
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:5
|
||||
msgid "Path to the webhook. Defaults to /token"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:7
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:6
|
||||
msgid "Path to the certificate file."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:8
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:7
|
||||
msgid "Path to the certificate key file."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:9
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:8
|
||||
msgid "Webhook URL."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:10
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:9
|
||||
msgid ""
|
||||
"Maximum allowed number of simultaneous HTTPS connections to the webhook "
|
||||
"for update delivery, 1-100. Defaults to 40. Use lower values to limit the"
|
||||
|
@ -3303,7 +3467,7 @@ msgid ""
|
|||
"throughput."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:11
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:10
|
||||
msgid ""
|
||||
"A JSON-serialized list of the update types you want your bot to receive. "
|
||||
"For example, specify [“message”, “edited_channel_post”, “callback_query”]"
|
||||
|
@ -3313,24 +3477,32 @@ msgid ""
|
|||
" be used."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:12
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:11
|
||||
msgid ""
|
||||
"The fixed IP address which will be used to send webhook requests instead "
|
||||
"of the IP address resolved through DNS"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:13
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:12
|
||||
msgid "Pass True to drop all pending updates"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:14
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:13
|
||||
msgid "Integer. Request connection timeout"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:15
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:14
|
||||
msgid "Secret token to be used to verify the webhook request."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:15
|
||||
msgid "Length of a secret token, defaults to 20"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.run_webhooks:16
|
||||
msgid "Debug mode, defaults to False"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.send_animation:1
|
||||
msgid ""
|
||||
"Use this method to send animation files (GIF or H.264/MPEG-4 AVC video "
|
||||
|
@ -3402,6 +3574,14 @@ msgstr ""
|
|||
msgid "Pass True, if the animation should be sent as a spoiler"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.send_animation:63
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_audio:63
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_document:56
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_video:64
|
||||
#: telebot.async_telebot.AsyncTeleBot.send_video_note:48
|
||||
msgid "Deprecated. Use thumbnail instead"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.send_audio:1
|
||||
msgid ""
|
||||
"Use this method to send audio files, if you want Telegram clients to "
|
||||
|
@ -3953,6 +4133,10 @@ msgstr ""
|
|||
msgid "to disable the notification"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.send_sticker:39
|
||||
msgid "Emoji associated with the sticker; only for just uploaded stickers"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.send_venue:1
|
||||
msgid ""
|
||||
"Use this method to send information about a venue. On success, the sent "
|
||||
|
@ -4243,6 +4427,20 @@ msgstr ""
|
|||
msgid "New chat title, 1-255 characters"
|
||||
msgstr ""
|
||||
|
||||
#: of
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_custom_emoji_sticker_set_thumbnail:1
|
||||
msgid ""
|
||||
"Use this method to set the thumbnail of a custom emoji sticker set. "
|
||||
"Returns True on success."
|
||||
msgstr ""
|
||||
|
||||
#: of
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_custom_emoji_sticker_set_thumbnail:7
|
||||
msgid ""
|
||||
"Custom emoji identifier of a sticker from the sticker set; pass an empty "
|
||||
"string to drop the thumbnail and use the first sticker as the thumbnail."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_game_score:1
|
||||
msgid "Sets the value of points in the game to a specific user."
|
||||
msgstr ""
|
||||
|
@ -4312,6 +4510,65 @@ msgid ""
|
|||
"groups and supergroups will be changed."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_my_description:1
|
||||
msgid ""
|
||||
"Use this method to change the bot's description, which is shown in the "
|
||||
"chat with the bot if the chat is empty. Returns True on success."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_my_description:5
|
||||
msgid ""
|
||||
"New bot description; 0-512 characters. Pass an empty string to remove the"
|
||||
" dedicated description for the given language."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_my_description:8
|
||||
msgid ""
|
||||
"A two-letter ISO 639-1 language code. If empty, the description will be "
|
||||
"applied to all users for whose language there is no dedicated "
|
||||
"description."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_my_name:1
|
||||
msgid "Use this method to change the bot's name. Returns True on success."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_my_name:3
|
||||
msgid "Telegram documentation: https://core.telegram.org/bots/api#setmyname"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_my_name:5
|
||||
msgid ""
|
||||
"Optional. New bot name; 0-64 characters. Pass an empty string to remove "
|
||||
"the dedicated name for the given language."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_my_name:8
|
||||
msgid ""
|
||||
"Optional. A two-letter ISO 639-1 language code. If empty, the name will "
|
||||
"be shown to all users for whose language there is no dedicated name."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_my_short_description:1
|
||||
msgid ""
|
||||
"Use this method to change the bot's short description, which is shown on "
|
||||
"the bot's profile page and is sent together with the link when users "
|
||||
"share the bot. Returns True on success."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_my_short_description:5
|
||||
msgid ""
|
||||
"New short description for the bot; 0-120 characters. Pass an empty string"
|
||||
" to remove the dedicated short description for the given language."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_my_short_description:8
|
||||
msgid ""
|
||||
"A two-letter ISO 639-1 language code. If empty, the short description "
|
||||
"will be applied to all users for whose language there is no dedicated "
|
||||
"short description."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_state:1
|
||||
msgid "Sets a new state of a user."
|
||||
msgstr ""
|
||||
|
@ -4328,6 +4585,47 @@ msgstr ""
|
|||
msgid "new state. can be string, integer, or :class:`telebot.types.State`"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_emoji_list:1
|
||||
msgid ""
|
||||
"Use this method to set the emoji list of a sticker set. Returns True on "
|
||||
"success."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_emoji_list:7
|
||||
msgid "List of emojis"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_keywords:1
|
||||
msgid ""
|
||||
"Use this method to change search keywords assigned to a regular or custom"
|
||||
" emoji sticker. The sticker must belong to a sticker set created by the "
|
||||
"bot. Returns True on success."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_keywords:5
|
||||
#: telebot.async_telebot.AsyncTeleBot.set_sticker_mask_position:5
|
||||
msgid "File identifier of the sticker."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_keywords:8
|
||||
msgid ""
|
||||
"A JSON-serialized list of 0-20 search keywords for the sticker with total"
|
||||
" length of up to 64 characters"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_mask_position:1
|
||||
msgid ""
|
||||
"Use this method to change the mask position of a mask sticker. The "
|
||||
"sticker must belong to a sticker set that was created by the bot. Returns"
|
||||
" True on success."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_mask_position:8
|
||||
msgid ""
|
||||
"A JSON-serialized object for position where the mask should be placed on "
|
||||
"faces."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_position_in_set:1
|
||||
msgid ""
|
||||
"Use this method to move a sticker in a set created by the bot to a "
|
||||
|
@ -4344,19 +4642,47 @@ msgstr ""
|
|||
msgid "New sticker position in the set, zero-based"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumb:1
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumbnail:1
|
||||
msgid ""
|
||||
"Use this method to set the thumbnail of a sticker set. Animated "
|
||||
"thumbnails can be set for animated sticker sets only. Returns True on "
|
||||
"success."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumb:4
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumbnail:4
|
||||
msgid ""
|
||||
"Telegram documentation: "
|
||||
"https://core.telegram.org/bots/api#setstickersetthumb"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_set_thumbnail:12
|
||||
msgid ""
|
||||
"A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in "
|
||||
"size and have a width and height of exactly 100px, or a .TGS animation "
|
||||
"with a thumbnail up to 32 kilobytes in size (see "
|
||||
"https://core.telegram.org/stickers#animated-sticker-requirements for "
|
||||
"animated sticker technical requirements), or a WEBM video with the "
|
||||
"thumbnail up to 32 kilobytes in size; see "
|
||||
"https://core.telegram.org/stickers#video-sticker-requirements for video "
|
||||
"sticker technical requirements. Pass a file_id as a String to send a file"
|
||||
" that already exists on the Telegram servers, pass an HTTP URL as a "
|
||||
"String for Telegram to get a file from the Internet, or upload a new one "
|
||||
"using multipart/form-data. More information on Sending Files ». Animated "
|
||||
"and video sticker set thumbnails can't be uploaded via HTTP URL. If "
|
||||
"omitted, then the thumbnail is dropped and the first sticker is used as "
|
||||
"the thumbnail."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_set_title:1
|
||||
msgid ""
|
||||
"Use this method to set the title of a created sticker set. Returns True "
|
||||
"on success."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_sticker_set_title:7
|
||||
msgid "New sticker set title"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.set_update_listener:1
|
||||
msgid "Update listener is a function that gets any update."
|
||||
msgstr ""
|
||||
|
@ -4662,12 +4988,23 @@ msgstr ""
|
|||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.upload_sticker_file:9
|
||||
msgid ""
|
||||
"PNG image with the sticker, must be up to 512 kilobytes in size, "
|
||||
"dimensions must not exceed 512px, and either width or height must be "
|
||||
"exactly 512px."
|
||||
"DEPRECATED: PNG image with the sticker, must be up to 512 kilobytes in "
|
||||
"size, dimensions must not exceed 512px, and either width or height must "
|
||||
"be exactly 512px."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.upload_sticker_file:13
|
||||
msgid ""
|
||||
"A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See "
|
||||
"https://core.telegram.org/stickers for technical requirements. More "
|
||||
"information on Sending Files »"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.upload_sticker_file:17
|
||||
msgid "One of \"static\", \"animated\", \"video\"."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.async_telebot.AsyncTeleBot.upload_sticker_file:20
|
||||
msgid "On success, the sent file is returned."
|
||||
msgstr ""
|
||||
|
||||
|
@ -4913,3 +5250,31 @@ msgstr ""
|
|||
#~ "character long"
|
||||
#~ msgstr ""
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Use this method to add a new "
|
||||
#~ "sticker to a set created by the"
|
||||
#~ " bot. It's required to pass "
|
||||
#~ "`png_sticker` or `tgs_sticker`. Returns True"
|
||||
#~ " on success."
|
||||
#~ msgstr ""
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Optional, Type of stickers in the "
|
||||
#~ "set, pass “regular” or “mask”. Custom"
|
||||
#~ " emoji sticker sets can't be created"
|
||||
#~ " via the Bot API at the moment."
|
||||
#~ " By default, a regular sticker set"
|
||||
#~ " is created."
|
||||
#~ msgstr ""
|
||||
|
||||
#~ msgid "Timeout in seconds for long polling."
|
||||
#~ msgstr ""
|
||||
|
||||
#~ msgid ""
|
||||
#~ "PNG image with the sticker, must "
|
||||
#~ "be up to 512 kilobytes in size,"
|
||||
#~ " dimensions must not exceed 512px, "
|
||||
#~ "and either width or height must be"
|
||||
#~ " exactly 512px."
|
||||
#~ msgstr ""
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -9,7 +9,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-11-29 14:44+0400\n"
|
||||
"POT-Creation-Date: 2023-07-08 23:07+0500\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -18,19 +18,19 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel 2.9.1\n"
|
||||
|
||||
#: ../../util.rst:3
|
||||
#: ../../source/util.rst:3
|
||||
msgid "Utils"
|
||||
msgstr ""
|
||||
|
||||
#: ../../util.rst:5
|
||||
#: ../../source/util.rst:5
|
||||
msgid "Utils in pyTelegramBotAPI"
|
||||
msgstr ""
|
||||
|
||||
#: ../../util.rst:5
|
||||
#: ../../source/util.rst:5
|
||||
msgid "ptba, pytba, pyTelegramBotAPI, utils, guide"
|
||||
msgstr ""
|
||||
|
||||
#: ../../util.rst:11
|
||||
#: ../../source/util.rst:11
|
||||
msgid "util file"
|
||||
msgstr ""
|
||||
|
||||
|
@ -40,9 +40,10 @@ msgid ""
|
|||
"error. Example:"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.antiflood telebot.util.escape telebot.util.extract_arguments
|
||||
#: telebot.util.extract_command telebot.util.is_bytes telebot.util.is_command
|
||||
#: telebot.util.is_dict telebot.util.is_pil_image
|
||||
#: of telebot.service_utils.is_bytes telebot.service_utils.is_dict
|
||||
#: telebot.service_utils.is_pil_image telebot.util.antiflood
|
||||
#: telebot.util.escape telebot.util.extract_arguments
|
||||
#: telebot.util.extract_command telebot.util.is_command
|
||||
#: telebot.util.parse_web_app_data telebot.util.quick_markup
|
||||
#: telebot.util.smart_split telebot.util.split_string telebot.util.user_link
|
||||
#: telebot.util.validate_web_app_data telebot.util.webhook_google_functions
|
||||
|
@ -54,28 +55,33 @@ msgid "The function to call"
|
|||
msgstr ""
|
||||
|
||||
#: of telebot.util.antiflood:13
|
||||
msgid "The arguments to pass to the function"
|
||||
msgid "Number of retries to send"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.antiflood:16
|
||||
msgid "The keyword arguments to pass to the function"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.antiflood telebot.util.escape telebot.util.extract_arguments
|
||||
#: telebot.util.extract_command telebot.util.generate_random_token
|
||||
#: telebot.util.is_bytes telebot.util.is_command telebot.util.is_dict
|
||||
#: telebot.util.is_pil_image telebot.util.parse_web_app_data
|
||||
#: telebot.util.quick_markup telebot.util.smart_split telebot.util.split_string
|
||||
#: telebot.util.user_link telebot.util.validate_web_app_data
|
||||
#: telebot.util.webhook_google_functions
|
||||
msgid "Returns"
|
||||
msgid "The arguments to pass to the function"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.antiflood:19
|
||||
msgid "The keyword arguments to pass to the function"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.service_utils.generate_random_token
|
||||
#: telebot.service_utils.is_bytes telebot.service_utils.is_dict
|
||||
#: telebot.service_utils.is_pil_image telebot.util.antiflood
|
||||
#: telebot.util.escape telebot.util.extract_arguments
|
||||
#: telebot.util.extract_command telebot.util.is_command
|
||||
#: telebot.util.parse_web_app_data telebot.util.quick_markup
|
||||
#: telebot.util.smart_split telebot.util.split_string telebot.util.user_link
|
||||
#: telebot.util.validate_web_app_data telebot.util.webhook_google_functions
|
||||
msgid "Returns"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.antiflood:22
|
||||
msgid "None"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.chunks:1
|
||||
#: of telebot.service_utils.chunks:1
|
||||
msgid "Yield successive n-sized chunks from lst."
|
||||
msgstr ""
|
||||
|
||||
|
@ -117,9 +123,10 @@ msgstr ""
|
|||
msgid "the arguments if `text` is a command (according to is_command), else None."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.extract_arguments telebot.util.extract_command
|
||||
#: telebot.util.generate_random_token telebot.util.is_bytes
|
||||
#: telebot.util.is_command telebot.util.is_dict telebot.util.is_pil_image
|
||||
#: of telebot.service_utils.generate_random_token
|
||||
#: telebot.service_utils.is_bytes telebot.service_utils.is_dict
|
||||
#: telebot.service_utils.is_pil_image telebot.util.extract_arguments
|
||||
#: telebot.util.extract_command telebot.util.is_command
|
||||
#: telebot.util.quick_markup telebot.util.smart_split telebot.util.split_string
|
||||
#: telebot.util.user_link
|
||||
msgid "Return type"
|
||||
|
@ -143,35 +150,35 @@ msgstr ""
|
|||
msgid "the command if `text` is a command (according to is_command), else None."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.generate_random_token:1
|
||||
#: of telebot.service_utils.generate_random_token:1
|
||||
msgid ""
|
||||
"Generates a random token consisting of letters and digits, 16 characters "
|
||||
"long."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.generate_random_token:3
|
||||
#: of telebot.service_utils.generate_random_token:3
|
||||
msgid "a random token"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.generate_random_token:4 telebot.util.user_link:22
|
||||
#: of telebot.service_utils.generate_random_token:4 telebot.util.user_link:22
|
||||
msgid ":obj:`str`"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.is_bytes:1
|
||||
#: of telebot.service_utils.is_bytes:1
|
||||
msgid "Returns True if the given object is a bytes object."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.is_bytes:3 telebot.util.is_dict:3
|
||||
#: telebot.util.is_pil_image:3
|
||||
#: of telebot.service_utils.is_bytes:3 telebot.service_utils.is_dict:3
|
||||
#: telebot.service_utils.is_pil_image:3
|
||||
msgid "object to be checked"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.is_bytes:6
|
||||
#: of telebot.service_utils.is_bytes:6
|
||||
msgid "True if the given object is a bytes object."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.is_bytes:7 telebot.util.is_command:7 telebot.util.is_dict:7
|
||||
#: telebot.util.is_pil_image:7
|
||||
#: of telebot.service_utils.is_bytes:7 telebot.service_utils.is_dict:7
|
||||
#: telebot.service_utils.is_pil_image:7 telebot.util.is_command:7
|
||||
msgid ":obj:`bool`"
|
||||
msgstr ""
|
||||
|
||||
|
@ -189,23 +196,23 @@ msgstr ""
|
|||
msgid "True if `text` is a command, else False."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.is_dict:1
|
||||
#: of telebot.service_utils.is_dict:1
|
||||
msgid "Returns True if the given object is a dictionary."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.is_dict:6
|
||||
#: of telebot.service_utils.is_dict:6
|
||||
msgid "True if the given object is a dictionary."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.is_pil_image:1
|
||||
#: of telebot.service_utils.is_pil_image:1
|
||||
msgid "Returns True if the given object is a PIL.Image.Image object."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.is_pil_image:6
|
||||
#: of telebot.service_utils.is_pil_image:6
|
||||
msgid "True if the given object is a PIL.Image.Image object."
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.is_string:1
|
||||
#: of telebot.service_utils.is_string:1
|
||||
msgid "Returns True if the given object is a string."
|
||||
msgstr ""
|
||||
|
||||
|
@ -240,21 +247,21 @@ msgstr ""
|
|||
msgid "Using quick_markup:"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.quick_markup:29
|
||||
#: of telebot.util.quick_markup:31
|
||||
msgid ""
|
||||
"a dict containing all buttons to create in this format: {text: kwargs} "
|
||||
"{str:}"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.quick_markup:32
|
||||
msgid "int row width"
|
||||
#: of telebot.util.quick_markup:34
|
||||
msgid "number of :class:`telebot.types.InlineKeyboardButton` objects on each row"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.quick_markup:35
|
||||
#: of telebot.util.quick_markup:37
|
||||
msgid "InlineKeyboardMarkup"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.quick_markup:36
|
||||
#: of telebot.util.quick_markup:38
|
||||
msgid ":obj:`types.InlineKeyboardMarkup`"
|
||||
msgstr ""
|
||||
|
||||
|
@ -343,3 +350,6 @@ msgstr ""
|
|||
msgid "The response object"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "int row width"
|
||||
#~ msgstr ""
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -9,7 +9,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-11-29 14:44+0400\n"
|
||||
"POT-Creation-Date: 2023-07-08 23:07+0500\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -18,19 +18,19 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel 2.9.1\n"
|
||||
|
||||
#: ../../util.rst:3
|
||||
#: ../../source/util.rst:3
|
||||
msgid "Utils"
|
||||
msgstr "Утилиты"
|
||||
|
||||
#: ../../util.rst:5
|
||||
#: ../../source/util.rst:5
|
||||
msgid "Utils in pyTelegramBotAPI"
|
||||
msgstr "Утилиты в pyTelegramBotAPI"
|
||||
|
||||
#: ../../util.rst:5
|
||||
#: ../../source/util.rst:5
|
||||
msgid "ptba, pytba, pyTelegramBotAPI, utils, guide"
|
||||
msgstr "ptba, pytba, pyTelegramBotAPI, утилиты, гайд"
|
||||
|
||||
#: ../../util.rst:11
|
||||
#: ../../source/util.rst:11
|
||||
msgid "util file"
|
||||
msgstr "Файл util"
|
||||
|
||||
|
@ -38,11 +38,14 @@ msgstr "Файл util"
|
|||
msgid ""
|
||||
"Use this function inside loops in order to avoid getting TooManyRequests "
|
||||
"error. Example:"
|
||||
msgstr "Используйте эту функцию в циклах, чтобы избежать ошибки TooManyRequests. Пример:"
|
||||
msgstr ""
|
||||
"Используйте эту функцию в циклах, чтобы избежать ошибки TooManyRequests. "
|
||||
"Пример:"
|
||||
|
||||
#: of telebot.util.antiflood telebot.util.escape telebot.util.extract_arguments
|
||||
#: telebot.util.extract_command telebot.util.is_bytes telebot.util.is_command
|
||||
#: telebot.util.is_dict telebot.util.is_pil_image
|
||||
#: of telebot.service_utils.is_bytes telebot.service_utils.is_dict
|
||||
#: telebot.service_utils.is_pil_image telebot.util.antiflood
|
||||
#: telebot.util.escape telebot.util.extract_arguments
|
||||
#: telebot.util.extract_command telebot.util.is_command
|
||||
#: telebot.util.parse_web_app_data telebot.util.quick_markup
|
||||
#: telebot.util.smart_split telebot.util.split_string telebot.util.user_link
|
||||
#: telebot.util.validate_web_app_data telebot.util.webhook_google_functions
|
||||
|
@ -54,28 +57,33 @@ msgid "The function to call"
|
|||
msgstr "Вызываемая функция"
|
||||
|
||||
#: of telebot.util.antiflood:13
|
||||
msgid "Number of retries to send"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.antiflood:16
|
||||
msgid "The arguments to pass to the function"
|
||||
msgstr "Аргументы, для передачи в функцию"
|
||||
|
||||
#: of telebot.util.antiflood:16
|
||||
#: of telebot.util.antiflood:19
|
||||
msgid "The keyword arguments to pass to the function"
|
||||
msgstr "Именованные аргументы для передачи в функцию"
|
||||
|
||||
#: of telebot.util.antiflood telebot.util.escape telebot.util.extract_arguments
|
||||
#: telebot.util.extract_command telebot.util.generate_random_token
|
||||
#: telebot.util.is_bytes telebot.util.is_command telebot.util.is_dict
|
||||
#: telebot.util.is_pil_image telebot.util.parse_web_app_data
|
||||
#: telebot.util.quick_markup telebot.util.smart_split telebot.util.split_string
|
||||
#: telebot.util.user_link telebot.util.validate_web_app_data
|
||||
#: telebot.util.webhook_google_functions
|
||||
#: of telebot.service_utils.generate_random_token
|
||||
#: telebot.service_utils.is_bytes telebot.service_utils.is_dict
|
||||
#: telebot.service_utils.is_pil_image telebot.util.antiflood
|
||||
#: telebot.util.escape telebot.util.extract_arguments
|
||||
#: telebot.util.extract_command telebot.util.is_command
|
||||
#: telebot.util.parse_web_app_data telebot.util.quick_markup
|
||||
#: telebot.util.smart_split telebot.util.split_string telebot.util.user_link
|
||||
#: telebot.util.validate_web_app_data telebot.util.webhook_google_functions
|
||||
msgid "Returns"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.antiflood:19
|
||||
#: of telebot.util.antiflood:22
|
||||
msgid "None"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.chunks:1
|
||||
#: of telebot.service_utils.chunks:1
|
||||
msgid "Yield successive n-sized chunks from lst."
|
||||
msgstr "Генерирует последовательные части списка, состоящие из n элементов."
|
||||
|
||||
|
@ -91,8 +99,9 @@ msgstr "Содержит все виды сервисных сообщений,
|
|||
msgid ""
|
||||
"Replaces the following chars in `text` ('&' with '&', '<' with '<'"
|
||||
" and '>' with '>')."
|
||||
msgstr "Заменяет следующие символы в `text` ('&' на '&', '<' на '<'"
|
||||
" и '>' на '>')."
|
||||
msgstr ""
|
||||
"Заменяет следующие символы в `text` ('&' на '&', '<' на '<' и '>' "
|
||||
"на '>')."
|
||||
|
||||
#: of telebot.util.escape:3
|
||||
msgid "the text to escape"
|
||||
|
@ -116,11 +125,14 @@ msgstr "Строка для извлечения аргументов коман
|
|||
|
||||
#: of telebot.util.extract_arguments:13
|
||||
msgid "the arguments if `text` is a command (according to is_command), else None."
|
||||
msgstr "Аргументы, если `text` является командой (согласно is_command), в остальных случаях None."
|
||||
msgstr ""
|
||||
"Аргументы, если `text` является командой (согласно is_command), в "
|
||||
"остальных случаях None."
|
||||
|
||||
#: of telebot.util.extract_arguments telebot.util.extract_command
|
||||
#: telebot.util.generate_random_token telebot.util.is_bytes
|
||||
#: telebot.util.is_command telebot.util.is_dict telebot.util.is_pil_image
|
||||
#: of telebot.service_utils.generate_random_token
|
||||
#: telebot.service_utils.is_bytes telebot.service_utils.is_dict
|
||||
#: telebot.service_utils.is_pil_image telebot.util.extract_arguments
|
||||
#: telebot.util.extract_command telebot.util.is_command
|
||||
#: telebot.util.quick_markup telebot.util.smart_split telebot.util.split_string
|
||||
#: telebot.util.user_link
|
||||
msgid "Return type"
|
||||
|
@ -135,8 +147,9 @@ msgid ""
|
|||
"Extracts the command from `text` (minus the '/') if `text` is a command "
|
||||
"(see is_command). If `text` is not a command, this function returns None."
|
||||
msgstr ""
|
||||
"Извлекает команду из `text` (исключает '/') если `text` является командой "
|
||||
"(см. is_command). Если `text` не является командой, эта функция возвращает None."
|
||||
"Извлекает команду из `text` (исключает '/') если `text` является командой"
|
||||
" (см. is_command). Если `text` не является командой, эта функция "
|
||||
"возвращает None."
|
||||
|
||||
#: of telebot.util.extract_command:12
|
||||
msgid "String to extract the command from"
|
||||
|
@ -144,37 +157,41 @@ msgstr "Строка, из которой нужно извлечь команд
|
|||
|
||||
#: of telebot.util.extract_command:15
|
||||
msgid "the command if `text` is a command (according to is_command), else None."
|
||||
msgstr "Команда, если `text` является командой (согласно is_command), в остальных случаях None."
|
||||
msgstr ""
|
||||
"Команда, если `text` является командой (согласно is_command), в остальных"
|
||||
" случаях None."
|
||||
|
||||
#: of telebot.util.generate_random_token:1
|
||||
#: of telebot.service_utils.generate_random_token:1
|
||||
msgid ""
|
||||
"Generates a random token consisting of letters and digits, 16 characters "
|
||||
"long."
|
||||
msgstr "Генерирует рандомный токен, состоящий из латинских букв и цифр длиной 16 символов."
|
||||
msgstr ""
|
||||
"Генерирует рандомный токен, состоящий из латинских букв и цифр длиной 16 "
|
||||
"символов."
|
||||
|
||||
#: of telebot.util.generate_random_token:3
|
||||
#: of telebot.service_utils.generate_random_token:3
|
||||
msgid "a random token"
|
||||
msgstr "Сгенерированный токен"
|
||||
|
||||
#: of telebot.util.generate_random_token:4 telebot.util.user_link:22
|
||||
#: of telebot.service_utils.generate_random_token:4 telebot.util.user_link:22
|
||||
msgid ":obj:`str`"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.is_bytes:1
|
||||
#: of telebot.service_utils.is_bytes:1
|
||||
msgid "Returns True if the given object is a bytes object."
|
||||
msgstr "Возвращает True если полученный объект является bytes."
|
||||
|
||||
#: of telebot.util.is_bytes:3 telebot.util.is_dict:3
|
||||
#: telebot.util.is_pil_image:3
|
||||
#: of telebot.service_utils.is_bytes:3 telebot.service_utils.is_dict:3
|
||||
#: telebot.service_utils.is_pil_image:3
|
||||
msgid "object to be checked"
|
||||
msgstr "Объект для проверки"
|
||||
|
||||
#: of telebot.util.is_bytes:6
|
||||
#: of telebot.service_utils.is_bytes:6
|
||||
msgid "True if the given object is a bytes object."
|
||||
msgstr "True, если полученный объект является bytes."
|
||||
|
||||
#: of telebot.util.is_bytes:7 telebot.util.is_command:7 telebot.util.is_dict:7
|
||||
#: telebot.util.is_pil_image:7
|
||||
#: of telebot.service_utils.is_bytes:7 telebot.service_utils.is_dict:7
|
||||
#: telebot.service_utils.is_pil_image:7 telebot.util.is_command:7
|
||||
msgid ":obj:`bool`"
|
||||
msgstr ""
|
||||
|
||||
|
@ -183,8 +200,8 @@ msgid ""
|
|||
"Checks if `text` is a command. Telegram chat commands start with the '/' "
|
||||
"character."
|
||||
msgstr ""
|
||||
"Проверяет, является ли `text` командой. Команды в Telegram начинаются "
|
||||
"с символа '/'."
|
||||
"Проверяет, является ли `text` командой. Команды в Telegram начинаются с "
|
||||
"символа '/'."
|
||||
|
||||
#: of telebot.util.is_command:3
|
||||
msgid "Text to check."
|
||||
|
@ -194,23 +211,23 @@ msgstr "Текст для проверки."
|
|||
msgid "True if `text` is a command, else False."
|
||||
msgstr "True, если `text` является командой, иначе False."
|
||||
|
||||
#: of telebot.util.is_dict:1
|
||||
#: of telebot.service_utils.is_dict:1
|
||||
msgid "Returns True if the given object is a dictionary."
|
||||
msgstr "Возвращает True, если полученный объект является словарём (dict)."
|
||||
|
||||
#: of telebot.util.is_dict:6
|
||||
#: of telebot.service_utils.is_dict:6
|
||||
msgid "True if the given object is a dictionary."
|
||||
msgstr "True, если полученный объект является словарём (dict)."
|
||||
|
||||
#: of telebot.util.is_pil_image:1
|
||||
#: of telebot.service_utils.is_pil_image:1
|
||||
msgid "Returns True if the given object is a PIL.Image.Image object."
|
||||
msgstr "Возвращает True, если полученный объект является PIL.Image.Image."
|
||||
|
||||
#: of telebot.util.is_pil_image:6
|
||||
#: of telebot.service_utils.is_pil_image:6
|
||||
msgid "True if the given object is a PIL.Image.Image object."
|
||||
msgstr "True, если полученный объект является PIL.Image.Image."
|
||||
|
||||
#: of telebot.util.is_string:1
|
||||
#: of telebot.service_utils.is_string:1
|
||||
msgid "Returns True if the given object is a string."
|
||||
msgstr "Возвращает True, если полученный объект является строкой (str)."
|
||||
|
||||
|
@ -236,9 +253,9 @@ msgid ""
|
|||
"is useful to avoid always typing 'btn1 = InlineKeyboardButton(...)' 'btn2"
|
||||
" = InlineKeyboardButton(...)'"
|
||||
msgstr ""
|
||||
"Возвращает reply markup из словаря следующего формата: {'text': kwargs}. Удобно "
|
||||
"использовать вместо постоянного использования 'btn1 = InlineKeyboardButton(...)' 'btn2"
|
||||
" = InlineKeyboardButton(...)'"
|
||||
"Возвращает reply markup из словаря следующего формата: {'text': kwargs}. "
|
||||
"Удобно использовать вместо постоянного использования 'btn1 = "
|
||||
"InlineKeyboardButton(...)' 'btn2 = InlineKeyboardButton(...)'"
|
||||
|
||||
#: of telebot.util.quick_markup:4 telebot.util.user_link:5
|
||||
msgid "Example:"
|
||||
|
@ -248,7 +265,7 @@ msgstr "Пример:"
|
|||
msgid "Using quick_markup:"
|
||||
msgstr "Используя quick_markup:"
|
||||
|
||||
#: of telebot.util.quick_markup:29
|
||||
#: of telebot.util.quick_markup:31
|
||||
msgid ""
|
||||
"a dict containing all buttons to create in this format: {text: kwargs} "
|
||||
"{str:}"
|
||||
|
@ -256,15 +273,15 @@ msgstr ""
|
|||
"Словарь, содержащий все кнопки для создания reply markup в следующем "
|
||||
"формате: {text: kwargs} {str:}"
|
||||
|
||||
#: of telebot.util.quick_markup:32
|
||||
msgid "int row width"
|
||||
msgstr "Количество кнопок в одной строке, int"
|
||||
#: of telebot.util.quick_markup:34
|
||||
msgid "number of :class:`telebot.types.InlineKeyboardButton` objects on each row"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.quick_markup:35
|
||||
#: of telebot.util.quick_markup:37
|
||||
msgid "InlineKeyboardMarkup"
|
||||
msgstr ""
|
||||
|
||||
#: of telebot.util.quick_markup:36
|
||||
#: of telebot.util.quick_markup:38
|
||||
msgid ":obj:`types.InlineKeyboardMarkup`"
|
||||
msgstr ""
|
||||
|
||||
|
@ -276,10 +293,11 @@ msgid ""
|
|||
" `chars_per_string` = 4096. Splits by '\\n', '. ' or ' ' in exactly this "
|
||||
"priority."
|
||||
msgstr ""
|
||||
"Разбивает строку на несколько, каждая из которых будет не длиннее `characters_per_string`. "
|
||||
"Удобно использовать для разбиения одного гигантского сообщения на несколько. "
|
||||
"Если `chars_per_string` > 4096: `chars_per_string` = 4096. Разбивает строку по '\\n', '. ' или ' ' "
|
||||
"именно в таком порядке."
|
||||
"Разбивает строку на несколько, каждая из которых будет не длиннее "
|
||||
"`characters_per_string`. Удобно использовать для разбиения одного "
|
||||
"гигантского сообщения на несколько. Если `chars_per_string` > 4096: "
|
||||
"`chars_per_string` = 4096. Разбивает строку по '\\n', '. ' или ' ' именно"
|
||||
" в таком порядке."
|
||||
|
||||
#: of telebot.util.smart_split:6 telebot.util.split_string:4
|
||||
msgid "The text to split"
|
||||
|
@ -287,7 +305,9 @@ msgstr "Текст для разбиения"
|
|||
|
||||
#: of telebot.util.smart_split:9
|
||||
msgid "The number of maximum characters per part the text is split to."
|
||||
msgstr "Максимальное количество символов в части текста, на которые он будет разбит."
|
||||
msgstr ""
|
||||
"Максимальное количество символов в части текста, на которые он будет "
|
||||
"разбит."
|
||||
|
||||
#: of telebot.util.smart_split:12 telebot.util.split_string:10
|
||||
msgid "The splitted text as a list of strings."
|
||||
|
@ -303,8 +323,9 @@ msgid ""
|
|||
"`chars_per_string` characters per string. This is very useful for "
|
||||
"splitting one giant message into multiples."
|
||||
msgstr ""
|
||||
"Разбивает одну строку на несколько, каждая из которых будет не длиннее `characters_per_string`. "
|
||||
"Удобно использовать для разбиения одного гигантского сообщения на несколько."
|
||||
"Разбивает одну строку на несколько, каждая из которых будет не длиннее "
|
||||
"`characters_per_string`. Удобно использовать для разбиения одного "
|
||||
"гигантского сообщения на несколько."
|
||||
|
||||
#: of telebot.util.split_string:7
|
||||
msgid "The number of characters per line the text is split into."
|
||||
|
@ -312,15 +333,17 @@ msgstr "Количество символов в одной строке, на
|
|||
|
||||
#: ../../docstring of telebot.util.update_types:1
|
||||
msgid "All update types, should be used for allowed_updates parameter in polling."
|
||||
msgstr "Все виды апдейтов, рекомендуется использовать в качестве параметра allowed_updates функции polling."
|
||||
msgstr ""
|
||||
"Все виды апдейтов, рекомендуется использовать в качестве параметра "
|
||||
"allowed_updates функции polling."
|
||||
|
||||
#: of telebot.util.user_link:1
|
||||
msgid ""
|
||||
"Returns an HTML user link. This is useful for reports. Attention: Don't "
|
||||
"forget to set parse_mode to 'HTML'!"
|
||||
msgstr ""
|
||||
"Возвращает HTML ссылку на пользователя. Удобно использовать для отчетов. Важно: Не "
|
||||
"забудьте установить значение 'HTML' в parse_mode!"
|
||||
"Возвращает HTML ссылку на пользователя. Удобно использовать для отчетов. "
|
||||
"Важно: Не забудьте установить значение 'HTML' в parse_mode!"
|
||||
|
||||
#: of telebot.util.user_link:11
|
||||
msgid ""
|
||||
|
@ -328,9 +351,10 @@ msgid ""
|
|||
"links, and etc.) This method is kept for backward compatibility, and it "
|
||||
"is recommended to use formatting.* for more options."
|
||||
msgstr ""
|
||||
"Вы можете использовать formatting.* во всех остальных вариантах форматирования(bold, italic, "
|
||||
"links, и прочее). Этот метод сохранён для обратной совместимости, рекомендуется "
|
||||
"использовать formatting.* для большего количества вариантов."
|
||||
"Вы можете использовать formatting.* во всех остальных вариантах "
|
||||
"форматирования(bold, italic, links, и прочее). Этот метод сохранён для "
|
||||
"обратной совместимости, рекомендуется использовать formatting.* для "
|
||||
"большего количества вариантов."
|
||||
|
||||
#: of telebot.util.user_link:15
|
||||
msgid "the user (not the user_id)"
|
||||
|
@ -364,3 +388,6 @@ msgstr "HTTP-запрос"
|
|||
msgid "The response object"
|
||||
msgstr "Объект, полученный в качестве ответа"
|
||||
|
||||
#~ msgid "int row width"
|
||||
#~ msgstr "Количество кнопок в одной строке, int"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pytest
|
||||
requests==2.20.0
|
||||
requests==2.31.0
|
||||
wheel==0.38.1
|
||||
aiohttp>=3.8.0,<3.9.0
|
|
@ -191,7 +191,7 @@ class TeleBot:
|
|||
coloredlogs.install(logger=logger, level=logger.level)
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
'Install colorredlogs module to use colorful_logs option.'
|
||||
'Install coloredlogs module to use colorful_logs option.'
|
||||
)
|
||||
|
||||
# threading-related
|
||||
|
@ -451,7 +451,7 @@ class TeleBot:
|
|||
drop_pending_updates: Optional[bool] = None,
|
||||
timeout: Optional[int]=None,
|
||||
secret_token: Optional[str]=None,
|
||||
secret_token_length: Optional[int]=20,):
|
||||
secret_token_length: Optional[int]=20):
|
||||
"""
|
||||
This class sets webhooks and listens to a given url and port.
|
||||
|
||||
|
@ -1028,7 +1028,7 @@ class TeleBot:
|
|||
:return:
|
||||
"""
|
||||
if none_stop is not None:
|
||||
logger.warning("polling: none_stop parameter is deprecated. Use non_stop instead.")
|
||||
logger.warning('The parameter "none_stop" is deprecated. Use "non_stop" instead.')
|
||||
non_stop = none_stop
|
||||
|
||||
if skip_pending:
|
||||
|
@ -1837,11 +1837,12 @@ class TeleBot:
|
|||
parse_mode: Optional[str]=None,
|
||||
disable_notification: Optional[bool]=None,
|
||||
timeout: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,
|
||||
thumbnail: Optional[Union[Any, str]]=None,
|
||||
caption_entities: Optional[List[types.MessageEntity]]=None,
|
||||
allow_sending_without_reply: Optional[bool]=None,
|
||||
protect_content: Optional[bool]=None,
|
||||
message_thread_id: Optional[int]=None) -> types.Message:
|
||||
message_thread_id: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,) -> types.Message:
|
||||
"""
|
||||
Use this method to send audio files, if you want Telegram clients to display them in the music player.
|
||||
Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size,
|
||||
|
@ -1887,11 +1888,11 @@ class TeleBot:
|
|||
:param timeout: Timeout in seconds for the request.
|
||||
:type timeout: :obj:`int`
|
||||
|
||||
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
|
||||
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
|
||||
The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
|
||||
Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file,
|
||||
so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>
|
||||
:type thumb: :obj:`str`
|
||||
:type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
:type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
|
||||
|
@ -1905,6 +1906,9 @@ class TeleBot:
|
|||
:param message_thread_id: Identifier of a message thread, in which the message will be sent
|
||||
:type message_thread_id: :obj:`int`
|
||||
|
||||
:param thumb: Deprecated. Use thumbnail instead
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:return: On success, the sent Message is returned.
|
||||
:rtype: :class:`telebot.types.Message`
|
||||
"""
|
||||
|
@ -1913,10 +1917,14 @@ class TeleBot:
|
|||
protect_content = self.protect_content if (protect_content is None) else protect_content
|
||||
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply
|
||||
|
||||
if thumb is not None and thumbnail is None:
|
||||
thumbnail = thumb
|
||||
logger.warning('The parameter "thumb" is deprecated. Use "thumbnail" instead.')
|
||||
|
||||
return types.Message.de_json(
|
||||
apihelper.send_audio(
|
||||
self.token, chat_id, audio, caption, duration, performer, title, reply_to_message_id,
|
||||
reply_markup, parse_mode, disable_notification, timeout, thumb,
|
||||
reply_markup, parse_mode, disable_notification, timeout, thumbnail,
|
||||
caption_entities, allow_sending_without_reply, protect_content, message_thread_id))
|
||||
|
||||
# TODO: Rewrite this method like in API.
|
||||
|
@ -2003,13 +2011,14 @@ class TeleBot:
|
|||
parse_mode: Optional[str]=None,
|
||||
disable_notification: Optional[bool]=None,
|
||||
timeout: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,
|
||||
thumbnail: Optional[Union[Any, str]]=None,
|
||||
caption_entities: Optional[List[types.MessageEntity]]=None,
|
||||
allow_sending_without_reply: Optional[bool]=None,
|
||||
visible_file_name: Optional[str]=None,
|
||||
disable_content_type_detection: Optional[bool]=None,
|
||||
data: Optional[Union[Any, str]]=None,
|
||||
protect_content: Optional[bool]=None, message_thread_id: Optional[int]=None) -> types.Message:
|
||||
protect_content: Optional[bool]=None, message_thread_id: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,) -> types.Message:
|
||||
"""
|
||||
Use this method to send general files.
|
||||
|
||||
|
@ -2042,8 +2051,8 @@ class TeleBot:
|
|||
:param timeout: Timeout in seconds for the request.
|
||||
:type timeout: :obj:`int`
|
||||
|
||||
:param thumb: InputFile or String : Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
:param thumbnail: InputFile or String : Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>
|
||||
:type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
:type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
|
||||
|
@ -2066,6 +2075,9 @@ class TeleBot:
|
|||
:param message_thread_id: The thread to which the message will be sent
|
||||
:type message_thread_id: :obj:`int`
|
||||
|
||||
:param thumb: Deprecated. Use thumbnail instead
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:return: On success, the sent Message is returned.
|
||||
:rtype: :class:`telebot.types.Message`
|
||||
"""
|
||||
|
@ -2076,13 +2088,18 @@ class TeleBot:
|
|||
|
||||
if data and not(document):
|
||||
# function typo miss compatibility
|
||||
logger.warning('The parameter "data" is deprecated. Use "document" instead.')
|
||||
document = data
|
||||
|
||||
if thumb is not None and thumbnail is None:
|
||||
thumbnail = thumb
|
||||
logger.warning('The parameter "thumb" is deprecated. Use "thumbnail" instead.')
|
||||
|
||||
return types.Message.de_json(
|
||||
apihelper.send_data(
|
||||
self.token, chat_id, document, 'document',
|
||||
reply_to_message_id = reply_to_message_id, reply_markup = reply_markup, parse_mode = parse_mode,
|
||||
disable_notification = disable_notification, timeout = timeout, caption = caption, thumb = thumb,
|
||||
disable_notification = disable_notification, timeout = timeout, caption = caption, thumbnail= thumbnail,
|
||||
caption_entities = caption_entities, allow_sending_without_reply = allow_sending_without_reply,
|
||||
disable_content_type_detection = disable_content_type_detection, visible_file_name = visible_file_name,
|
||||
protect_content = protect_content, message_thread_id = message_thread_id))
|
||||
|
@ -2099,7 +2116,8 @@ class TeleBot:
|
|||
allow_sending_without_reply: Optional[bool]=None,
|
||||
protect_content:Optional[bool]=None,
|
||||
data: Union[Any, str]=None,
|
||||
message_thread_id: Optional[int]=None) -> types.Message:
|
||||
message_thread_id: Optional[int]=None,
|
||||
emoji: Optional[str]=None) -> types.Message:
|
||||
"""
|
||||
Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
|
||||
On success, the sent Message is returned.
|
||||
|
@ -2139,6 +2157,9 @@ class TeleBot:
|
|||
:param message_thread_id: The thread to which the message will be sent
|
||||
:type message_thread_id: :obj:`int`
|
||||
|
||||
:param emoji: Emoji associated with the sticker; only for just uploaded stickers
|
||||
:type emoji: :obj:`str`
|
||||
|
||||
:return: On success, the sent Message is returned.
|
||||
:rtype: :class:`telebot.types.Message`
|
||||
"""
|
||||
|
@ -2148,6 +2169,7 @@ class TeleBot:
|
|||
|
||||
if data and not(sticker):
|
||||
# function typo miss compatibility
|
||||
logger.warning('The parameter "data" is deprecated. Use "sticker" instead.')
|
||||
sticker = data
|
||||
|
||||
return types.Message.de_json(
|
||||
|
@ -2156,14 +2178,14 @@ class TeleBot:
|
|||
reply_to_message_id=reply_to_message_id, reply_markup=reply_markup,
|
||||
disable_notification=disable_notification, timeout=timeout,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content, message_thread_id=message_thread_id))
|
||||
protect_content=protect_content, message_thread_id=message_thread_id, emoji=emoji))
|
||||
|
||||
def send_video(
|
||||
self, chat_id: Union[int, str], video: Union[Any, str],
|
||||
duration: Optional[int]=None,
|
||||
width: Optional[int]=None,
|
||||
height: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,
|
||||
thumbnail: Optional[Union[Any, str]]=None,
|
||||
caption: Optional[str]=None,
|
||||
parse_mode: Optional[str]=None,
|
||||
caption_entities: Optional[List[types.MessageEntity]]=None,
|
||||
|
@ -2176,7 +2198,8 @@ class TeleBot:
|
|||
timeout: Optional[int]=None,
|
||||
data: Optional[Union[Any, str]]=None,
|
||||
message_thread_id: Optional[int]=None,
|
||||
has_spoiler: Optional[bool]=None) -> types.Message:
|
||||
has_spoiler: Optional[bool]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,) -> types.Message:
|
||||
"""
|
||||
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
|
||||
|
||||
|
@ -2197,8 +2220,8 @@ class TeleBot:
|
|||
:param height: Video height
|
||||
:type height: :obj:`int`
|
||||
|
||||
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
|
||||
:type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:param caption: Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
|
||||
:type caption: :obj:`str`
|
||||
|
@ -2241,6 +2264,9 @@ class TeleBot:
|
|||
:param has_spoiler: Pass True, if the video should be sent as a spoiler
|
||||
:type has_spoiler: :obj:`bool`
|
||||
|
||||
:param thumb: Deprecated. Use thumbnail instead
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:return: On success, the sent Message is returned.
|
||||
:rtype: :class:`telebot.types.Message`
|
||||
"""
|
||||
|
@ -2251,12 +2277,17 @@ class TeleBot:
|
|||
|
||||
if data and not(video):
|
||||
# function typo miss compatibility
|
||||
logger.warning('The parameter "data" is deprecated. Use "video" instead.')
|
||||
video = data
|
||||
|
||||
if thumb is not None and thumbnail is None:
|
||||
thumbnail = thumb
|
||||
logger.warning('The parameter "thumb" is deprecated. Use "thumbnail" instead.')
|
||||
|
||||
return types.Message.de_json(
|
||||
apihelper.send_video(
|
||||
self.token, chat_id, video, duration, caption, reply_to_message_id, reply_markup,
|
||||
parse_mode, supports_streaming, disable_notification, timeout, thumb, width, height,
|
||||
parse_mode, supports_streaming, disable_notification, timeout, thumbnail, width, height,
|
||||
caption_entities, allow_sending_without_reply, protect_content, message_thread_id, has_spoiler))
|
||||
|
||||
def send_animation(
|
||||
|
@ -2264,7 +2295,7 @@ class TeleBot:
|
|||
duration: Optional[int]=None,
|
||||
width: Optional[int]=None,
|
||||
height: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,
|
||||
thumbnail: Optional[Union[Any, str]]=None,
|
||||
caption: Optional[str]=None,
|
||||
parse_mode: Optional[str]=None,
|
||||
caption_entities: Optional[List[types.MessageEntity]]=None,
|
||||
|
@ -2275,7 +2306,8 @@ class TeleBot:
|
|||
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
|
||||
timeout: Optional[int]=None,
|
||||
message_thread_id: Optional[int]=None,
|
||||
has_spoiler: Optional[bool]=None) -> types.Message:
|
||||
has_spoiler: Optional[bool]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,) -> types.Message:
|
||||
"""
|
||||
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
|
||||
On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
|
||||
|
@ -2298,11 +2330,11 @@ class TeleBot:
|
|||
:param height: Animation height
|
||||
:type height: :obj:`int`
|
||||
|
||||
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
|
||||
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
|
||||
The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
|
||||
Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file,
|
||||
so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
:type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:param caption: Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing
|
||||
:type caption: :obj:`str`
|
||||
|
@ -2339,6 +2371,9 @@ class TeleBot:
|
|||
:param has_spoiler: Pass True, if the animation should be sent as a spoiler
|
||||
:type has_spoiler: :obj:`bool`
|
||||
|
||||
:param thumb: Deprecated. Use thumbnail instead
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:return: On success, the sent Message is returned.
|
||||
:rtype: :class:`telebot.types.Message`
|
||||
"""
|
||||
|
@ -2347,10 +2382,13 @@ class TeleBot:
|
|||
protect_content = self.protect_content if (protect_content is None) else protect_content
|
||||
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply
|
||||
|
||||
if thumbnail is None and thumb is not None:
|
||||
thumbnail = thumb
|
||||
logger.warning('The parameter "thumb" is deprecated. Use "thumbnail" instead.')
|
||||
return types.Message.de_json(
|
||||
apihelper.send_animation(
|
||||
self.token, chat_id, animation, duration, caption, reply_to_message_id,
|
||||
reply_markup, parse_mode, disable_notification, timeout, thumb,
|
||||
reply_markup, parse_mode, disable_notification, timeout, thumbnail,
|
||||
caption_entities, allow_sending_without_reply, protect_content, width, height, message_thread_id, has_spoiler))
|
||||
|
||||
# TODO: Rewrite this method like in API.
|
||||
|
@ -2362,10 +2400,11 @@ class TeleBot:
|
|||
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
|
||||
disable_notification: Optional[bool]=None,
|
||||
timeout: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,
|
||||
thumbnail: Optional[Union[Any, str]]=None,
|
||||
allow_sending_without_reply: Optional[bool]=None,
|
||||
protect_content: Optional[bool]=None,
|
||||
message_thread_id: Optional[int]=None) -> types.Message:
|
||||
message_thread_id: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None) -> types.Message:
|
||||
"""
|
||||
As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long.
|
||||
Use this method to send video messages. On success, the sent Message is returned.
|
||||
|
@ -2399,11 +2438,11 @@ class TeleBot:
|
|||
:param timeout: Timeout in seconds for the request.
|
||||
:type timeout: :obj:`int`
|
||||
|
||||
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
|
||||
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
|
||||
The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
|
||||
Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file,
|
||||
so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
:type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:param allow_sending_without_reply: Pass True, if the message should be sent even if the specified replied-to message is not found
|
||||
:type allow_sending_without_reply: :obj:`bool`
|
||||
|
@ -2414,6 +2453,8 @@ class TeleBot:
|
|||
:param message_thread_id: Identifier of a message thread, in which the video note will be sent
|
||||
:type message_thread_id: :obj:`int`
|
||||
|
||||
:param thumb: Deprecated. Use thumbnail instead
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
:return: On success, the sent Message is returned.
|
||||
:rtype: :class:`telebot.types.Message`
|
||||
"""
|
||||
|
@ -2421,10 +2462,14 @@ class TeleBot:
|
|||
protect_content = self.protect_content if (protect_content is None) else protect_content
|
||||
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply
|
||||
|
||||
if thumbnail is None and thumb is not None:
|
||||
thumbnail = thumb
|
||||
logger.warning('The parameter "thumb" is deprecated. Use "thumbnail" instead.')
|
||||
|
||||
return types.Message.de_json(
|
||||
apihelper.send_video_note(
|
||||
self.token, chat_id, data, duration, length, reply_to_message_id, reply_markup,
|
||||
disable_notification, timeout, thumb, allow_sending_without_reply, protect_content, message_thread_id))
|
||||
disable_notification, timeout, thumbnail, allow_sending_without_reply, protect_content, message_thread_id))
|
||||
|
||||
|
||||
def send_media_group(
|
||||
|
@ -2995,9 +3040,7 @@ class TeleBot:
|
|||
can_invite_users=can_invite_users,
|
||||
can_pin_messages=can_pin_messages
|
||||
)
|
||||
logger.warning(
|
||||
"Individual parameters are deprecated and will be removed, use 'permissions' instead."
|
||||
)
|
||||
logger.warning('The parameters "can_..." are deprecated, use "permissions" instead.')
|
||||
return apihelper.restrict_chat_member(
|
||||
self.token, chat_id, user_id, permissions, until_date, use_independent_chat_permissions)
|
||||
|
||||
|
@ -3080,7 +3123,7 @@ class TeleBot:
|
|||
:rtype: :obj:`bool`
|
||||
"""
|
||||
if can_manage_voice_chats is not None:
|
||||
logger.warning("promote_chat_member: can_manage_voice_chats parameter is deprecated. Use can_manage_video_chats instead.")
|
||||
logger.warning('The parameter "can_manage_voice_chats" is deprecated. Use "can_manage_video_chats" instead.')
|
||||
if can_manage_video_chats is None:
|
||||
can_manage_video_chats = can_manage_voice_chats
|
||||
|
||||
|
@ -3401,6 +3444,110 @@ class TeleBot:
|
|||
result = apihelper.get_my_commands(self.token, scope, language_code)
|
||||
return [types.BotCommand.de_json(cmd) for cmd in result]
|
||||
|
||||
def set_my_name(self, name: Optional[str]=None, language_code: Optional[str]=None):
|
||||
"""
|
||||
Use this method to change the bot's name. Returns True on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#setmyname
|
||||
|
||||
:param name: Optional. New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
|
||||
:type name: :obj:`str`
|
||||
|
||||
:param language_code: Optional. A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose
|
||||
language there is no dedicated name.
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
:return: True on success.
|
||||
"""
|
||||
|
||||
return apihelper.set_my_name(self.token, name, language_code)
|
||||
|
||||
def get_my_name(self, language_code: Optional[str]=None):
|
||||
"""
|
||||
Use this method to get the current bot name for the given user language.
|
||||
Returns BotName on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#getmyname
|
||||
|
||||
:param language_code: Optional. A two-letter ISO 639-1 language code or an empty string
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
:return: :class:`telebot.types.BotName`
|
||||
"""
|
||||
|
||||
result = apihelper.get_my_name(self.token, language_code)
|
||||
return types.BotName.de_json(result)
|
||||
|
||||
def set_my_description(self, description: Optional[str]=None, language_code: Optional[str]=None):
|
||||
"""
|
||||
Use this method to change the bot's description, which is shown in
|
||||
the chat with the bot if the chat is empty.
|
||||
Returns True on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#setmydescription
|
||||
|
||||
:param description: New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
|
||||
:type description: :obj:`str`
|
||||
|
||||
:param language_code: A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for
|
||||
whose language there is no dedicated description.
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
:return: True on success.
|
||||
"""
|
||||
|
||||
return apihelper.set_my_description(self.token, description, language_code)
|
||||
|
||||
def get_my_description(self, language_code: Optional[str]=None):
|
||||
"""
|
||||
Use this method to get the current bot description for the given user language.
|
||||
Returns BotDescription on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#getmydescription
|
||||
|
||||
:param language_code: A two-letter ISO 639-1 language code or an empty string
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
:return: :class:`telebot.types.BotDescription`
|
||||
"""
|
||||
|
||||
return types.BotDescription.de_json(apihelper.get_my_description(self.token, language_code))
|
||||
|
||||
def set_my_short_description(self, short_description:Optional[str]=None, language_code:Optional[str]=None):
|
||||
"""
|
||||
Use this method to change the bot's short description, which is shown on the bot's profile page and
|
||||
is sent together with the link when users share the bot.
|
||||
Returns True on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#setmyshortdescription
|
||||
|
||||
:param short_description: New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
|
||||
:type short_description: :obj:`str`
|
||||
|
||||
:param language_code: A two-letter ISO 639-1 language code.
|
||||
If empty, the short description will be applied to all users for whose language there is no dedicated short description.
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
:return: True on success.
|
||||
"""
|
||||
|
||||
return apihelper.set_my_short_description(self.token, short_description, language_code)
|
||||
|
||||
def get_my_short_description(self, language_code: Optional[str]=None):
|
||||
"""
|
||||
Use this method to get the current bot short description for the given user language.
|
||||
Returns BotShortDescription on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#getmyshortdescription
|
||||
|
||||
:param language_code: A two-letter ISO 639-1 language code or an empty string
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
:return: :class:`telebot.types.BotShortDescription`
|
||||
"""
|
||||
|
||||
return types.BotShortDescription.de_json(apihelper.get_my_short_description(self.token, language_code))
|
||||
|
||||
def set_chat_menu_button(self, chat_id: Union[int, str]=None,
|
||||
menu_button: types.MenuButton=None) -> bool:
|
||||
"""
|
||||
|
@ -4374,7 +4521,8 @@ class TeleBot:
|
|||
is_personal: Optional[bool]=None,
|
||||
next_offset: Optional[str]=None,
|
||||
switch_pm_text: Optional[str]=None,
|
||||
switch_pm_parameter: Optional[str]=None) -> bool:
|
||||
switch_pm_parameter: Optional[str]=None,
|
||||
button: Optional[types.InlineQueryResultsButton]=None) -> bool:
|
||||
"""
|
||||
Use this method to send answers to an inline query. On success, True is returned.
|
||||
No more than 50 results per query are allowed.
|
||||
|
@ -4410,11 +4558,18 @@ class TeleBot:
|
|||
:param switch_pm_text: Parameter for the start message sent to the bot when user presses the switch button
|
||||
:type switch_pm_text: :obj:`str`
|
||||
|
||||
:param button: A JSON-serialized object describing a button to be shown above inline query results
|
||||
:type button: :obj:`types.InlineQueryResultsButton`
|
||||
|
||||
:return: On success, True is returned.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
if not button and (switch_pm_text or switch_pm_parameter):
|
||||
logger.warning("switch_pm_text and switch_pm_parameter are deprecated for answer_inline_query. Use button instead.")
|
||||
button = types.InlineQueryResultsButton(text=switch_pm_text, start_parameter=switch_pm_parameter)
|
||||
|
||||
return apihelper.answer_inline_query(self.token, inline_query_id, results, cache_time, is_personal, next_offset,
|
||||
switch_pm_text, switch_pm_parameter)
|
||||
button)
|
||||
|
||||
def answer_callback_query(
|
||||
self, callback_query_id: int,
|
||||
|
@ -4447,8 +4602,30 @@ class TeleBot:
|
|||
"""
|
||||
return apihelper.answer_callback_query(self.token, callback_query_id, text, show_alert, url, cache_time)
|
||||
|
||||
def set_sticker_set_thumb(
|
||||
self, name: str, user_id: int, thumb: Union[Any, str]=None):
|
||||
def set_sticker_set_thumbnail(self, name: str, user_id: int, thumbnail: Union[Any, str]=None):
|
||||
"""
|
||||
Use this method to set the thumbnail of a sticker set.
|
||||
Animated thumbnails can be set for animated sticker sets only. Returns True on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#setstickersetthumb
|
||||
|
||||
:param name: Sticker set name
|
||||
:type name: :obj:`str`
|
||||
|
||||
:param user_id: User identifier
|
||||
:type user_id: :obj:`int`
|
||||
|
||||
:param thumbnail: A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
|
||||
:type thumbnail: :obj:`filelike object`
|
||||
|
||||
:return: On success, True is returned.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
|
||||
return apihelper.set_sticker_set_thumbnail(self.token, name, user_id, thumbnail)
|
||||
|
||||
@util.deprecated(deprecation_text="Use set_sticker_set_thumbnail instead")
|
||||
def set_sticker_set_thumb(self, name: str, user_id: int, thumb: Union[Any, str]=None):
|
||||
"""
|
||||
Use this method to set the thumbnail of a sticker set.
|
||||
Animated thumbnails can be set for animated sticker sets only. Returns True on success.
|
||||
|
@ -4467,7 +4644,8 @@ class TeleBot:
|
|||
:return: On success, True is returned.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
return apihelper.set_sticker_set_thumb(self.token, name, user_id, thumb)
|
||||
# deprecated
|
||||
return self.set_sticker_set_thumbnail(name, user_id, thumb)
|
||||
|
||||
def get_sticker_set(self, name: str) -> types.StickerSet:
|
||||
"""
|
||||
|
@ -4497,8 +4675,107 @@ class TeleBot:
|
|||
"""
|
||||
result = apihelper.get_custom_emoji_stickers(self.token, custom_emoji_ids)
|
||||
return [types.Sticker.de_json(sticker) for sticker in result]
|
||||
|
||||
def set_sticker_keywords(self, sticker: str, keywords: List[str]=None) -> bool:
|
||||
"""
|
||||
Use this method to change search keywords assigned to a regular or custom emoji sticker.
|
||||
The sticker must belong to a sticker set created by the bot.
|
||||
Returns True on success.
|
||||
|
||||
def upload_sticker_file(self, user_id: int, png_sticker: Union[Any, str]) -> types.File:
|
||||
:param sticker: File identifier of the sticker.
|
||||
:type sticker: :obj:`str`
|
||||
|
||||
:param keywords: A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters
|
||||
:type keywords: :obj:`list` of :obj:`str`
|
||||
|
||||
:return: On success, True is returned.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
return apihelper.set_sticker_keywords(self.token, sticker, keywords)
|
||||
|
||||
def set_sticker_mask_position(self, sticker: str, mask_position: types.MaskPosition=None) -> bool:
|
||||
"""
|
||||
Use this method to change the mask position of a mask sticker.
|
||||
The sticker must belong to a sticker set that was created by the bot.
|
||||
Returns True on success.
|
||||
|
||||
:param sticker: File identifier of the sticker.
|
||||
:type sticker: :obj:`str`
|
||||
|
||||
:param mask_position: A JSON-serialized object for position where the mask should be placed on faces.
|
||||
:type mask_position: :class:`telebot.types.MaskPosition`
|
||||
|
||||
:return: Returns True on success.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
return apihelper.set_sticker_mask_position(self.token, sticker, mask_position)
|
||||
|
||||
|
||||
def set_custom_emoji_sticker_set_thumbnail(self, name: str, custom_emoji_id: Optional[str]=None) -> bool:
|
||||
"""
|
||||
Use this method to set the thumbnail of a custom emoji sticker set.
|
||||
Returns True on success.
|
||||
|
||||
:param name: Sticker set name
|
||||
:type name: :obj:`str`
|
||||
|
||||
:param custom_emoji_id: Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.
|
||||
:type custom_emoji_id: :obj:`str`
|
||||
|
||||
:return: Returns True on success.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
return apihelper.set_custom_emoji_sticker_set_thumbnail(self.token, name, custom_emoji_id)
|
||||
|
||||
def set_sticker_set_title(self, name: str, title: str) -> bool:
|
||||
"""
|
||||
Use this method to set the title of a created sticker set.
|
||||
Returns True on success.
|
||||
|
||||
:param name: Sticker set name
|
||||
:type name: :obj:`str`
|
||||
|
||||
:param title: New sticker set title
|
||||
:type title: :obj:`str`
|
||||
|
||||
:return: Returns True on success.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
|
||||
return apihelper.set_sticker_set_title(self.token, name, title)
|
||||
|
||||
def delete_sticker_set(self, name:str) -> bool:
|
||||
"""
|
||||
Use this method to delete a sticker set. Returns True on success.
|
||||
|
||||
:param name: Sticker set name
|
||||
:type name: :obj:`str`
|
||||
|
||||
:return: Returns True on success.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
|
||||
return apihelper.delete_sticker_set(self.token, name)
|
||||
|
||||
def set_sticker_emoji_list(self, sticker: str, emoji_list: List[str]) -> bool:
|
||||
"""
|
||||
Use this method to set the emoji list of a custom emoji sticker set.
|
||||
Returns True on success.
|
||||
|
||||
:param sticker: Sticker identifier
|
||||
:type sticker: :obj:`str`
|
||||
|
||||
:param emoji_list: List of emoji
|
||||
:type emoji_list: :obj:`list` of :obj:`str`
|
||||
|
||||
:return: Returns True on success.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
|
||||
return apihelper.set_sticker_emoji_list(self.token, sticker, emoji_list)
|
||||
|
||||
|
||||
def upload_sticker_file(self, user_id: int, png_sticker: Union[Any, str]=None, sticker: Optional[types.InputFile]=None, sticker_format: Optional[str]=None) -> types.File:
|
||||
"""
|
||||
Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet
|
||||
methods (can be used multiple times). Returns the uploaded File on success.
|
||||
|
@ -4508,25 +4785,40 @@ class TeleBot:
|
|||
:param user_id: User identifier of sticker set owner
|
||||
:type user_id: :obj:`int`
|
||||
|
||||
:param png_sticker: PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px,
|
||||
:param png_sticker: DEPRECATED: PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px,
|
||||
and either width or height must be exactly 512px.
|
||||
:type png_sticker: :obj:`filelike object`
|
||||
|
||||
:param sticker: A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format.
|
||||
See https://core.telegram.org/stickers for technical requirements. More information on Sending Files »
|
||||
:type sticker: :class:`telebot.types.InputFile`
|
||||
|
||||
:param sticker_format: One of "static", "animated", "video".
|
||||
:type sticker_format: :obj:`str`
|
||||
|
||||
:return: On success, the sent file is returned.
|
||||
:rtype: :class:`telebot.types.File`
|
||||
"""
|
||||
result = apihelper.upload_sticker_file(self.token, user_id, png_sticker)
|
||||
if png_sticker:
|
||||
logger.warning('The parameter "png_sticker" is deprecated. Use "sticker" instead.')
|
||||
sticker = png_sticker
|
||||
sticker_format = "static"
|
||||
|
||||
result = apihelper.upload_sticker_file(self.token, user_id, sticker, sticker_format)
|
||||
return types.File.de_json(result)
|
||||
|
||||
def create_new_sticker_set(
|
||||
self, user_id: int, name: str, title: str,
|
||||
emojis: str,
|
||||
emojis: Optional[List[str]]=None,
|
||||
png_sticker: Union[Any, str]=None,
|
||||
tgs_sticker: Union[Any, str]=None,
|
||||
webm_sticker: Union[Any, str]=None,
|
||||
contains_masks: Optional[bool]=None,
|
||||
sticker_type: Optional[str]=None,
|
||||
mask_position: Optional[types.MaskPosition]=None) -> bool:
|
||||
mask_position: Optional[types.MaskPosition]=None,
|
||||
needs_repainting: Optional[bool]=None,
|
||||
stickers: List[types.InputSticker]=None,
|
||||
sticker_format: Optional[str]=None) -> bool:
|
||||
"""
|
||||
Use this method to create new sticker set owned by a user.
|
||||
The bot will be able to edit the created sticker set.
|
||||
|
@ -4534,6 +4826,9 @@ class TeleBot:
|
|||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#createnewstickerset
|
||||
|
||||
.. note::
|
||||
Fields *_sticker are deprecated, pass a list of stickers to stickers parameter instead.
|
||||
|
||||
:param user_id: User identifier of created sticker set owner
|
||||
:type user_id: :obj:`int`
|
||||
|
||||
|
@ -4563,38 +4858,69 @@ class TeleBot:
|
|||
use sticker_type instead.
|
||||
:type contains_masks: :obj:`bool`
|
||||
|
||||
:param sticker_type: Optional, Type of stickers in the set, pass “regular” or “mask”. Custom emoji sticker sets can't be created
|
||||
via the Bot API at the moment. By default, a regular sticker set is created.
|
||||
:param sticker_type: Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created.
|
||||
:type sticker_type: :obj:`str`
|
||||
|
||||
:param mask_position: A JSON-serialized object for position where the mask should be placed on faces
|
||||
:type mask_position: :class:`telebot.types.MaskPosition`
|
||||
|
||||
:param needs_repainting: Pass True if stickers in the sticker set must be repainted to the color of text when used in messages,
|
||||
the accent color if used as emoji status, white on chat photos, or another appropriate color based on context;
|
||||
for custom emoji sticker sets only
|
||||
:type needs_repainting: :obj:`bool`
|
||||
|
||||
:param stickers: List of stickers to be added to the set
|
||||
:type stickers: :obj:`list` of :class:`telebot.types.InputSticker`
|
||||
|
||||
:param sticker_format: Format of stickers in the set, must be one of “static”, “animated”, “video”
|
||||
:type sticker_format: :obj:`str`
|
||||
|
||||
:return: On success, True is returned.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
if tgs_sticker:
|
||||
sticker_format = 'animated'
|
||||
elif webm_sticker:
|
||||
sticker_format = 'video'
|
||||
elif png_sticker:
|
||||
sticker_format = 'static'
|
||||
|
||||
if contains_masks is not None:
|
||||
logger.warning('The parameter "contains_masks" is deprecated, use "sticker_type" instead')
|
||||
if sticker_type is None:
|
||||
sticker_type = 'mask' if contains_masks else 'regular'
|
||||
|
||||
if stickers is None:
|
||||
stickers = png_sticker or tgs_sticker or webm_sticker
|
||||
if stickers is None:
|
||||
raise ValueError('You must pass at least one sticker')
|
||||
stickers = [types.InputSticker(sticker=stickers, emoji_list=emojis, mask_position=mask_position)]
|
||||
|
||||
|
||||
|
||||
return apihelper.create_new_sticker_set(
|
||||
self.token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
||||
mask_position, webm_sticker, sticker_type)
|
||||
self.token, user_id, name, title, stickers, sticker_format, sticker_type, needs_repainting)
|
||||
|
||||
|
||||
def add_sticker_to_set(
|
||||
self, user_id: int, name: str, emojis: str,
|
||||
self, user_id: int, name: str, emojis: Union[List[str], str],
|
||||
png_sticker: Optional[Union[Any, str]]=None,
|
||||
tgs_sticker: Optional[Union[Any, str]]=None,
|
||||
webm_sticker: Optional[Union[Any, str]]=None,
|
||||
mask_position: Optional[types.MaskPosition]=None) -> bool:
|
||||
mask_position: Optional[types.MaskPosition]=None,
|
||||
sticker: Optional[List[types.InputSticker]]=None) -> bool:
|
||||
"""
|
||||
Use this method to add a new sticker to a set created by the bot.
|
||||
It's required to pass `png_sticker` or `tgs_sticker`.
|
||||
Use this method to add a new sticker to a set created by the bot.
|
||||
The format of the added sticker must match the format of the other stickers in the set.
|
||||
Emoji sticker sets can have up to 200 stickers. Animated and video sticker sets can have up to 50 stickers.
|
||||
Static sticker sets can have up to 120 stickers.
|
||||
Returns True on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#addstickertoset
|
||||
|
||||
.. note::
|
||||
**_sticker, mask_position, emojis parameters are deprecated, use stickers instead
|
||||
|
||||
:param user_id: User identifier of created sticker set owner
|
||||
:type user_id: :obj:`int`
|
||||
|
||||
|
@ -4618,11 +4944,27 @@ class TeleBot:
|
|||
:param mask_position: A JSON-serialized object for position where the mask should be placed on faces
|
||||
:type mask_position: :class:`telebot.types.MaskPosition`
|
||||
|
||||
:param sticker: A JSON-serialized list of 1-50 initial stickers to be added to the sticker set
|
||||
:type sticker: :obj:`list` of :class:`telebot.types.InputSticker`
|
||||
|
||||
:return: On success, True is returned.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
|
||||
# split emojis if string
|
||||
if isinstance(emojis, str):
|
||||
emojis = list(emojis)
|
||||
# Replaced the parameters png_sticker, tgs_sticker, webm_sticker, emojis and mask_position
|
||||
if sticker is None:
|
||||
old_sticker = png_sticker or tgs_sticker or webm_sticker
|
||||
if old_sticker is not None:
|
||||
logger.warning('The parameters "..._sticker", "emojis" and "mask_position" are deprecated, use "sticker" instead')
|
||||
if not old_sticker:
|
||||
raise ValueError('You must pass at least one sticker.')
|
||||
sticker = types.InputSticker(old_sticker, emojis, mask_position)
|
||||
|
||||
return apihelper.add_sticker_to_set(
|
||||
self.token, user_id, name, emojis, png_sticker, tgs_sticker, mask_position, webm_sticker)
|
||||
self.token, user_id, name, sticker)
|
||||
|
||||
def set_sticker_position_in_set(self, sticker: str, position: int) -> bool:
|
||||
"""
|
||||
|
@ -6256,7 +6598,7 @@ class TeleBot:
|
|||
Registers chat member handler.
|
||||
|
||||
:param callback: function to be called
|
||||
:type callback: :obj:`function``
|
||||
:type callback: :obj:`function`
|
||||
|
||||
:param func: Function executed as a filter
|
||||
:type func: :obj:`function`
|
||||
|
@ -6459,7 +6801,6 @@ class TeleBot:
|
|||
if not process_handler: continue
|
||||
for i in inspect.signature(handler['function']).parameters:
|
||||
params.append(i)
|
||||
result = None
|
||||
if len(params) == 1:
|
||||
result = handler['function'](message)
|
||||
elif "data" in params:
|
||||
|
|
|
@ -355,15 +355,15 @@ def get_chat_member_count(token, chat_id):
|
|||
return _make_request(token, method_url, params=payload)
|
||||
|
||||
|
||||
def set_sticker_set_thumb(token, name, user_id, thumb):
|
||||
method_url = r'setStickerSetThumb'
|
||||
def set_sticker_set_thumbnail(token, name, user_id, thumbnail):
|
||||
method_url = r'setStickerSetThumbnail'
|
||||
payload = {'name': name, 'user_id': user_id}
|
||||
files = {}
|
||||
if thumb:
|
||||
if not isinstance(thumb, str):
|
||||
files['thumb'] = thumb
|
||||
if thumbnail:
|
||||
if not isinstance(thumbnail, str):
|
||||
files['thumbnail'] = thumbnail
|
||||
else:
|
||||
payload['thumb'] = thumb
|
||||
payload['thumbnail'] = thumbnail
|
||||
return _make_request(token, method_url, params=payload, files=files or None)
|
||||
|
||||
|
||||
|
@ -668,8 +668,8 @@ def send_chat_action(token, chat_id, action, timeout=None, message_thread_id=Non
|
|||
|
||||
|
||||
def send_video(token, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None,
|
||||
parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None,
|
||||
thumb=None, width=None, height=None, caption_entities=None, allow_sending_without_reply=None, protect_content=None,
|
||||
parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None,
|
||||
thumbnail=None, width=None, height=None, caption_entities=None, allow_sending_without_reply=None, protect_content=None,
|
||||
message_thread_id=None, has_spoiler=None):
|
||||
method_url = r'sendVideo'
|
||||
payload = {'chat_id': chat_id}
|
||||
|
@ -694,14 +694,14 @@ def send_video(token, chat_id, data, duration=None, caption=None, reply_to_messa
|
|||
payload['disable_notification'] = disable_notification
|
||||
if timeout:
|
||||
payload['timeout'] = timeout
|
||||
if thumb:
|
||||
if not util.is_string(thumb):
|
||||
if thumbnail:
|
||||
if not util.is_string(thumbnail):
|
||||
if files:
|
||||
files['thumb'] = thumb
|
||||
files['thumbnail'] = thumbnail
|
||||
else:
|
||||
files = {'thumb': thumb}
|
||||
files = {'thumbnail': thumbnail}
|
||||
else:
|
||||
payload['thumb'] = thumb
|
||||
payload['thumbnail'] = thumbnail
|
||||
if width:
|
||||
payload['width'] = width
|
||||
if height:
|
||||
|
@ -721,7 +721,7 @@ def send_video(token, chat_id, data, duration=None, caption=None, reply_to_messa
|
|||
|
||||
def send_animation(
|
||||
token, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None,
|
||||
parse_mode=None, disable_notification=None, timeout=None, thumb=None, caption_entities=None,
|
||||
parse_mode=None, disable_notification=None, timeout=None, thumbnail=None, caption_entities=None,
|
||||
allow_sending_without_reply=None, protect_content=None, width=None, height=None, message_thread_id=None,
|
||||
has_spoiler=None):
|
||||
method_url = r'sendAnimation'
|
||||
|
@ -745,14 +745,14 @@ def send_animation(
|
|||
payload['disable_notification'] = disable_notification
|
||||
if timeout:
|
||||
payload['timeout'] = timeout
|
||||
if thumb:
|
||||
if not util.is_string(thumb):
|
||||
if thumbnail:
|
||||
if not util.is_string(thumbnail):
|
||||
if files:
|
||||
files['thumb'] = thumb
|
||||
files['thumbnail'] = thumbnail
|
||||
else:
|
||||
files = {'thumb': thumb}
|
||||
files = {'thumbnail': thumbnail}
|
||||
else:
|
||||
payload['thumb'] = thumb
|
||||
payload['thumbnail'] = thumbnail
|
||||
if caption_entities:
|
||||
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
|
||||
if allow_sending_without_reply is not None:
|
||||
|
@ -806,7 +806,7 @@ def send_voice(token, chat_id, voice, caption=None, duration=None, reply_to_mess
|
|||
|
||||
|
||||
def send_video_note(token, chat_id, data, duration=None, length=None, reply_to_message_id=None, reply_markup=None,
|
||||
disable_notification=None, timeout=None, thumb=None, allow_sending_without_reply=None, protect_content=None,
|
||||
disable_notification=None, timeout=None, thumbnail=None, allow_sending_without_reply=None, protect_content=None,
|
||||
message_thread_id=None):
|
||||
method_url = r'sendVideoNote'
|
||||
payload = {'chat_id': chat_id}
|
||||
|
@ -829,14 +829,14 @@ def send_video_note(token, chat_id, data, duration=None, length=None, reply_to_m
|
|||
payload['disable_notification'] = disable_notification
|
||||
if timeout:
|
||||
payload['timeout'] = timeout
|
||||
if thumb:
|
||||
if not util.is_string(thumb):
|
||||
if thumbnail:
|
||||
if not util.is_string(thumbnail):
|
||||
if files:
|
||||
files['thumb'] = thumb
|
||||
files['thumbnail'] = thumbnail
|
||||
else:
|
||||
files = {'thumb': thumb}
|
||||
files = {'thumbnail': thumbnail}
|
||||
else:
|
||||
payload['thumb'] = thumb
|
||||
payload['thumbnail'] = thumbnail
|
||||
if allow_sending_without_reply is not None:
|
||||
payload['allow_sending_without_reply'] = allow_sending_without_reply
|
||||
if protect_content is not None:
|
||||
|
@ -847,7 +847,7 @@ def send_video_note(token, chat_id, data, duration=None, length=None, reply_to_m
|
|||
|
||||
|
||||
def send_audio(token, chat_id, audio, caption=None, duration=None, performer=None, title=None, reply_to_message_id=None,
|
||||
reply_markup=None, parse_mode=None, disable_notification=None, timeout=None, thumb=None,
|
||||
reply_markup=None, parse_mode=None, disable_notification=None, timeout=None, thumbnail=None,
|
||||
caption_entities=None, allow_sending_without_reply=None, protect_content=None, message_thread_id=None):
|
||||
method_url = r'sendAudio'
|
||||
payload = {'chat_id': chat_id}
|
||||
|
@ -874,14 +874,14 @@ def send_audio(token, chat_id, audio, caption=None, duration=None, performer=Non
|
|||
payload['disable_notification'] = disable_notification
|
||||
if timeout:
|
||||
payload['timeout'] = timeout
|
||||
if thumb:
|
||||
if not util.is_string(thumb):
|
||||
if thumbnail:
|
||||
if not util.is_string(thumbnail):
|
||||
if files:
|
||||
files['thumb'] = thumb
|
||||
files['thumbnail'] = thumbnail
|
||||
else:
|
||||
files = {'thumb': thumb}
|
||||
files = {'thumbnail': thumbnail}
|
||||
else:
|
||||
payload['thumb'] = thumb
|
||||
payload['thumbnail'] = thumbnail
|
||||
if caption_entities:
|
||||
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
|
||||
if allow_sending_without_reply is not None:
|
||||
|
@ -894,9 +894,9 @@ def send_audio(token, chat_id, audio, caption=None, duration=None, performer=Non
|
|||
|
||||
|
||||
def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_markup=None, parse_mode=None,
|
||||
disable_notification=None, timeout=None, caption=None, thumb=None, caption_entities=None,
|
||||
disable_notification=None, timeout=None, caption=None, thumbnail=None, caption_entities=None,
|
||||
allow_sending_without_reply=None, disable_content_type_detection=None, visible_file_name=None,
|
||||
protect_content = None, message_thread_id=None):
|
||||
protect_content = None, message_thread_id=None, emoji=None):
|
||||
method_url = get_method_by_type(data_type)
|
||||
payload = {'chat_id': chat_id}
|
||||
files = None
|
||||
|
@ -919,14 +919,14 @@ def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_m
|
|||
payload['timeout'] = timeout
|
||||
if caption:
|
||||
payload['caption'] = caption
|
||||
if thumb:
|
||||
if not util.is_string(thumb):
|
||||
if thumbnail:
|
||||
if not util.is_string(thumbnail):
|
||||
if files:
|
||||
files['thumb'] = thumb
|
||||
files['thumbnail'] = thumbnail
|
||||
else:
|
||||
files = {'thumb': thumb}
|
||||
files = {'thumbnail': thumbnail}
|
||||
else:
|
||||
payload['thumb'] = thumb
|
||||
payload['thumbnail'] = thumbnail
|
||||
if caption_entities:
|
||||
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
|
||||
if allow_sending_without_reply is not None:
|
||||
|
@ -937,6 +937,8 @@ def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_m
|
|||
payload['disable_content_type_detection'] = disable_content_type_detection
|
||||
if message_thread_id:
|
||||
payload['message_thread_id'] = message_thread_id
|
||||
if emoji:
|
||||
payload['emoji'] = emoji
|
||||
return _make_request(token, method_url, params=payload, files=files, method='post')
|
||||
|
||||
|
||||
|
@ -974,7 +976,7 @@ def restrict_chat_member(
|
|||
payload = {'chat_id': chat_id, 'user_id': user_id, 'permissions': permissions.to_json()}
|
||||
|
||||
if use_independent_chat_permissions is not None:
|
||||
permissions['use_independent_chat_permissions'] = use_independent_chat_permissions
|
||||
payload['use_independent_chat_permissions'] = use_independent_chat_permissions
|
||||
if until_date is not None:
|
||||
if isinstance(until_date, datetime):
|
||||
payload['until_date'] = until_date.timestamp()
|
||||
|
@ -1152,6 +1154,39 @@ def set_chat_title(token, chat_id, title):
|
|||
return _make_request(token, method_url, params=payload, method='post')
|
||||
|
||||
|
||||
def set_my_description(token, description=None, language_code=None):
|
||||
method_url = r'setMyDescription'
|
||||
payload = {}
|
||||
if description is not None:
|
||||
payload['description'] = description
|
||||
if language_code is not None:
|
||||
payload['language_code'] = language_code
|
||||
return _make_request(token, method_url, params=payload, method='post')
|
||||
|
||||
|
||||
def get_my_description(token, language_code=None):
|
||||
method_url = r'getMyDescription'
|
||||
payload = {}
|
||||
if language_code:
|
||||
payload['language_code'] = language_code
|
||||
return _make_request(token, method_url, params=payload)
|
||||
|
||||
def set_my_short_description(token, short_description=None, language_code=None):
|
||||
method_url = r'setMyShortDescription'
|
||||
payload = {}
|
||||
if short_description is not None:
|
||||
payload['short_description'] = short_description
|
||||
if language_code is not None:
|
||||
payload['language_code'] = language_code
|
||||
return _make_request(token, method_url, params=payload, method='post')
|
||||
|
||||
def get_my_short_description(token, language_code=None):
|
||||
method_url = r'getMyShortDescription'
|
||||
payload = {}
|
||||
if language_code:
|
||||
payload['language_code'] = language_code
|
||||
return _make_request(token, method_url, params=payload)
|
||||
|
||||
def get_my_commands(token, scope=None, language_code=None):
|
||||
method_url = r'getMyCommands'
|
||||
payload = {}
|
||||
|
@ -1161,6 +1196,22 @@ def get_my_commands(token, scope=None, language_code=None):
|
|||
payload['language_code'] = language_code
|
||||
return _make_request(token, method_url, params=payload)
|
||||
|
||||
def set_my_name(token, name=None, language_code=None):
|
||||
method_url = r'setMyName'
|
||||
payload = {}
|
||||
if name is not None:
|
||||
payload['name'] = name
|
||||
if language_code is not None:
|
||||
payload['language_code'] = language_code
|
||||
return _make_request(token, method_url, params=payload, method='post')
|
||||
|
||||
def get_my_name(token, language_code=None):
|
||||
method_url = r'getMyName'
|
||||
payload = {}
|
||||
if language_code is not None:
|
||||
payload['language_code'] = language_code
|
||||
return _make_request(token, method_url, params=payload)
|
||||
|
||||
def set_chat_menu_button(token, chat_id=None, menu_button=None):
|
||||
method_url = r'setChatMenuButton'
|
||||
payload = {}
|
||||
|
@ -1444,7 +1495,8 @@ def send_invoice(
|
|||
:param max_tip_amount: The maximum accepted amount for tips in the smallest units of the currency
|
||||
:param suggested_tip_amounts: A JSON-serialized array of suggested amounts of tips in the smallest units of the currency.
|
||||
At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
|
||||
:param protect_content:
|
||||
:param protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
|
||||
:return:
|
||||
"""
|
||||
method_url = r'sendInvoice'
|
||||
|
@ -1562,7 +1614,7 @@ def answer_callback_query(token, callback_query_id, text=None, show_alert=None,
|
|||
|
||||
|
||||
def answer_inline_query(token, inline_query_id, results, cache_time=None, is_personal=None, next_offset=None,
|
||||
switch_pm_text=None, switch_pm_parameter=None):
|
||||
button=None):
|
||||
method_url = 'answerInlineQuery'
|
||||
payload = {'inline_query_id': inline_query_id, 'results': _convert_list_json_serializable(results)}
|
||||
if cache_time is not None:
|
||||
|
@ -1571,10 +1623,8 @@ def answer_inline_query(token, inline_query_id, results, cache_time=None, is_per
|
|||
payload['is_personal'] = is_personal
|
||||
if next_offset is not None:
|
||||
payload['next_offset'] = next_offset
|
||||
if switch_pm_text:
|
||||
payload['switch_pm_text'] = switch_pm_text
|
||||
if switch_pm_parameter:
|
||||
payload['switch_pm_parameter'] = switch_pm_parameter
|
||||
if button is not None:
|
||||
payload["button"] = button.to_json()
|
||||
return _make_request(token, method_url, params=payload, method='post')
|
||||
|
||||
|
||||
|
@ -1584,58 +1634,86 @@ def get_sticker_set(token, name):
|
|||
|
||||
def get_custom_emoji_stickers(token, custom_emoji_ids):
|
||||
method_url = r'getCustomEmojiStickers'
|
||||
return _make_request(token, method_url, params={'custom_emoji_ids': custom_emoji_ids})
|
||||
return _make_request(token, method_url, params={'custom_emoji_ids': json.dumps(custom_emoji_ids)})
|
||||
|
||||
def set_sticker_keywords(token, sticker, keywords=None):
|
||||
method_url = 'setStickerKeywords'
|
||||
payload = {'sticker': sticker}
|
||||
if keywords:
|
||||
payload['keywords'] = json.dumps(keywords)
|
||||
return _make_request(token, method_url, params=payload, method='post')
|
||||
|
||||
def set_sticker_mask_position(token, sticker, mask_position=None):
|
||||
method_url = 'setStickerMaskPosition'
|
||||
payload = {'sticker': sticker}
|
||||
if mask_position:
|
||||
payload['mask_position'] = mask_position.to_json()
|
||||
return _make_request(token, method_url, params=payload, method='post')
|
||||
|
||||
|
||||
def upload_sticker_file(token, user_id, png_sticker):
|
||||
def upload_sticker_file(token, user_id, sticker, sticker_format):
|
||||
method_url = 'uploadStickerFile'
|
||||
payload = {'user_id': user_id}
|
||||
files = {'png_sticker': png_sticker}
|
||||
payload = {'user_id': user_id, 'sticker_format': sticker_format}
|
||||
files = {'sticker': sticker}
|
||||
return _make_request(token, method_url, params=payload, files=files, method='post')
|
||||
|
||||
|
||||
def set_custom_emoji_sticker_set_thumbnail(token, name, custom_emoji_id=None):
|
||||
method_url = 'setCustomEmojiStickerSetThumbnail'
|
||||
payload = {'name': name}
|
||||
if custom_emoji_id is not None:
|
||||
payload['custom_emoji_id'] = custom_emoji_id
|
||||
return _make_request(token, method_url, params=payload, method='post')
|
||||
|
||||
|
||||
def set_sticker_set_title(token, name, title):
|
||||
method_url = 'setStickerSetTitle'
|
||||
payload = {'name': name, 'title': title}
|
||||
return _make_request(token, method_url, params=payload, method='post')
|
||||
|
||||
def delete_sticker_set(token, name):
|
||||
method_url = 'deleteStickerSet'
|
||||
payload = {'name': name}
|
||||
return _make_request(token, method_url, params=payload, method='post')
|
||||
|
||||
def set_sticker_emoji_list(token, sticker, emoji_list):
|
||||
method_url = 'setStickerEmojiList'
|
||||
payload = {'sticker': sticker, 'emoji_list': json.dumps(emoji_list)}
|
||||
return _make_request(token, method_url, params=payload, method='post')
|
||||
|
||||
def create_new_sticker_set(
|
||||
token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
||||
mask_position=None, webm_sticker=None, sticker_type=None):
|
||||
token, user_id, name, title, stickers, sticker_format, sticker_type=None, needs_repainting=None):
|
||||
method_url = 'createNewStickerSet'
|
||||
payload = {'user_id': user_id, 'name': name, 'title': title, 'emojis': emojis}
|
||||
if png_sticker:
|
||||
stype = 'png_sticker'
|
||||
elif webm_sticker:
|
||||
stype = 'webm_sticker'
|
||||
else:
|
||||
stype = 'tgs_sticker'
|
||||
sticker = png_sticker or tgs_sticker or webm_sticker
|
||||
files = None
|
||||
if not util.is_string(sticker):
|
||||
files = {stype: sticker}
|
||||
else:
|
||||
payload[stype] = sticker
|
||||
if mask_position:
|
||||
payload['mask_position'] = mask_position.to_json()
|
||||
if webm_sticker:
|
||||
payload['webm_sticker'] = webm_sticker
|
||||
payload = {'user_id': user_id, 'name': name, 'title': title, 'sticker_format': sticker_format}
|
||||
if sticker_type:
|
||||
payload['sticker_type'] = sticker_type
|
||||
if needs_repainting:
|
||||
payload['needs_repainting'] = needs_repainting
|
||||
|
||||
files = {}
|
||||
lst = []
|
||||
|
||||
for sticker in stickers:
|
||||
json_dict, file = sticker.convert_input_sticker()
|
||||
json_dict = sticker.to_dict()
|
||||
|
||||
if file:
|
||||
list_keys = list(file.keys())
|
||||
files[list_keys[0]] = file[list_keys[0]]
|
||||
lst.append(json_dict)
|
||||
|
||||
payload['stickers'] = json.dumps(lst)
|
||||
|
||||
|
||||
|
||||
return _make_request(token, method_url, params=payload, files=files, method='post')
|
||||
|
||||
|
||||
def add_sticker_to_set(token, user_id, name, emojis, png_sticker, tgs_sticker, mask_position, webm_sticker):
|
||||
def add_sticker_to_set(token, user_id, name, sticker):
|
||||
method_url = 'addStickerToSet'
|
||||
payload = {'user_id': user_id, 'name': name, 'emojis': emojis}
|
||||
if png_sticker:
|
||||
stype = 'png_sticker'
|
||||
elif webm_sticker:
|
||||
stype = 'webm_sticker'
|
||||
else:
|
||||
stype = 'tgs_sticker'
|
||||
sticker = png_sticker or tgs_sticker or webm_sticker
|
||||
files = None
|
||||
if not util.is_string(sticker):
|
||||
files = {stype: sticker}
|
||||
else:
|
||||
payload[stype] = sticker
|
||||
if mask_position:
|
||||
payload['mask_position'] = mask_position.to_json()
|
||||
json_dict, files = sticker.convert_input_sticker()
|
||||
payload = {'user_id': user_id, 'name': name, 'sticker': json_dict}
|
||||
|
||||
return _make_request(token, method_url, params=payload, files=files, method='post')
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import telebot.types
|
|||
from telebot.asyncio_storage import StateMemoryStorage, StatePickleStorage, StateStorageBase
|
||||
from telebot.asyncio_handler_backends import BaseMiddleware, CancelUpdate, SkipHandler, State, ContinueHandling
|
||||
|
||||
from inspect import signature
|
||||
from inspect import signature, iscoroutinefunction
|
||||
|
||||
from telebot import util, types, asyncio_helper
|
||||
import asyncio
|
||||
|
@ -139,7 +139,7 @@ class AsyncTeleBot:
|
|||
coloredlogs.install(logger=logger, level=logger.level)
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
'Install colorredlogs module to use colorful_logs option.'
|
||||
'Install coloredlogs module to use colorful_logs option.'
|
||||
)
|
||||
|
||||
# properties
|
||||
|
@ -209,8 +209,8 @@ class AsyncTeleBot:
|
|||
:param allowed_updates: Array of string. List the types of updates you want your bot to receive.
|
||||
:type allowed_updates: :obj:`list`, optional
|
||||
|
||||
:param long_polling_timeout: Timeout in seconds for long polling.
|
||||
:type long_polling_timeout: :obj:`int`, optional
|
||||
:param request_timeout: Timeout in seconds for request.
|
||||
:type request_timeout: :obj:`int`, optional
|
||||
|
||||
:return: An Array of Update objects is returned.
|
||||
:rtype: :obj:`list` of :class:`telebot.types.Update`
|
||||
|
@ -294,7 +294,7 @@ class AsyncTeleBot:
|
|||
:return:
|
||||
"""
|
||||
if none_stop is not None:
|
||||
logger.warning("polling: none_stop parameter is deprecated. Use non_stop instead.")
|
||||
logger.warning('The parameter "none_stop" is deprecated. Use "non_stop" instead.')
|
||||
non_stop = none_stop
|
||||
|
||||
if skip_pending:
|
||||
|
@ -511,7 +511,6 @@ class AsyncTeleBot:
|
|||
if not process_update: continue
|
||||
for i in signature(handler['function']).parameters:
|
||||
params.append(i)
|
||||
result = None
|
||||
if len(params) == 1:
|
||||
result = await handler['function'](message)
|
||||
elif "data" in params:
|
||||
|
@ -537,6 +536,7 @@ class AsyncTeleBot:
|
|||
if not isinstance(result, ContinueHandling):
|
||||
break
|
||||
except Exception as e:
|
||||
handler_error = e
|
||||
if self.exception_handler:
|
||||
self.exception_handler.handle(e)
|
||||
else:
|
||||
|
@ -837,6 +837,8 @@ class AsyncTeleBot:
|
|||
elif message_filter == 'chat_types':
|
||||
return message.chat.type in filter_value
|
||||
elif message_filter == 'func':
|
||||
if iscoroutinefunction(filter_value):
|
||||
return await filter_value(message)
|
||||
return filter_value(message)
|
||||
elif self.custom_filters and message_filter in self.custom_filters:
|
||||
return await self._check_filter(message_filter,filter_value,message)
|
||||
|
@ -2059,8 +2061,7 @@ class AsyncTeleBot:
|
|||
"""
|
||||
This class sets webhooks and listens to a given url and port.
|
||||
|
||||
:param listen: IP address to listen to. Defaults to
|
||||
0.0.0.0
|
||||
:param listen: IP address to listen to. Defaults to 0.0.0.0
|
||||
:param port: A port which will be used to listen to webhooks.
|
||||
:param url_path: Path to the webhook. Defaults to /token
|
||||
:param certificate: Path to the certificate file.
|
||||
|
@ -2072,6 +2073,8 @@ class AsyncTeleBot:
|
|||
:param drop_pending_updates: Pass True to drop all pending updates
|
||||
:param timeout: Integer. Request connection timeout
|
||||
:param secret_token: Secret token to be used to verify the webhook request.
|
||||
:param secret_token_length: Length of a secret token, defaults to 20
|
||||
:param debug: Debug mode, defaults to False
|
||||
:return:
|
||||
"""
|
||||
|
||||
|
@ -2079,12 +2082,9 @@ class AsyncTeleBot:
|
|||
if not secret_token:
|
||||
secret_token = ''.join(random.choices(string.ascii_uppercase + string.digits, k=secret_token_length))
|
||||
|
||||
|
||||
if not url_path:
|
||||
url_path = self.token + '/'
|
||||
if url_path[-1] != '/': url_path += '/'
|
||||
|
||||
|
||||
|
||||
protocol = "https" if certificate else "http"
|
||||
if not webhook_url:
|
||||
|
@ -2093,8 +2093,6 @@ class AsyncTeleBot:
|
|||
if certificate and certificate_key:
|
||||
ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
||||
ssl_ctx.load_cert_chain(certificate, certificate_key)
|
||||
else:
|
||||
ssl_ctx = None
|
||||
|
||||
# open certificate if it exists
|
||||
cert_file = open(certificate, 'rb') if certificate else None
|
||||
|
@ -2700,11 +2698,12 @@ class AsyncTeleBot:
|
|||
parse_mode: Optional[str]=None,
|
||||
disable_notification: Optional[bool]=None,
|
||||
timeout: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,
|
||||
thumbnail: Optional[Union[Any, str]]=None,
|
||||
caption_entities: Optional[List[types.MessageEntity]]=None,
|
||||
allow_sending_without_reply: Optional[bool]=None,
|
||||
protect_content: Optional[bool]=None,
|
||||
message_thread_id: Optional[int]=None) -> types.Message:
|
||||
message_thread_id: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None) -> types.Message:
|
||||
"""
|
||||
Use this method to send audio files, if you want Telegram clients to display them in the music player.
|
||||
Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size,
|
||||
|
@ -2750,11 +2749,11 @@ class AsyncTeleBot:
|
|||
:param timeout: Timeout in seconds for the request.
|
||||
:type timeout: :obj:`int`
|
||||
|
||||
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
|
||||
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
|
||||
The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
|
||||
Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file,
|
||||
so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>
|
||||
:type thumb: :obj:`str`
|
||||
:type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
:type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
|
||||
|
@ -2768,6 +2767,9 @@ class AsyncTeleBot:
|
|||
:param message_thread_id: Identifier of a message thread, in which the message will be sent
|
||||
:type message_thread_id: :obj:`int`
|
||||
|
||||
:param thumb: Deprecated. Use thumbnail instead
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:return: On success, the sent Message is returned.
|
||||
:rtype: :class:`telebot.types.Message`
|
||||
"""
|
||||
|
@ -2776,10 +2778,14 @@ class AsyncTeleBot:
|
|||
protect_content = self.protect_content if (protect_content is None) else protect_content
|
||||
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply
|
||||
|
||||
if thumb is not None and thumbnail is None:
|
||||
thumbnail = thumb
|
||||
logger.warning('The parameter "thumb" is deprecated, use "thumbnail" instead')
|
||||
|
||||
return types.Message.de_json(
|
||||
await asyncio_helper.send_audio(
|
||||
self.token, chat_id, audio, caption, duration, performer, title, reply_to_message_id,
|
||||
reply_markup, parse_mode, disable_notification, timeout, thumb,
|
||||
reply_markup, parse_mode, disable_notification, timeout, thumbnail,
|
||||
caption_entities, allow_sending_without_reply, protect_content, message_thread_id))
|
||||
|
||||
async def send_voice(
|
||||
|
@ -2864,14 +2870,15 @@ class AsyncTeleBot:
|
|||
parse_mode: Optional[str]=None,
|
||||
disable_notification: Optional[bool]=None,
|
||||
timeout: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,
|
||||
thumbnail: Optional[Union[Any, str]]=None,
|
||||
caption_entities: Optional[List[types.MessageEntity]]=None,
|
||||
allow_sending_without_reply: Optional[bool]=None,
|
||||
visible_file_name: Optional[str]=None,
|
||||
disable_content_type_detection: Optional[bool]=None,
|
||||
data: Optional[Union[Any, str]]=None,
|
||||
protect_content: Optional[bool]=None,
|
||||
message_thread_id: Optional[int]=None) -> types.Message:
|
||||
message_thread_id: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None) -> types.Message:
|
||||
"""
|
||||
Use this method to send general files.
|
||||
|
||||
|
@ -2904,8 +2911,8 @@ class AsyncTeleBot:
|
|||
:param timeout: Timeout in seconds for the request.
|
||||
:type timeout: :obj:`int`
|
||||
|
||||
:param thumb: InputFile or String : Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
:param thumbnail: InputFile or String : Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>
|
||||
:type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
:type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
|
||||
|
@ -2928,6 +2935,9 @@ class AsyncTeleBot:
|
|||
:param message_thread_id: Identifier of a message thread, in which the message will be sent
|
||||
:type message_thread_id: :obj:`int`
|
||||
|
||||
:param thumb: Deprecated. Use thumbnail instead
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:return: On success, the sent Message is returned.
|
||||
:rtype: :class:`telebot.types.Message`
|
||||
"""
|
||||
|
@ -2938,13 +2948,18 @@ class AsyncTeleBot:
|
|||
|
||||
if data and not(document):
|
||||
# function typo miss compatibility
|
||||
logger.warning('The parameter "data" is deprecated. Use "document" instead.')
|
||||
document = data
|
||||
|
||||
if thumb is not None and thumbnail is None:
|
||||
thumbnail = thumb
|
||||
logger.warning('The parameter "thumb" is deprecated. Use "thumbnail" instead.')
|
||||
|
||||
return types.Message.de_json(
|
||||
await asyncio_helper.send_data(
|
||||
self.token, chat_id, document, 'document',
|
||||
reply_to_message_id = reply_to_message_id, reply_markup = reply_markup, parse_mode = parse_mode,
|
||||
disable_notification = disable_notification, timeout = timeout, caption = caption, thumb = thumb,
|
||||
disable_notification = disable_notification, timeout = timeout, caption = caption, thumbnail= thumbnail,
|
||||
caption_entities = caption_entities, allow_sending_without_reply = allow_sending_without_reply,
|
||||
disable_content_type_detection = disable_content_type_detection, visible_file_name = visible_file_name, protect_content = protect_content,
|
||||
message_thread_id = message_thread_id))
|
||||
|
@ -2958,7 +2973,8 @@ class AsyncTeleBot:
|
|||
allow_sending_without_reply: Optional[bool]=None,
|
||||
protect_content: Optional[bool]=None,
|
||||
data: Union[Any, str]=None,
|
||||
message_thread_id: Optional[int]=None) -> types.Message:
|
||||
message_thread_id: Optional[int]=None,
|
||||
emoji: Optional[str]=None) -> types.Message:
|
||||
"""
|
||||
Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
|
||||
On success, the sent Message is returned.
|
||||
|
@ -2998,6 +3014,9 @@ class AsyncTeleBot:
|
|||
:param message_thread_id: Identifier of a message thread, in which the message will be sent
|
||||
:type message_thread_id: :obj:`int`
|
||||
|
||||
:param emoji: Emoji associated with the sticker; only for just uploaded stickers
|
||||
:type emoji: :obj:`str`
|
||||
|
||||
:return: On success, the sent Message is returned.
|
||||
:rtype: :class:`telebot.types.Message`
|
||||
"""
|
||||
|
@ -3007,7 +3026,7 @@ class AsyncTeleBot:
|
|||
|
||||
if data and not(sticker):
|
||||
# function typo miss compatibility
|
||||
logger.warning("send_sticker: data parameter is deprecated. Use sticker instead.")
|
||||
logger.warning('The parameter "data" is deprecated. Use "sticker" instead.')
|
||||
sticker = data
|
||||
|
||||
return types.Message.de_json(
|
||||
|
@ -3016,14 +3035,14 @@ class AsyncTeleBot:
|
|||
reply_to_message_id=reply_to_message_id, reply_markup=reply_markup,
|
||||
disable_notification=disable_notification, timeout=timeout,
|
||||
allow_sending_without_reply=allow_sending_without_reply, protect_content=protect_content,
|
||||
message_thread_id=message_thread_id))
|
||||
message_thread_id=message_thread_id, emoji=emoji))
|
||||
|
||||
async def send_video(
|
||||
self, chat_id: Union[int, str], video: Union[Any, str],
|
||||
duration: Optional[int]=None,
|
||||
width: Optional[int]=None,
|
||||
height: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,
|
||||
thumbnail: Optional[Union[Any, str]]=None,
|
||||
caption: Optional[str]=None,
|
||||
parse_mode: Optional[str]=None,
|
||||
caption_entities: Optional[List[types.MessageEntity]]=None,
|
||||
|
@ -3036,7 +3055,8 @@ class AsyncTeleBot:
|
|||
timeout: Optional[int]=None,
|
||||
data: Optional[Union[Any, str]]=None,
|
||||
message_thread_id: Optional[int]=None,
|
||||
has_spoiler: Optional[bool]=None) -> types.Message:
|
||||
has_spoiler: Optional[bool]=None,
|
||||
thumb: Optional[Union[Any, str]]=None) -> types.Message:
|
||||
"""
|
||||
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
|
||||
|
||||
|
@ -3057,8 +3077,8 @@ class AsyncTeleBot:
|
|||
:param height: Video height
|
||||
:type height: :obj:`int`
|
||||
|
||||
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
|
||||
:type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:param caption: Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
|
||||
:type caption: :obj:`str`
|
||||
|
@ -3101,6 +3121,9 @@ class AsyncTeleBot:
|
|||
:param has_spoiler: Pass True, if the video should be sent as a spoiler
|
||||
:type has_spoiler: :obj:`bool`
|
||||
|
||||
:param thumb: Deprecated. Use thumbnail instead
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:return: On success, the sent Message is returned.
|
||||
:rtype: :class:`telebot.types.Message`
|
||||
"""
|
||||
|
@ -3111,13 +3134,17 @@ class AsyncTeleBot:
|
|||
|
||||
if data and not(video):
|
||||
# function typo miss compatibility
|
||||
logger.warning("send_sticker: data parameter is deprecated. Use video instead.")
|
||||
logger.warning('The parameter "data" is deprecated. Use "video" instead.')
|
||||
video = data
|
||||
|
||||
if thumb and not(thumbnail):
|
||||
logger.warning('The parameter "thumb" is deprecated. Use "thumbnail" instead.')
|
||||
thumbnail = thumb
|
||||
|
||||
return types.Message.de_json(
|
||||
await asyncio_helper.send_video(
|
||||
self.token, chat_id, video, duration, caption, reply_to_message_id, reply_markup,
|
||||
parse_mode, supports_streaming, disable_notification, timeout, thumb, width, height,
|
||||
parse_mode, supports_streaming, disable_notification, timeout, thumbnail, width, height,
|
||||
caption_entities, allow_sending_without_reply, protect_content, message_thread_id, has_spoiler))
|
||||
|
||||
async def send_animation(
|
||||
|
@ -3125,7 +3152,7 @@ class AsyncTeleBot:
|
|||
duration: Optional[int]=None,
|
||||
width: Optional[int]=None,
|
||||
height: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,
|
||||
thumbnail: Optional[Union[Any, str]]=None,
|
||||
caption: Optional[str]=None,
|
||||
parse_mode: Optional[str]=None,
|
||||
caption_entities: Optional[List[types.MessageEntity]]=None,
|
||||
|
@ -3136,7 +3163,8 @@ class AsyncTeleBot:
|
|||
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
|
||||
timeout: Optional[int]=None,
|
||||
message_thread_id: Optional[int]=None,
|
||||
has_spoiler: Optional[bool]=None) -> types.Message:
|
||||
has_spoiler: Optional[bool]=None,
|
||||
thumb: Optional[Union[Any, str]]=None) -> types.Message:
|
||||
"""
|
||||
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
|
||||
On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
|
||||
|
@ -3159,11 +3187,11 @@ class AsyncTeleBot:
|
|||
:param height: Animation height
|
||||
:type height: :obj:`int`
|
||||
|
||||
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
|
||||
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
|
||||
The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
|
||||
Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file,
|
||||
so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
:type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:param caption: Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing
|
||||
:type caption: :obj:`str`
|
||||
|
@ -3200,6 +3228,9 @@ class AsyncTeleBot:
|
|||
:param has_spoiler: Pass True, if the animation should be sent as a spoiler
|
||||
:type has_spoiler: :obj:`bool`
|
||||
|
||||
:param thumb: Deprecated. Use thumbnail instead
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:return: On success, the sent Message is returned.
|
||||
:rtype: :class:`telebot.types.Message`
|
||||
"""
|
||||
|
@ -3208,10 +3239,14 @@ class AsyncTeleBot:
|
|||
protect_content = self.protect_content if (protect_content is None) else protect_content
|
||||
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply
|
||||
|
||||
if thumb is not None and thumbnail is None:
|
||||
thumbnail = thumb
|
||||
logger.warning('The parameter "thumb" is deprecated. Use "thumbnail" instead.')
|
||||
|
||||
return types.Message.de_json(
|
||||
await asyncio_helper.send_animation(
|
||||
self.token, chat_id, animation, duration, caption, reply_to_message_id,
|
||||
reply_markup, parse_mode, disable_notification, timeout, thumb,
|
||||
reply_markup, parse_mode, disable_notification, timeout, thumbnail,
|
||||
caption_entities, allow_sending_without_reply, width, height, protect_content, message_thread_id, has_spoiler))
|
||||
|
||||
async def send_video_note(
|
||||
|
@ -3222,10 +3257,11 @@ class AsyncTeleBot:
|
|||
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
|
||||
disable_notification: Optional[bool]=None,
|
||||
timeout: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None,
|
||||
thumbnail: Optional[Union[Any, str]]=None,
|
||||
allow_sending_without_reply: Optional[bool]=None,
|
||||
protect_content: Optional[bool]=None,
|
||||
message_thread_id: Optional[int]=None) -> types.Message:
|
||||
message_thread_id: Optional[int]=None,
|
||||
thumb: Optional[Union[Any, str]]=None) -> types.Message:
|
||||
"""
|
||||
As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long.
|
||||
Use this method to send video messages. On success, the sent Message is returned.
|
||||
|
@ -3259,11 +3295,11 @@ class AsyncTeleBot:
|
|||
:param timeout: Timeout in seconds for the request.
|
||||
:type timeout: :obj:`int`
|
||||
|
||||
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
|
||||
:param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
|
||||
The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
|
||||
Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file,
|
||||
so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
:type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:param allow_sending_without_reply: Pass True, if the message should be sent even if the specified replied-to message is not found
|
||||
:type allow_sending_without_reply: :obj:`bool`
|
||||
|
@ -3274,6 +3310,9 @@ class AsyncTeleBot:
|
|||
:param message_thread_id: Identifier of a message thread, in which the video note will be sent
|
||||
:type message_thread_id: :obj:`int`
|
||||
|
||||
:param thumb: Deprecated. Use thumbnail instead
|
||||
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
|
||||
|
||||
:return: On success, the sent Message is returned.
|
||||
:rtype: :class:`telebot.types.Message`
|
||||
"""
|
||||
|
@ -3281,10 +3320,14 @@ class AsyncTeleBot:
|
|||
protect_content = self.protect_content if (protect_content is None) else protect_content
|
||||
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply
|
||||
|
||||
if thumb is not None and thumbnail is None:
|
||||
thumbnail = thumb
|
||||
logger.warning('The parameter "thumb" is deprecated. Use "thumbnail" instead.')
|
||||
|
||||
return types.Message.de_json(
|
||||
await asyncio_helper.send_video_note(
|
||||
self.token, chat_id, data, duration, length, reply_to_message_id, reply_markup,
|
||||
disable_notification, timeout, thumb, allow_sending_without_reply, protect_content, message_thread_id))
|
||||
disable_notification, timeout, thumbnail, allow_sending_without_reply, protect_content, message_thread_id))
|
||||
|
||||
async def send_media_group(
|
||||
self, chat_id: Union[int, str],
|
||||
|
@ -3852,9 +3895,7 @@ class AsyncTeleBot:
|
|||
can_invite_users=can_invite_users,
|
||||
can_pin_messages=can_pin_messages
|
||||
)
|
||||
logger.warning(
|
||||
"Individual parameters are deprecated and will be removed, use 'permissions' instead."
|
||||
)
|
||||
logger.warning('The parameters "can_..." are deprecated, use "permissions" instead.')
|
||||
return await asyncio_helper.restrict_chat_member(
|
||||
self.token, chat_id, user_id, permissions, until_date, use_independent_chat_permissions)
|
||||
|
||||
|
@ -3938,7 +3979,7 @@ class AsyncTeleBot:
|
|||
"""
|
||||
|
||||
if can_manage_voice_chats is not None:
|
||||
logger.warning("promote_chat_member: can_manage_voice_chats parameter is deprecated. Use can_manage_video_chats instead.")
|
||||
logger.warning('The parameter "can_manage_voice_chats" is deprecated. Use "can_manage_video_chats" instead.')
|
||||
if can_manage_video_chats is None:
|
||||
can_manage_video_chats = can_manage_voice_chats
|
||||
|
||||
|
@ -4238,6 +4279,68 @@ class AsyncTeleBot:
|
|||
"""
|
||||
return await asyncio_helper.delete_chat_photo(self.token, chat_id)
|
||||
|
||||
async def set_my_description(self, description: Optional[str]=None, language_code: Optional[str]=None):
|
||||
"""
|
||||
Use this method to change the bot's description, which is shown in
|
||||
the chat with the bot if the chat is empty.
|
||||
Returns True on success.
|
||||
|
||||
:param description: New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
|
||||
:type description: :obj:`str`
|
||||
|
||||
:param language_code: A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for
|
||||
whose language there is no dedicated description.
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
:return: True on success.
|
||||
"""
|
||||
|
||||
return await asyncio_helper.set_my_description(self.token, description, language_code)
|
||||
|
||||
async def get_my_description(self, language_code: Optional[str]=None):
|
||||
"""
|
||||
Use this method to get the current bot description for the given user language.
|
||||
Returns BotDescription on success.
|
||||
|
||||
:param language_code: A two-letter ISO 639-1 language code or an empty string
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
:return: :class:`telebot.types.BotDescription`
|
||||
"""
|
||||
result = await asyncio_helper.get_my_description(self.token, language_code)
|
||||
return types.BotDescription.de_json(result)
|
||||
|
||||
async def set_my_short_description(self, short_description:Optional[str]=None, language_code:Optional[str]=None):
|
||||
"""
|
||||
Use this method to change the bot's short description, which is shown on the bot's profile page and
|
||||
is sent together with the link when users share the bot.
|
||||
Returns True on success.
|
||||
|
||||
:param short_description: New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
|
||||
:type short_description: :obj:`str`
|
||||
|
||||
:param language_code: A two-letter ISO 639-1 language code.
|
||||
If empty, the short description will be applied to all users for whose language there is no dedicated short description.
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
:return: True on success.
|
||||
"""
|
||||
|
||||
return await asyncio_helper.set_my_short_description(self.token, short_description, language_code)
|
||||
|
||||
async def get_my_short_description(self, language_code: Optional[str]=None):
|
||||
"""
|
||||
Use this method to get the current bot short description for the given user language.
|
||||
Returns BotShortDescription on success.
|
||||
|
||||
:param language_code: A two-letter ISO 639-1 language code or an empty string
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
:return: :class:`telebot.types.BotShortDescription`
|
||||
"""
|
||||
result = await asyncio_helper.get_my_short_description(self.token, language_code)
|
||||
return types.BotShortDescription.de_json(result)
|
||||
|
||||
async def get_my_commands(self, scope: Optional[types.BotCommandScope],
|
||||
language_code: Optional[str]) -> List[types.BotCommand]:
|
||||
"""
|
||||
|
@ -4261,6 +4364,40 @@ class AsyncTeleBot:
|
|||
result = await asyncio_helper.get_my_commands(self.token, scope, language_code)
|
||||
return [types.BotCommand.de_json(cmd) for cmd in result]
|
||||
|
||||
async def set_my_name(self, name: Optional[str]=None, language_code: Optional[str]=None):
|
||||
"""
|
||||
Use this method to change the bot's name. Returns True on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#setmyname
|
||||
|
||||
:param name: Optional. New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
|
||||
:type name: :obj:`str`
|
||||
|
||||
:param language_code: Optional. A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose
|
||||
language there is no dedicated name.
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
:return: True on success.
|
||||
"""
|
||||
|
||||
return await asyncio_helper.set_my_name(self.token, name, language_code)
|
||||
|
||||
async def get_my_name(self, language_code: Optional[str]=None):
|
||||
"""
|
||||
Use this method to get the current bot name for the given user language.
|
||||
Returns BotName on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#getmyname
|
||||
|
||||
:param language_code: Optional. A two-letter ISO 639-1 language code or an empty string
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
:return: :class:`telebot.types.BotName`
|
||||
"""
|
||||
|
||||
result = await asyncio_helper.get_my_name(self.token, language_code)
|
||||
return types.BotName.de_json(result)
|
||||
|
||||
async def set_chat_menu_button(self, chat_id: Union[int, str]=None,
|
||||
menu_button: types.MenuButton=None) -> bool:
|
||||
"""
|
||||
|
@ -5237,7 +5374,8 @@ class AsyncTeleBot:
|
|||
is_personal: Optional[bool]=None,
|
||||
next_offset: Optional[str]=None,
|
||||
switch_pm_text: Optional[str]=None,
|
||||
switch_pm_parameter: Optional[str]=None) -> bool:
|
||||
switch_pm_parameter: Optional[str]=None,
|
||||
button: Optional[types.InlineQueryResultsButton]=None) -> bool:
|
||||
"""
|
||||
Use this method to send answers to an inline query. On success, True is returned.
|
||||
No more than 50 results per query are allowed.
|
||||
|
@ -5273,11 +5411,18 @@ class AsyncTeleBot:
|
|||
:param switch_pm_text: Parameter for the start message sent to the bot when user presses the switch button
|
||||
:type switch_pm_text: :obj:`str`
|
||||
|
||||
:param button: A JSON-serialized object describing a button to be shown above inline query results
|
||||
:type button: :obj:`types.InlineQueryResultsButton`
|
||||
|
||||
:return: On success, True is returned.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
|
||||
if not button and (switch_pm_text or switch_pm_parameter):
|
||||
logger.warning("switch_pm_text and switch_pm_parameter are deprecated for answer_inline_query. Use button instead.")
|
||||
button = types.InlineQueryResultsButton(text=switch_pm_text, start_parameter=switch_pm_parameter)
|
||||
return await asyncio_helper.answer_inline_query(self.token, inline_query_id, results, cache_time, is_personal, next_offset,
|
||||
switch_pm_text, switch_pm_parameter)
|
||||
button)
|
||||
|
||||
async def answer_callback_query(
|
||||
self, callback_query_id: int,
|
||||
|
@ -5310,8 +5455,29 @@ class AsyncTeleBot:
|
|||
"""
|
||||
return await asyncio_helper.answer_callback_query(self.token, callback_query_id, text, show_alert, url, cache_time)
|
||||
|
||||
async def set_sticker_set_thumb(
|
||||
self, name: str, user_id: int, thumb: Union[Any, str]=None):
|
||||
async def set_sticker_set_thumbnail(self, name: str, user_id: int, thumbnail: Union[Any, str]=None):
|
||||
"""
|
||||
Use this method to set the thumbnail of a sticker set.
|
||||
Animated thumbnails can be set for animated sticker sets only. Returns True on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#setstickersetthumb
|
||||
|
||||
:param name: Sticker set name
|
||||
:type name: :obj:`str`
|
||||
|
||||
:param user_id: User identifier
|
||||
:type user_id: :obj:`int`
|
||||
|
||||
:param thumbnail: A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
|
||||
:type thumbnail: :obj:`filelike object`
|
||||
|
||||
:return: On success, True is returned.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
return await asyncio_helper.set_sticker_set_thumbnail(self.token, name, user_id, thumbnail)
|
||||
|
||||
@util.deprecated(deprecation_text="Use set_sticker_set_thumbnail instead")
|
||||
async def set_sticker_set_thumb(self, name: str, user_id: int, thumb: Union[Any, str]=None):
|
||||
"""
|
||||
Use this method to set the thumbnail of a sticker set.
|
||||
Animated thumbnails can be set for animated sticker sets only. Returns True on success.
|
||||
|
@ -5330,7 +5496,8 @@ class AsyncTeleBot:
|
|||
:return: On success, True is returned.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
return await asyncio_helper.set_sticker_set_thumb(self.token, name, user_id, thumb)
|
||||
# deprecated
|
||||
return await self.set_sticker_set_thumbnail(name, user_id, thumb)
|
||||
|
||||
async def get_sticker_set(self, name: str) -> types.StickerSet:
|
||||
"""
|
||||
|
@ -5346,6 +5513,40 @@ class AsyncTeleBot:
|
|||
"""
|
||||
result = await asyncio_helper.get_sticker_set(self.token, name)
|
||||
return types.StickerSet.de_json(result)
|
||||
|
||||
async def set_sticker_keywords(self, sticker: str, keywords: List[str]=None) -> bool:
|
||||
"""
|
||||
Use this method to change search keywords assigned to a regular or custom emoji sticker.
|
||||
The sticker must belong to a sticker set created by the bot.
|
||||
Returns True on success.
|
||||
|
||||
:param sticker: File identifier of the sticker.
|
||||
:type sticker: :obj:`str`
|
||||
|
||||
:param keywords: A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters
|
||||
:type keywords: :obj:`list` of :obj:`str`
|
||||
|
||||
:return: On success, True is returned.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
return await asyncio_helper.set_sticker_keywords(self.token, sticker, keywords)
|
||||
|
||||
async def set_sticker_mask_position(self, sticker: str, mask_position: types.MaskPosition=None) -> bool:
|
||||
"""
|
||||
Use this method to change the mask position of a mask sticker.
|
||||
The sticker must belong to a sticker set that was created by the bot.
|
||||
Returns True on success.
|
||||
|
||||
:param sticker: File identifier of the sticker.
|
||||
:type sticker: :obj:`str`
|
||||
|
||||
:param mask_position: A JSON-serialized object for position where the mask should be placed on faces.
|
||||
:type mask_position: :class:`telebot.types.MaskPosition`
|
||||
|
||||
:return: Returns True on success.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
return await asyncio_helper.set_sticker_mask_position(self.token, sticker, mask_position)
|
||||
|
||||
async def get_custom_emoji_stickers(self, custom_emoji_ids: List[str]) -> List[types.Sticker]:
|
||||
"""
|
||||
|
@ -5361,7 +5562,7 @@ class AsyncTeleBot:
|
|||
result = await asyncio_helper.get_custom_emoji_stickers(self.token, custom_emoji_ids)
|
||||
return [types.Sticker.de_json(sticker) for sticker in result]
|
||||
|
||||
async def upload_sticker_file(self, user_id: int, png_sticker: Union[Any, str]) -> types.File:
|
||||
async def upload_sticker_file(self, user_id: int, png_sticker: Union[Any, str]=None, sticker: Optional[types.InputFile]=None, sticker_format: Optional[str]=None) -> types.File:
|
||||
"""
|
||||
Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet
|
||||
methods (can be used multiple times). Returns the uploaded File on success.
|
||||
|
@ -5371,25 +5572,105 @@ class AsyncTeleBot:
|
|||
:param user_id: User identifier of sticker set owner
|
||||
:type user_id: :obj:`int`
|
||||
|
||||
:param png_sticker: PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px,
|
||||
:param png_sticker: DEPRECATED: PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px,
|
||||
and either width or height must be exactly 512px.
|
||||
:type png_sticker: :obj:`filelike object`
|
||||
|
||||
:param sticker: A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format.
|
||||
See https://core.telegram.org/stickers for technical requirements. More information on Sending Files »
|
||||
:type sticker: :class:`telebot.types.InputFile`
|
||||
|
||||
:param sticker_format: One of "static", "animated", "video".
|
||||
:type sticker_format: :obj:`str`
|
||||
|
||||
:return: On success, the sent file is returned.
|
||||
:rtype: :class:`telebot.types.File`
|
||||
"""
|
||||
result = await asyncio_helper.upload_sticker_file(self.token, user_id, png_sticker)
|
||||
if png_sticker:
|
||||
logger.warning('The parameter "png_sticker" is deprecated. Use "sticker" instead.')
|
||||
sticker = png_sticker
|
||||
sticker_format = "static"
|
||||
|
||||
result = await asyncio_helper.upload_sticker_file(self.token, user_id, sticker, sticker_format)
|
||||
return types.File.de_json(result)
|
||||
|
||||
async def set_custom_emoji_sticker_set_thumbnail(self, name: str, custom_emoji_id: Optional[str]=None) -> bool:
|
||||
"""
|
||||
Use this method to set the thumbnail of a custom emoji sticker set.
|
||||
Returns True on success.
|
||||
|
||||
:param name: Sticker set name
|
||||
:type name: :obj:`str`
|
||||
|
||||
:param custom_emoji_id: Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.
|
||||
:type custom_emoji_id: :obj:`str`
|
||||
|
||||
:return: Returns True on success.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
return await asyncio_helper.set_custom_emoji_sticker_set_thumbnail(self.token, name, custom_emoji_id)
|
||||
|
||||
async def set_sticker_set_title(self, name: str, title: str) -> bool:
|
||||
"""
|
||||
Use this method to set the title of a created sticker set.
|
||||
Returns True on success.
|
||||
|
||||
:param name: Sticker set name
|
||||
:type name: :obj:`str`
|
||||
|
||||
:param title: New sticker set title
|
||||
:type title: :obj:`str`
|
||||
|
||||
:return: Returns True on success.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
|
||||
return await asyncio_helper.set_sticker_set_title(self.token, name, title)
|
||||
|
||||
async def delete_sticker_set(self, name:str) -> bool:
|
||||
"""
|
||||
Use this method to delete a sticker set. Returns True on success.
|
||||
|
||||
:param name: Sticker set name
|
||||
:type name: :obj:`str`
|
||||
|
||||
:return: Returns True on success.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
|
||||
return await asyncio_helper.delete_sticker_set(self.token, name)
|
||||
|
||||
|
||||
async def set_sticker_emoji_list(self, name: str, emoji_list: List[str]) -> bool:
|
||||
"""
|
||||
Use this method to set the emoji list of a sticker set.
|
||||
Returns True on success.
|
||||
|
||||
:param name: Sticker set name
|
||||
:type name: :obj:`str`
|
||||
|
||||
:param emoji_list: List of emojis
|
||||
:type emoji_list: :obj:`list` of :obj:`str`
|
||||
|
||||
:return: Returns True on success.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
|
||||
return await asyncio_helper.set_sticker_emoji_list(self.token, name, emoji_list)
|
||||
|
||||
|
||||
async def create_new_sticker_set(
|
||||
self, user_id: int, name: str, title: str,
|
||||
emojis: str,
|
||||
emojis: Optional[List[str]]=None,
|
||||
png_sticker: Union[Any, str]=None,
|
||||
tgs_sticker: Union[Any, str]=None,
|
||||
webm_sticker: Union[Any, str]=None,
|
||||
contains_masks: Optional[bool]=None,
|
||||
sticker_type: Optional[str]=None,
|
||||
mask_position: Optional[types.MaskPosition]=None) -> bool:
|
||||
mask_position: Optional[types.MaskPosition]=None,
|
||||
needs_repainting: Optional[bool]=None,
|
||||
stickers: List[types.InputSticker]=None,
|
||||
sticker_format: Optional[str]=None) -> bool:
|
||||
"""
|
||||
Use this method to create new sticker set owned by a user.
|
||||
The bot will be able to edit the created sticker set.
|
||||
|
@ -5397,6 +5678,9 @@ class AsyncTeleBot:
|
|||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#createnewstickerset
|
||||
|
||||
.. note::
|
||||
Fields *_sticker are deprecated, pass a list of stickers to stickers parameter instead.
|
||||
|
||||
:param user_id: User identifier of created sticker set owner
|
||||
:type user_id: :obj:`int`
|
||||
|
||||
|
@ -5426,37 +5710,67 @@ class AsyncTeleBot:
|
|||
use sticker_type instead.
|
||||
:type contains_masks: :obj:`bool`
|
||||
|
||||
:param sticker_type: Optional, Type of stickers in the set, pass “regular” or “mask”. Custom emoji sticker sets can't be created
|
||||
via the Bot API at the moment. By default, a regular sticker set is created.
|
||||
:param sticker_type: Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created.
|
||||
:type sticker_type: :obj:`str`
|
||||
|
||||
:param mask_position: A JSON-serialized object for position where the mask should be placed on faces
|
||||
:type mask_position: :class:`telebot.types.MaskPosition`
|
||||
|
||||
:param needs_repainting: Pass True if stickers in the sticker set must be repainted to the color of text when used in messages,
|
||||
the accent color if used as emoji status, white on chat photos, or another appropriate color based on context;
|
||||
for custom emoji sticker sets only
|
||||
:type needs_repainting: :obj:`bool`
|
||||
|
||||
:param stickers: List of stickers to be added to the set
|
||||
:type stickers: :obj:`list` of :class:`telebot.types.InputSticker`
|
||||
|
||||
:param sticker_format: Format of stickers in the set, must be one of “static”, “animated”, “video”
|
||||
:type sticker_format: :obj:`str`
|
||||
|
||||
:return: On success, True is returned.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
if tgs_sticker:
|
||||
sticker_format = 'animated'
|
||||
elif webm_sticker:
|
||||
sticker_format = 'video'
|
||||
elif png_sticker:
|
||||
sticker_format = 'static'
|
||||
|
||||
if contains_masks is not None:
|
||||
logger.warning('The parameter "contains_masks" is deprecated, use "sticker_type" instead')
|
||||
if sticker_type is None:
|
||||
sticker_type = 'mask' if contains_masks else 'regular'
|
||||
|
||||
if stickers is None:
|
||||
stickers = png_sticker or tgs_sticker or webm_sticker
|
||||
if stickers is None:
|
||||
raise ValueError('You must pass at least one sticker')
|
||||
stickers = [types.InputSticker(sticker=stickers, emoji_list=emojis, mask_position=mask_position)]
|
||||
|
||||
|
||||
|
||||
return await asyncio_helper.create_new_sticker_set(
|
||||
self.token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
||||
mask_position, webm_sticker, sticker_type)
|
||||
self.token, user_id, name, title, stickers, sticker_format, sticker_type, needs_repainting)
|
||||
|
||||
|
||||
async def add_sticker_to_set(
|
||||
self, user_id: int, name: str, emojis: str,
|
||||
self, user_id: int, name: str, emojis: Union[List[str], str]=None,
|
||||
png_sticker: Optional[Union[Any, str]]=None,
|
||||
tgs_sticker: Optional[Union[Any, str]]=None,
|
||||
webm_sticker: Optional[Union[Any, str]]=None,
|
||||
mask_position: Optional[types.MaskPosition]=None) -> bool:
|
||||
mask_position: Optional[types.MaskPosition]=None,
|
||||
sticker: Optional[List[types.InputSticker]]=None) -> bool:
|
||||
"""
|
||||
Use this method to add a new sticker to a set created by the bot.
|
||||
It's required to pass `png_sticker` or `tgs_sticker`.
|
||||
Use this method to add a new sticker to a set created by the bot.
|
||||
The format of the added sticker must match the format of the other stickers in the set.
|
||||
Emoji sticker sets can have up to 200 stickers. Animated and video sticker sets can have up to 50 stickers.
|
||||
Static sticker sets can have up to 120 stickers.
|
||||
Returns True on success.
|
||||
|
||||
.. note::
|
||||
**_sticker, mask_position, emojis parameters are deprecated, use stickers instead
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#addstickertoset
|
||||
|
||||
:param user_id: User identifier of created sticker set owner
|
||||
|
@ -5482,11 +5796,26 @@ class AsyncTeleBot:
|
|||
:param mask_position: A JSON-serialized object for position where the mask should be placed on faces
|
||||
:type mask_position: :class:`telebot.types.MaskPosition`
|
||||
|
||||
:param sticker: A JSON-serialized list of 1-50 initial stickers to be added to the sticker set
|
||||
:type sticker: :obj:`list` of :class:`telebot.types.InputSticker`
|
||||
|
||||
:return: On success, True is returned.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
# split emojis if string
|
||||
if isinstance(emojis, str):
|
||||
emojis = list(emojis)
|
||||
# Replaced the parameters png_sticker, tgs_sticker, webm_sticker, emojis and mask_position
|
||||
if sticker is None:
|
||||
old_sticker = png_sticker or tgs_sticker or webm_sticker
|
||||
if old_sticker is not None:
|
||||
logger.warning('The parameters "..._sticker", "emojis" and "mask_position" are deprecated, use "sticker" instead')
|
||||
if not old_sticker:
|
||||
raise ValueError('You must pass at least one sticker.')
|
||||
sticker = types.InputSticker(old_sticker, emojis, mask_position)
|
||||
|
||||
return await asyncio_helper.add_sticker_to_set(
|
||||
self.token, user_id, name, emojis, png_sticker, tgs_sticker, mask_position, webm_sticker)
|
||||
self.token, user_id, name, sticker)
|
||||
|
||||
|
||||
async def set_sticker_position_in_set(self, sticker: str, position: int) -> bool:
|
||||
|
|
|
@ -74,12 +74,18 @@ class StatesGroup:
|
|||
my_state = State() # returns my_state:State string.
|
||||
"""
|
||||
def __init_subclass__(cls) -> None:
|
||||
|
||||
state_list = []
|
||||
for name, value in cls.__dict__.items():
|
||||
if not name.startswith('__') and not callable(value) and isinstance(value, State):
|
||||
# change value of that variable
|
||||
value.name = ':'.join((cls.__name__, name))
|
||||
value.group = cls
|
||||
state_list.append(value)
|
||||
cls._state_list = state_list
|
||||
|
||||
@property
|
||||
def state_list(self):
|
||||
return self._state_list
|
||||
|
||||
|
||||
class SkipHandler:
|
||||
|
|
|
@ -180,11 +180,13 @@ async def get_file_url(token, file_id):
|
|||
async def download_file(token, file_path):
|
||||
if FILE_URL is None:
|
||||
url = "https://api.telegram.org/file/bot{0}/{1}".format(token, file_path)
|
||||
else: url = FILE_URL.format(token, file_path)
|
||||
else:
|
||||
# noinspection PyUnresolvedReferences
|
||||
url = FILE_URL.format(token, file_path)
|
||||
session = await session_manager.get_session()
|
||||
async with session.get(url, proxy=proxy) as response:
|
||||
if response.status != 200:
|
||||
raise ApiHTTPException('Download file', result)
|
||||
raise ApiHTTPException('Download file', response)
|
||||
result = await response.read()
|
||||
|
||||
return result
|
||||
|
@ -247,7 +249,7 @@ async def get_updates(token, offset=None, limit=None,
|
|||
params['allowed_updates'] = json.dumps(allowed_updates)
|
||||
return await _process_request(token, method_name, params=params, request_timeout=request_timeout)
|
||||
|
||||
async def _check_result(method_name, result):
|
||||
async def _check_result(method_name, result: aiohttp.ClientResponse):
|
||||
"""
|
||||
Checks whether `result` is a valid API response.
|
||||
A result is considered invalid if:
|
||||
|
@ -263,7 +265,7 @@ async def _check_result(method_name, result):
|
|||
try:
|
||||
result_json = await result.json(encoding="utf-8")
|
||||
except:
|
||||
if result.status_code != 200:
|
||||
if result.status != 200:
|
||||
raise ApiHTTPException(method_name, result)
|
||||
else:
|
||||
raise ApiInvalidJSONException(method_name, result)
|
||||
|
@ -341,15 +343,15 @@ async def get_chat_member_count(token, chat_id):
|
|||
return await _process_request(token, method_url, params=payload)
|
||||
|
||||
|
||||
async def set_sticker_set_thumb(token, name, user_id, thumb):
|
||||
method_url = r'setStickerSetThumb'
|
||||
async def set_sticker_set_thumbnail(token, name, user_id, thumbnail):
|
||||
method_url = r'setStickerSetThumbnail'
|
||||
payload = {'name': name, 'user_id': user_id}
|
||||
files = {}
|
||||
if thumb:
|
||||
if not isinstance(thumb, str):
|
||||
files['thumb'] = thumb
|
||||
if thumbnail:
|
||||
if not isinstance(thumbnail, str):
|
||||
files['thumbnail'] = thumbnail
|
||||
else:
|
||||
payload['thumb'] = thumb
|
||||
payload['thumbnail'] = thumbnail
|
||||
return await _process_request(token, method_url, params=payload, files=files or None)
|
||||
|
||||
|
||||
|
@ -660,9 +662,9 @@ async def send_chat_action(token, chat_id, action, timeout=None, message_thread_
|
|||
|
||||
|
||||
async def send_video(token, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None,
|
||||
parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None,
|
||||
thumb=None, width=None, height=None, caption_entities=None, allow_sending_without_reply=None,
|
||||
protect_content=None, message_thread_id=None, has_spoiler=None):
|
||||
parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None,
|
||||
thumbnail=None, width=None, height=None, caption_entities=None, allow_sending_without_reply=None,
|
||||
protect_content=None, message_thread_id=None, has_spoiler=None):
|
||||
method_url = r'sendVideo'
|
||||
payload = {'chat_id': chat_id}
|
||||
files = None
|
||||
|
@ -686,14 +688,14 @@ async def send_video(token, chat_id, data, duration=None, caption=None, reply_to
|
|||
payload['disable_notification'] = disable_notification
|
||||
if timeout:
|
||||
payload['timeout'] = timeout
|
||||
if thumb:
|
||||
if not util.is_string(thumb):
|
||||
if thumbnail:
|
||||
if not util.is_string(thumbnail):
|
||||
if files:
|
||||
files['thumb'] = thumb
|
||||
files['thumbnail'] = thumbnail
|
||||
else:
|
||||
files = {'thumb': thumb}
|
||||
files = {'thumbnail': thumbnail}
|
||||
else:
|
||||
payload['thumb'] = thumb
|
||||
payload['thumbnail'] = thumbnail
|
||||
if width:
|
||||
payload['width'] = width
|
||||
if height:
|
||||
|
@ -713,7 +715,7 @@ async def send_video(token, chat_id, data, duration=None, caption=None, reply_to
|
|||
|
||||
async def send_animation(
|
||||
token, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None,
|
||||
parse_mode=None, disable_notification=None, timeout=None, thumb=None, caption_entities=None,
|
||||
parse_mode=None, disable_notification=None, timeout=None, thumbnail=None, caption_entities=None,
|
||||
allow_sending_without_reply=None, width=None, height=None, protect_content=None, message_thread_id=None,
|
||||
has_spoiler=None):
|
||||
method_url = r'sendAnimation'
|
||||
|
@ -737,14 +739,14 @@ async def send_animation(
|
|||
payload['disable_notification'] = disable_notification
|
||||
if timeout:
|
||||
payload['timeout'] = timeout
|
||||
if thumb:
|
||||
if not util.is_string(thumb):
|
||||
if thumbnail:
|
||||
if not util.is_string(thumbnail):
|
||||
if files:
|
||||
files['thumb'] = thumb
|
||||
files['thumbnail'] = thumbnail
|
||||
else:
|
||||
files = {'thumb': thumb}
|
||||
files = {'thumbnail': thumbnail}
|
||||
else:
|
||||
payload['thumb'] = thumb
|
||||
payload['thumbnail'] = thumbnail
|
||||
if caption_entities:
|
||||
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
|
||||
if allow_sending_without_reply is not None:
|
||||
|
@ -798,8 +800,8 @@ async def send_voice(token, chat_id, voice, caption=None, duration=None, reply_t
|
|||
|
||||
|
||||
async def send_video_note(token, chat_id, data, duration=None, length=None, reply_to_message_id=None, reply_markup=None,
|
||||
disable_notification=None, timeout=None, thumb=None, allow_sending_without_reply=None, protect_content=None,
|
||||
message_thread_id=None):
|
||||
disable_notification=None, timeout=None, thumbnail=None, allow_sending_without_reply=None, protect_content=None,
|
||||
message_thread_id=None):
|
||||
method_url = r'sendVideoNote'
|
||||
payload = {'chat_id': chat_id}
|
||||
files = None
|
||||
|
@ -821,14 +823,14 @@ async def send_video_note(token, chat_id, data, duration=None, length=None, repl
|
|||
payload['disable_notification'] = disable_notification
|
||||
if timeout:
|
||||
payload['timeout'] = timeout
|
||||
if thumb:
|
||||
if not util.is_string(thumb):
|
||||
if thumbnail:
|
||||
if not util.is_string(thumbnail):
|
||||
if files:
|
||||
files['thumb'] = thumb
|
||||
files['thumbnail'] = thumbnail
|
||||
else:
|
||||
files = {'thumb': thumb}
|
||||
files = {'thumbnail': thumbnail}
|
||||
else:
|
||||
payload['thumb'] = thumb
|
||||
payload['thumbnail'] = thumbnail
|
||||
if allow_sending_without_reply is not None:
|
||||
payload['allow_sending_without_reply'] = allow_sending_without_reply
|
||||
if protect_content is not None:
|
||||
|
@ -839,8 +841,8 @@ async def send_video_note(token, chat_id, data, duration=None, length=None, repl
|
|||
|
||||
|
||||
async def send_audio(token, chat_id, audio, caption=None, duration=None, performer=None, title=None, reply_to_message_id=None,
|
||||
reply_markup=None, parse_mode=None, disable_notification=None, timeout=None, thumb=None,
|
||||
caption_entities=None, allow_sending_without_reply=None, protect_content=None, message_thread_id=None):
|
||||
reply_markup=None, parse_mode=None, disable_notification=None, timeout=None, thumbnail=None,
|
||||
caption_entities=None, allow_sending_without_reply=None, protect_content=None, message_thread_id=None):
|
||||
method_url = r'sendAudio'
|
||||
payload = {'chat_id': chat_id}
|
||||
files = None
|
||||
|
@ -866,14 +868,14 @@ async def send_audio(token, chat_id, audio, caption=None, duration=None, perform
|
|||
payload['disable_notification'] = disable_notification
|
||||
if timeout:
|
||||
payload['timeout'] = timeout
|
||||
if thumb:
|
||||
if not util.is_string(thumb):
|
||||
if thumbnail:
|
||||
if not util.is_string(thumbnail):
|
||||
if files:
|
||||
files['thumb'] = thumb
|
||||
files['thumbnail'] = thumbnail
|
||||
else:
|
||||
files = {'thumb': thumb}
|
||||
files = {'thumbnail': thumbnail}
|
||||
else:
|
||||
payload['thumb'] = thumb
|
||||
payload['thumbnail'] = thumbnail
|
||||
if caption_entities:
|
||||
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
|
||||
if allow_sending_without_reply is not None:
|
||||
|
@ -886,9 +888,9 @@ async def send_audio(token, chat_id, audio, caption=None, duration=None, perform
|
|||
|
||||
|
||||
async def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_markup=None, parse_mode=None,
|
||||
disable_notification=None, timeout=None, caption=None, thumb=None, caption_entities=None,
|
||||
allow_sending_without_reply=None, disable_content_type_detection=None, visible_file_name=None, protect_content=None,
|
||||
message_thread_id=None):
|
||||
disable_notification=None, timeout=None, caption=None, thumbnail=None, caption_entities=None,
|
||||
allow_sending_without_reply=None, disable_content_type_detection=None, visible_file_name=None, protect_content=None,
|
||||
message_thread_id=None, emoji=None):
|
||||
method_url = await get_method_by_type(data_type)
|
||||
payload = {'chat_id': chat_id}
|
||||
files = None
|
||||
|
@ -911,14 +913,14 @@ async def send_data(token, chat_id, data, data_type, reply_to_message_id=None, r
|
|||
payload['timeout'] = timeout
|
||||
if caption:
|
||||
payload['caption'] = caption
|
||||
if thumb:
|
||||
if not util.is_string(thumb):
|
||||
if thumbnail:
|
||||
if not util.is_string(thumbnail):
|
||||
if files:
|
||||
files['thumb'] = thumb
|
||||
files['thumbnail'] = thumbnail
|
||||
else:
|
||||
files = {'thumb': thumb}
|
||||
files = {'thumbnail': thumbnail}
|
||||
else:
|
||||
payload['thumb'] = thumb
|
||||
payload['thumbnail'] = thumbnail
|
||||
if caption_entities:
|
||||
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
|
||||
if allow_sending_without_reply is not None:
|
||||
|
@ -929,6 +931,8 @@ async def send_data(token, chat_id, data, data_type, reply_to_message_id=None, r
|
|||
payload['disable_content_type_detection'] = disable_content_type_detection
|
||||
if message_thread_id:
|
||||
payload['message_thread_id'] = message_thread_id
|
||||
if emoji:
|
||||
payload['emoji'] = emoji
|
||||
return await _process_request(token, method_url, params=payload, files=files, method='post')
|
||||
|
||||
|
||||
|
@ -966,7 +970,7 @@ async def restrict_chat_member(
|
|||
payload = {'chat_id': chat_id, 'user_id': user_id, 'permissions': permissions.to_json()}
|
||||
|
||||
if use_independent_chat_permissions is not None:
|
||||
permissions['use_independent_chat_permissions'] = use_independent_chat_permissions
|
||||
payload['use_independent_chat_permissions'] = use_independent_chat_permissions
|
||||
if until_date is not None:
|
||||
if isinstance(until_date, datetime):
|
||||
payload['until_date'] = until_date.timestamp()
|
||||
|
@ -1138,6 +1142,37 @@ async def set_chat_title(token, chat_id, title):
|
|||
payload = {'chat_id': chat_id, 'title': title}
|
||||
return await _process_request(token, method_url, params=payload, method='post')
|
||||
|
||||
async def set_my_description(token, description=None, language_code=None):
|
||||
method_url = r'setMyDescription'
|
||||
payload = {}
|
||||
if description is not None:
|
||||
payload['description'] = description
|
||||
if language_code is not None:
|
||||
payload['language_code'] = language_code
|
||||
return await _process_request(token, method_url, params=payload, method='post')
|
||||
|
||||
async def get_my_description(token, language_code=None):
|
||||
method_url = r'getMyDescription'
|
||||
payload = {}
|
||||
if language_code:
|
||||
payload['language_code'] = language_code
|
||||
return await _process_request(token, method_url, params=payload)
|
||||
|
||||
async def set_my_short_description(token, short_description=None, language_code=None):
|
||||
method_url = r'setMyShortDescription'
|
||||
payload = {}
|
||||
if short_description is not None:
|
||||
payload['short_description'] = short_description
|
||||
if language_code is not None:
|
||||
payload['language_code'] = language_code
|
||||
return await _process_request(token, method_url, params=payload, method='post')
|
||||
|
||||
async def get_my_short_description(token, language_code=None):
|
||||
method_url = r'getMyShortDescription'
|
||||
payload = {}
|
||||
if language_code:
|
||||
payload['language_code'] = language_code
|
||||
return await _process_request(token, method_url, params=payload)
|
||||
|
||||
async def get_my_commands(token, scope=None, language_code=None):
|
||||
method_url = r'getMyCommands'
|
||||
|
@ -1148,6 +1183,23 @@ async def get_my_commands(token, scope=None, language_code=None):
|
|||
payload['language_code'] = language_code
|
||||
return await _process_request(token, method_url, params=payload)
|
||||
|
||||
|
||||
async def set_my_name(token, name=None, language_code=None):
|
||||
method_url = r'setMyName'
|
||||
payload = {}
|
||||
if name is not None:
|
||||
payload['name'] = name
|
||||
if language_code is not None:
|
||||
payload['language_code'] = language_code
|
||||
return await _process_request(token, method_url, params=payload, method='post')
|
||||
|
||||
async def get_my_name(token, language_code=None):
|
||||
method_url = r'getMyName'
|
||||
payload = {}
|
||||
if language_code is not None:
|
||||
payload['language_code'] = language_code
|
||||
return await _process_request(token, method_url, params=payload)
|
||||
|
||||
async def set_chat_menu_button(token, chat_id=None, menu_button=None):
|
||||
method_url = r'setChatMenuButton'
|
||||
payload = {}
|
||||
|
@ -1400,8 +1452,8 @@ async def send_invoice(
|
|||
need_name=None, need_phone_number=None, need_email=None, need_shipping_address=None,
|
||||
send_phone_number_to_provider = None, send_email_to_provider = None, is_flexible=None,
|
||||
disable_notification=None, reply_to_message_id=None, reply_markup=None, provider_data=None,
|
||||
timeout=None, allow_sending_without_reply=None, max_tip_amount=None, suggested_tip_amounts=None, protect_content=None,
|
||||
message_thread_id=None):
|
||||
timeout=None, allow_sending_without_reply=None, max_tip_amount=None, suggested_tip_amounts=None,
|
||||
protect_content=None, message_thread_id=None):
|
||||
"""
|
||||
Use this method to send invoices. On success, the sent Message is returned.
|
||||
:param token: Bot's token (you don't need to fill this)
|
||||
|
@ -1433,7 +1485,8 @@ async def send_invoice(
|
|||
:param max_tip_amount: The maximum accepted amount for tips in the smallest units of the currency
|
||||
:param suggested_tip_amounts: A JSON-serialized array of suggested amounts of tips in the smallest units of the currency.
|
||||
At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
|
||||
:param protect_content:
|
||||
:param protect_content: Protects the contents of the sent message from forwarding and saving
|
||||
:param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
|
||||
:return:
|
||||
"""
|
||||
method_url = r'sendInvoice'
|
||||
|
@ -1551,7 +1604,7 @@ async def answer_callback_query(token, callback_query_id, text=None, show_alert=
|
|||
|
||||
|
||||
async def answer_inline_query(token, inline_query_id, results, cache_time=None, is_personal=None, next_offset=None,
|
||||
switch_pm_text=None, switch_pm_parameter=None):
|
||||
button=None):
|
||||
method_url = 'answerInlineQuery'
|
||||
payload = {'inline_query_id': inline_query_id, 'results': await _convert_list_json_serializable(results)}
|
||||
if cache_time is not None:
|
||||
|
@ -1560,10 +1613,10 @@ async def answer_inline_query(token, inline_query_id, results, cache_time=None,
|
|||
payload['is_personal'] = is_personal
|
||||
if next_offset is not None:
|
||||
payload['next_offset'] = next_offset
|
||||
if switch_pm_text:
|
||||
payload['switch_pm_text'] = switch_pm_text
|
||||
if switch_pm_parameter:
|
||||
payload['switch_pm_parameter'] = switch_pm_parameter
|
||||
if button is not None:
|
||||
payload["button"] = button.to_json()
|
||||
|
||||
|
||||
return await _process_request(token, method_url, params=payload, method='post')
|
||||
|
||||
|
||||
|
@ -1573,62 +1626,85 @@ async def get_sticker_set(token, name):
|
|||
|
||||
async def get_custom_emoji_stickers(token, custom_emoji_ids):
|
||||
method_url = r'getCustomEmojiStickers'
|
||||
return await _process_request(token, method_url, params={'custom_emoji_ids': custom_emoji_ids})
|
||||
return await _process_request(token, method_url, params={'custom_emoji_ids': json.dumps(custom_emoji_ids)})
|
||||
|
||||
async def upload_sticker_file(token, user_id, png_sticker):
|
||||
async def set_sticker_keywords(token, sticker, keywords=None):
|
||||
method_url = 'setStickerKeywords'
|
||||
payload = {'sticker': sticker}
|
||||
if keywords:
|
||||
payload['keywords'] = json.dumps(keywords)
|
||||
|
||||
return await _process_request(token, method_url, params=payload, method='post')
|
||||
|
||||
async def set_sticker_mask_position(token, sticker, mask_position=None):
|
||||
method_url = 'setStickerMaskPosition'
|
||||
payload = {'sticker': sticker}
|
||||
if mask_position:
|
||||
payload['mask_position'] = mask_position.to_json()
|
||||
return await _process_request(token, method_url, params=payload, method='post')
|
||||
|
||||
async def upload_sticker_file(token, user_id, sticker, sticker_format):
|
||||
method_url = 'uploadStickerFile'
|
||||
payload = {'user_id': user_id}
|
||||
files = {'png_sticker': png_sticker}
|
||||
payload = {'user_id': user_id, 'sticker_format': sticker_format}
|
||||
files = {'sticker': sticker}
|
||||
return await _process_request(token, method_url, params=payload, files=files, method='post')
|
||||
|
||||
async def set_sticker_emoji_list(token, sticker, emoji_list):
|
||||
method_url = 'setStickerEmojiList'
|
||||
payload = {'sticker': sticker, 'emoji_list': json.dumps(emoji_list)}
|
||||
return await _process_request(token, method_url, params=payload, method='post')
|
||||
|
||||
async def delete_sticker_set(token, name):
|
||||
method_url = 'deleteStickerSet'
|
||||
payload = {'name': name}
|
||||
return await _process_request(token, method_url, params=payload, method='post')
|
||||
|
||||
async def set_custom_emoji_sticker_set_thumbnail(token, name, custom_emoji_id=None):
|
||||
method_url = 'setCustomEmojiStickerSetThumbnail'
|
||||
payload = {'name': name}
|
||||
if custom_emoji_id is not None:
|
||||
payload['custom_emoji_id'] = custom_emoji_id
|
||||
return await _process_request(token, method_url, params=payload, method='post')
|
||||
|
||||
|
||||
async def set_sticker_set_title(token, name, title):
|
||||
method_url = 'setStickerSetTitle'
|
||||
payload = {'name': name, 'title': title}
|
||||
return await _process_request(token, method_url, params=payload, method='post')
|
||||
|
||||
async def create_new_sticker_set(
|
||||
token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
||||
mask_position=None, webm_sticker=None, sticker_type=None):
|
||||
token, user_id, name, title, stickers, sticker_format, sticker_type=None, needs_repainting=None):
|
||||
method_url = 'createNewStickerSet'
|
||||
payload = {'user_id': user_id, 'name': name, 'title': title, 'emojis': emojis}
|
||||
if png_sticker:
|
||||
stype = 'png_sticker'
|
||||
elif webm_sticker:
|
||||
stype = 'webm_sticker'
|
||||
else:
|
||||
stype = 'tgs_sticker'
|
||||
sticker = png_sticker or tgs_sticker or webm_sticker
|
||||
files = None
|
||||
if not util.is_string(sticker):
|
||||
files = {stype: sticker}
|
||||
else:
|
||||
payload[stype] = sticker
|
||||
if mask_position:
|
||||
payload['mask_position'] = mask_position.to_json()
|
||||
if webm_sticker:
|
||||
payload['webm_sticker'] = webm_sticker
|
||||
payload = {'user_id': user_id, 'name': name, 'title': title, 'sticker_format': sticker_format}
|
||||
if sticker_type:
|
||||
payload['sticker_type'] = sticker_type
|
||||
if needs_repainting:
|
||||
payload['needs_repainting'] = needs_repainting
|
||||
|
||||
files = {}
|
||||
lst = []
|
||||
|
||||
for sticker in stickers:
|
||||
json_dict, file = sticker.convert_input_sticker()
|
||||
json_dict = sticker.to_dict()
|
||||
|
||||
if file:
|
||||
list_keys = list(file.keys())
|
||||
files[list_keys[0]] = file[list_keys[0]]
|
||||
lst.append(json_dict)
|
||||
|
||||
payload['stickers'] = json.dumps(lst)
|
||||
|
||||
|
||||
return await _process_request(token, method_url, params=payload, files=files, method='post')
|
||||
|
||||
|
||||
async def add_sticker_to_set(token, user_id, name, emojis, png_sticker, tgs_sticker, mask_position, webm_sticker):
|
||||
async def add_sticker_to_set(token, user_id, name, sticker):
|
||||
method_url = 'addStickerToSet'
|
||||
payload = {'user_id': user_id, 'name': name, 'emojis': emojis}
|
||||
if png_sticker:
|
||||
stype = 'png_sticker'
|
||||
elif webm_sticker:
|
||||
stype = 'webm_sticker'
|
||||
else:
|
||||
stype = 'tgs_sticker'
|
||||
files = None
|
||||
sticker = png_sticker or tgs_sticker or webm_sticker
|
||||
json_dict, files = sticker.convert_input_sticker()
|
||||
payload = {'user_id': user_id, 'name': name, 'sticker': json_dict}
|
||||
|
||||
|
||||
if not util.is_string(sticker):
|
||||
files = {stype: sticker}
|
||||
else:
|
||||
payload[stype] = sticker
|
||||
if mask_position:
|
||||
payload['mask_position'] = mask_position.to_json()
|
||||
|
||||
if webm_sticker:
|
||||
payload['webm_sticker'] = webm_sticker
|
||||
return await _process_request(token, method_url, params=payload, files=files, method='post')
|
||||
|
||||
|
||||
|
@ -1898,10 +1974,10 @@ class ApiHTTPException(ApiException):
|
|||
This class represents an Exception thrown when a call to the
|
||||
Telegram API server returns HTTP code that is not 200.
|
||||
"""
|
||||
def __init__(self, function_name, result):
|
||||
def __init__(self, function_name, result: aiohttp.ClientResponse):
|
||||
super(ApiHTTPException, self).__init__(
|
||||
"The server returned HTTP {0} {1}. Response body:\n[{2}]" \
|
||||
.format(result.status_code, result.reason, result),
|
||||
.format(result.status, result.reason, result.request_info),
|
||||
function_name,
|
||||
result)
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
from telebot.asyncio_storage.base_storage import StateStorageBase, StateContext
|
||||
import json
|
||||
|
||||
|
||||
redis_installed = True
|
||||
is_actual_aioredis = False
|
||||
try:
|
||||
import aioredis
|
||||
is_actual_aioredis = True
|
||||
except ImportError:
|
||||
try:
|
||||
from redis import asyncio as aioredis
|
||||
|
@ -23,10 +24,10 @@ class StateRedisStorage(StateStorageBase):
|
|||
if not redis_installed:
|
||||
raise ImportError('AioRedis is not installed. Install it via "pip install aioredis"')
|
||||
|
||||
|
||||
aioredis_version = tuple(map(int, aioredis.__version__.split(".")[0]))
|
||||
if aioredis_version < (2,):
|
||||
raise ImportError('Invalid aioredis version. Aioredis version should be >= 2.0.0')
|
||||
if is_actual_aioredis:
|
||||
aioredis_version = tuple(map(int, aioredis.__version__.split(".")[0]))
|
||||
if aioredis_version < (2,):
|
||||
raise ImportError('Invalid aioredis version. Aioredis version should be >= 2.0.0')
|
||||
self.redis = aioredis.Redis(host=host, port=port, db=db, password=password)
|
||||
|
||||
self.prefix = prefix
|
||||
|
@ -170,6 +171,6 @@ class StateRedisStorage(StateStorageBase):
|
|||
user_id = str(user_id)
|
||||
if response:
|
||||
if user_id in response:
|
||||
response[user_id]['data'] = dict(data, **response[user_id]['data'])
|
||||
response[user_id]['data'] = data
|
||||
await self.set_record(chat_id, response)
|
||||
return True
|
||||
|
|
|
@ -61,8 +61,8 @@ def escape_markdown(content: str) -> str:
|
|||
:rtype: :obj:`str`
|
||||
"""
|
||||
|
||||
parse = re.sub(r"([_*\[\]()~`>\#\+\-=|\.!\{\}])", r"\\\1", content)
|
||||
reparse = re.sub(r"\\\\([_*\[\]()~`>\#\+\-=|\.!\{\}])", r"\1", parse)
|
||||
parse = re.sub(r"([_*\[\]()~`>\#\+\-=|\.!\{\}\\])", r"\\\1", content)
|
||||
reparse = re.sub(r"\\\\([_*\[\]()~`>\#\+\-=|\.!\{\}\\])", r"\1", parse)
|
||||
return reparse
|
||||
|
||||
|
||||
|
|
|
@ -185,13 +185,20 @@ class StatesGroup:
|
|||
my_state = State() # returns my_state:State string.
|
||||
"""
|
||||
def __init_subclass__(cls) -> None:
|
||||
state_list = []
|
||||
for name, value in cls.__dict__.items():
|
||||
if not name.startswith('__') and not callable(value) and isinstance(value, State):
|
||||
# change value of that variable
|
||||
value.name = ':'.join((cls.__name__, name))
|
||||
value.group = cls
|
||||
state_list.append(value)
|
||||
cls._state_list = state_list
|
||||
|
||||
@property
|
||||
def state_list(self):
|
||||
return self._state_list
|
||||
|
||||
|
||||
|
||||
class BaseMiddleware:
|
||||
"""
|
||||
Base class for middleware.
|
||||
|
|
|
@ -174,7 +174,7 @@ class StateRedisStorage(StateStorageBase):
|
|||
user_id = str(user_id)
|
||||
if response:
|
||||
if user_id in response:
|
||||
response[user_id]['data'] = dict(data, **response[user_id]['data'])
|
||||
response[user_id]['data'] = data
|
||||
self.set_record(chat_id, response)
|
||||
return True
|
||||
|
||||
|
|
867
telebot/types.py
867
telebot/types.py
File diff suppressed because it is too large
Load Diff
|
@ -35,11 +35,10 @@ content_type_media = [
|
|||
#: Contains all service content types such as `User joined the group`.
|
||||
content_type_service = [
|
||||
'new_chat_members', 'left_chat_member', 'new_chat_title', 'new_chat_photo', 'delete_chat_photo',
|
||||
'group_chat_created',
|
||||
'supergroup_chat_created', 'channel_chat_created', 'migrate_to_chat_id', 'migrate_from_chat_id', 'pinned_message',
|
||||
'proximity_alert_triggered', 'video_chat_scheduled', 'video_chat_started', 'video_chat_ended',
|
||||
'video_chat_participants_invited', 'message_auto_delete_timer_changed', 'forum_topic_created', 'forum_topic_closed',
|
||||
'forum_topic_reopened',
|
||||
'group_chat_created', 'supergroup_chat_created', 'channel_chat_created', 'migrate_to_chat_id',
|
||||
'migrate_from_chat_id', 'pinned_message', 'proximity_alert_triggered', 'video_chat_scheduled', 'video_chat_started',
|
||||
'video_chat_ended', 'video_chat_participants_invited', 'message_auto_delete_timer_changed', 'forum_topic_created',
|
||||
'forum_topic_closed', 'forum_topic_reopened', 'user_shared', 'chat_shared',
|
||||
]
|
||||
|
||||
#: All update types, should be used for allowed_updates parameter in polling.
|
||||
|
@ -274,6 +273,39 @@ def extract_arguments(text: str) -> str or None:
|
|||
result = regexp.match(text)
|
||||
return result.group(2) if is_command(text) else None
|
||||
|
||||
def extract_entity(text: str, e: types.MessageEntity) -> str:
|
||||
"""
|
||||
Returns the content of the entity.
|
||||
|
||||
:param text: The text of the message the entity belongs to
|
||||
:type text: :obj:`str`
|
||||
|
||||
:param e: The entity to extract
|
||||
:type e: :obj:`MessageEntity`
|
||||
|
||||
:return: The content of the entity
|
||||
:rtype: :obj:`str`
|
||||
"""
|
||||
offset = 0
|
||||
start = 0
|
||||
encoded_text = text.encode()
|
||||
end = len(encoded_text)
|
||||
i = 0
|
||||
|
||||
for byte in encoded_text:
|
||||
if (byte & 0xc0) != 0x80:
|
||||
if offset == e.offset:
|
||||
start = i
|
||||
elif offset - e.offset == e.length:
|
||||
end = i
|
||||
break
|
||||
if byte >= 0xf0:
|
||||
offset += 2
|
||||
else:
|
||||
offset += 1
|
||||
i += 1
|
||||
|
||||
return encoded_text[start:end].decode()
|
||||
|
||||
def split_string(text: str, chars_per_string: int) -> List[str]:
|
||||
"""
|
||||
|
@ -388,11 +420,13 @@ def quick_markup(values: Dict[str, Dict[str, Any]], row_width: int = 2) -> types
|
|||
.. code-block:: python3
|
||||
:caption: Using quick_markup:
|
||||
|
||||
quick_markup({
|
||||
from telebot.util import quick_markup
|
||||
|
||||
markup = quick_markup({
|
||||
'Twitter': {'url': 'https://twitter.com'},
|
||||
'Facebook': {'url': 'https://facebook.com'},
|
||||
'Back': {'callback_data': 'whatever'}
|
||||
}, row_width=2):
|
||||
}, row_width=2)
|
||||
# returns an InlineKeyboardMarkup with two buttons in a row, one leading to Twitter, the other to facebook
|
||||
# and a back button below
|
||||
|
||||
|
@ -411,7 +445,7 @@ def quick_markup(values: Dict[str, Dict[str, Any]], row_width: int = 2) -> types
|
|||
:param values: a dict containing all buttons to create in this format: {text: kwargs} {str:}
|
||||
:type values: :obj:`dict`
|
||||
|
||||
:param row_width: int row width
|
||||
:param row_width: number of :class:`telebot.types.InlineKeyboardButton` objects on each row
|
||||
:type row_width: :obj:`int`
|
||||
|
||||
:return: InlineKeyboardMarkup
|
||||
|
@ -556,7 +590,7 @@ def webhook_google_functions(bot, request):
|
|||
return 'Bot ON'
|
||||
|
||||
|
||||
def antiflood(function: Callable, *args, **kwargs):
|
||||
def antiflood(function: Callable, *args, number_retries=5, **kwargs):
|
||||
"""
|
||||
Use this function inside loops in order to avoid getting TooManyRequests error.
|
||||
Example:
|
||||
|
@ -570,6 +604,9 @@ def antiflood(function: Callable, *args, **kwargs):
|
|||
:param function: The function to call
|
||||
:type function: :obj:`Callable`
|
||||
|
||||
:param number_retries: Number of retries to send
|
||||
:type function: :obj:int
|
||||
|
||||
:param args: The arguments to pass to the function
|
||||
:type args: :obj:`tuple`
|
||||
|
||||
|
@ -581,14 +618,16 @@ def antiflood(function: Callable, *args, **kwargs):
|
|||
from telebot.apihelper import ApiTelegramException
|
||||
from time import sleep
|
||||
|
||||
try:
|
||||
return function(*args, **kwargs)
|
||||
except ApiTelegramException as ex:
|
||||
if ex.error_code == 429:
|
||||
sleep(ex.result_json['parameters']['retry_after'])
|
||||
for _ in range(number_retries - 1):
|
||||
try:
|
||||
return function(*args, **kwargs)
|
||||
else:
|
||||
raise
|
||||
except ApiTelegramException as ex:
|
||||
if ex.error_code == 429:
|
||||
sleep(ex.result_json['parameters']['retry_after'])
|
||||
else:
|
||||
raise
|
||||
else:
|
||||
return function(*args, **kwargs)
|
||||
|
||||
|
||||
def parse_web_app_data(token: str, raw_init_data: str):
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Versions should comply with PEP440.
|
||||
# This line is parsed in setup.py:
|
||||
__version__ = '4.10.0'
|
||||
__version__ = '4.12.0'
|
||||
|
|
|
@ -470,6 +470,53 @@ class TestTeleBot:
|
|||
for i in range(0,200):
|
||||
util.antiflood(tb.send_message, CHAT_ID, text)
|
||||
assert i == 199
|
||||
|
||||
def test_extract_entity(self):
|
||||
entities_map = {"https://core.telegram.org/api/entities": "https://core.telegram.org/api/entities",
|
||||
"https://github.com/eternnoir/pyTelegramBotAPI": "https://github.com/eternnoir/pyTelegramBotAPI",
|
||||
"*粗 bold text体*": "粗 bold text体",
|
||||
"_斜体 italic text_": "斜体 italic text",
|
||||
"[谷歌](http://www.google.com/)": "谷歌",
|
||||
'`std::cout<<"test"<<std::endl;`': 'std::cout<<"test"<<std::endl;',
|
||||
'''```rust
|
||||
let number = loop {
|
||||
println!("Pick a pattern from 0-2:");
|
||||
stdin.read_line(&mut option).unwrap();
|
||||
match option.lines().next().unwrap().parse::<usize>() {
|
||||
Ok(number @ 0..=2) => break number,
|
||||
_ => {
|
||||
println!("invalid input!");
|
||||
option = String::new();
|
||||
continue;
|
||||
}
|
||||
};
|
||||
};```''': '''let number = loop {
|
||||
println!("Pick a pattern from 0-2:");
|
||||
stdin.read_line(&mut option).unwrap();
|
||||
match option.lines().next().unwrap().parse::<usize>() {
|
||||
Ok(number @ 0..=2) => break number,
|
||||
_ => {
|
||||
println!("invalid input!");
|
||||
option = String::new();
|
||||
continue;
|
||||
}
|
||||
};
|
||||
};''',
|
||||
"@username": "@username",
|
||||
"#hashtag索引标签": "#hashtag索引标签",
|
||||
"do-not-reply@telegram.org": "do-not-reply@telegram.org",
|
||||
"+12125550123": "+12125550123"}
|
||||
entites = list(entities_map.keys())
|
||||
contents = list(entities_map.values())
|
||||
contents.sort()
|
||||
text = '\n'.join(entites)
|
||||
|
||||
bot = telebot.TeleBot(TOKEN)
|
||||
message = bot.send_message(CHAT_ID, text, parse_mode="Markdown")
|
||||
extracted_contents = [util.extract_entity(
|
||||
message.text, e) for e in message.entities]
|
||||
extracted_contents.sort()
|
||||
assert contents == extracted_contents
|
||||
|
||||
@staticmethod
|
||||
def create_text_message(text):
|
||||
|
|
|
@ -67,9 +67,9 @@ def test_json_GroupChat():
|
|||
|
||||
|
||||
def test_json_Document():
|
||||
json_string = r'{"file_name":"Text File","thumb":{},"file_id":"BQADBQADMwIAAsYifgZ_CEh0u682xwI","file_unique_id": "AgADJQEAAqfhOEY","file_size":446}'
|
||||
json_string = r'{"file_name":"Text File","thumbnail":{},"file_id":"BQADBQADMwIAAsYifgZ_CEh0u682xwI","file_unique_id": "AgADJQEAAqfhOEY","file_size":446}'
|
||||
doc = types.Document.de_json(json_string)
|
||||
assert doc.thumb is None
|
||||
assert doc.thumbnail is None
|
||||
assert doc.file_name == 'Text File'
|
||||
|
||||
|
||||
|
@ -83,23 +83,23 @@ def test_json_Message_Audio():
|
|||
|
||||
|
||||
def test_json_Message_Sticker():
|
||||
json_string = r'{"message_id": 21552, "from": {"id": 590740002, "is_bot": false, "first_name": "⚜️ Ƥυrуα ⚜️", "username": "Purya", "language_code": "en"}, "chat": {"id": -1001309982000, "title": "123", "type": "supergroup"}, "date": 1594068909, "sticker": {"type": "regular", "width": 368, "height": 368, "emoji": "🤖", "set_name": "ipuryapack", "is_animated": false, "is_video": true, "thumb": {"file_id": "AAMCBAADHQJOFL7mAAJUMF8Dj62hpmDhpRAYvkc8CtIqipolAAJ8AAPA-8cF9yxjgjkLS97A0D4iXQARtQAHbQADHy4AAhoE", "file_unique_id": "AQADwNA-Il0AAx8uAAI", "file_size": 7776, "width": 60, "height": 60}, "file_id": "CAACAgQAAx0CThS-5gACVDBfA4-toaZg4aUQGL5HWerSKoqaJQACArADwPvHBfcsY4I5C3feGgQ", "file_unique_id": "AgADfAADsPvHWQ", "file_size": 14602}}'
|
||||
json_string = r'{"message_id": 21552, "from": {"id": 590740002, "is_bot": false, "first_name": "⚜️ Ƥυrуα ⚜️", "username": "Purya", "language_code": "en"}, "chat": {"id": -1001309982000, "title": "123", "type": "supergroup"}, "date": 1594068909, "sticker": {"type": "regular", "width": 368, "height": 368, "emoji": "🤖", "set_name": "ipuryapack", "is_animated": false, "is_video": true, "thumbnail": {"file_id": "AAMCBAADHQJOFL7mAAJUMF8Dj62hpmDhpRAYvkc8CtIqipolAAJ8AAPA-8cF9yxjgjkLS97A0D4iXQARtQAHbQADHy4AAhoE", "file_unique_id": "AQADwNA-Il0AAx8uAAI", "file_size": 7776, "width": 60, "height": 60}, "file_id": "CAACAgQAAx0CThS-5gACVDBfA4-toaZg4aUQGL5HWerSKoqaJQACArADwPvHBfcsY4I5C3feGgQ", "file_unique_id": "AgADfAADsPvHWQ", "file_size": 14602}}'
|
||||
msg = types.Message.de_json(json_string)
|
||||
assert msg.sticker.height == 368
|
||||
assert msg.sticker.thumb.height == 60
|
||||
assert msg.sticker.thumbnail.height == 60
|
||||
assert msg.content_type == 'sticker'
|
||||
|
||||
|
||||
def test_json_Message_Sticker_without_thumb():
|
||||
def test_json_Message_Sticker_without_thumbnail():
|
||||
json_string = r'{"message_id": 21552, "from": {"id": 590740002, "is_bot": false, "first_name": "⚜️ Ƥυrуα ⚜️", "username": "Purya", "language_code": "en"}, "chat": {"id": -1001309982000, "title": "123", "type": "supergroup"}, "date": 1594068909, "sticker": {"type": "regular", "width": 368, "height": 368, "emoji": "🤖", "set_name": "ipuryapack", "is_animated": false, "is_video": true, "file_id": "CAACAgQAAx0CThS-5gACVDBfA4-toaZg4aUQGL5HWerSKoqaJQACArADwPvHBfcsY4I5C3feGgQ", "file_unique_id": "AgADfAADsPvHWQ", "file_size": 14602}}'
|
||||
msg = types.Message.de_json(json_string)
|
||||
assert msg.sticker.height == 368
|
||||
assert msg.sticker.thumb is None
|
||||
assert msg.sticker.thumbnail is None
|
||||
assert msg.content_type == 'sticker'
|
||||
|
||||
|
||||
def test_json_Message_Document():
|
||||
json_string = r'{"message_id":97,"from":{"id":10734,"first_name":"Fd","last_name":"Wd","username":"dd","is_bot":true },"chat":{"id":10,"first_name":"Fd","type":"private","last_name":"Wd","username":"dd"},"date":1435478744,"document":{"file_name":"Text File","thumb":{},"file_id":"BQADBQADMwIAAsYifgZ_CEh0u682xwI","file_unique_id": "AQAD_QIfa3QAAyA4BgAB","file_size":446}}'
|
||||
json_string = r'{"message_id":97,"from":{"id":10734,"first_name":"Fd","last_name":"Wd","username":"dd","is_bot":true },"chat":{"id":10,"first_name":"Fd","type":"private","last_name":"Wd","username":"dd"},"date":1435478744,"document":{"file_name":"Text File","thumbnail":{},"file_id":"BQADBQADMwIAAsYifgZ_CEh0u682xwI","file_unique_id": "AQAD_QIfa3QAAyA4BgAB","file_size":446}}'
|
||||
msg = types.Message.de_json(json_string)
|
||||
assert msg.document.file_name == 'Text File'
|
||||
assert msg.content_type == 'document'
|
||||
|
@ -113,11 +113,11 @@ def test_json_Message_Photo():
|
|||
|
||||
|
||||
def test_json_Message_Video():
|
||||
json_string = r'{"message_id":101,"from":{"id":109734,"first_name":"dd","last_name":"dd","username":"dd","is_bot":true },"chat":{"id":109734,"first_name":"dd","type":"private","last_name":"dd","username":"dd"},"date":1435481960,"video":{"duration":3,"caption":"","width":360,"height":640,"thumb":{"file_id":"AAQFABPiYnBjkDwMAAIC","file_unique_id": "AQADTeisa3QAAz1nAAI","file_size":1597,"width":50,"height":90},"file_id":"BAADBQADNifgb_TOPEKErGoQI","file_unique_id": "AgADbgEAAn8VSFY","file_size":260699}}'
|
||||
json_string = r'{"message_id":101,"from":{"id":109734,"first_name":"dd","last_name":"dd","username":"dd","is_bot":true },"chat":{"id":109734,"first_name":"dd","type":"private","last_name":"dd","username":"dd"},"date":1435481960,"video":{"duration":3,"caption":"","width":360,"height":640,"thumbnail":{"file_id":"AAQFABPiYnBjkDwMAAIC","file_unique_id": "AQADTeisa3QAAz1nAAI","file_size":1597,"width":50,"height":90},"file_id":"BAADBQADNifgb_TOPEKErGoQI","file_unique_id": "AgADbgEAAn8VSFY","file_size":260699}}'
|
||||
msg = types.Message.de_json(json_string)
|
||||
assert msg.video
|
||||
assert msg.video.duration == 3
|
||||
assert msg.video.thumb.width == 50
|
||||
assert msg.video.thumbnail.width == 50
|
||||
assert msg.content_type == 'video'
|
||||
|
||||
|
||||
|
@ -271,5 +271,33 @@ def test_sent_web_app_message():
|
|||
assert sent_web_app_message.inline_message_id == '29430'
|
||||
|
||||
|
||||
def test_message_entity():
|
||||
# TODO: Add support for nesting entities
|
||||
|
||||
|
||||
sample_string_1 = r'{"update_id":934522126,"message":{"message_id":1374510,"from":{"id":927266710,"is_bot":false,"first_name":">_run","username":"coder2020","language_code":"en","is_premium":true},"chat":{"id":927266710,"first_name":">_run","username":"coder2020","type":"private"},"date":1682177590,"text":"b b b","entities":[{"offset":0,"length":2,"type":"bold"},{"offset":0,"length":1,"type":"italic"},{"offset":2,"length":2,"type":"bold"},{"offset":2,"length":1,"type":"italic"},{"offset":4,"length":1,"type":"bold"},{"offset":4,"length":1,"type":"italic"}]}}'
|
||||
update = types.Update.de_json(sample_string_1)
|
||||
message: types.Message = update.message
|
||||
assert message.html_text == "<i><b>b </b></i><i><b>b </b></i><i><b>b</b></i>"
|
||||
|
||||
sample_string_2 = r'{"update_id":934522166,"message":{"message_id":1374526,"from":{"id":927266710,"is_bot":false,"first_name":">_run","username":"coder2020","language_code":"en","is_premium":true},"chat":{"id":927266710,"first_name":">_run","username":"coder2020","type":"private"},"date":1682179716,"text":"b b b","entities":[{"offset":0,"length":1,"type":"bold"},{"offset":2,"length":1,"type":"bold"},{"offset":4,"length":1,"type":"italic"}]}}'
|
||||
message_2 = types.Update.de_json(sample_string_2).message
|
||||
assert message_2.html_text == "<b>b</b> <b>b</b> <i>b</i>"
|
||||
|
||||
|
||||
|
||||
sample_string_3 = r'{"update_id":934522172,"message":{"message_id":1374530,"from":{"id":927266710,"is_bot":false,"first_name":">_run","username":"coder2020","language_code":"en","is_premium":true},"chat":{"id":927266710,"first_name":">_run","username":"coder2020","type":"private"},"date":1682179968,"text":"This is a bold text with a nested italic and bold text.","entities":[{"offset":10,"length":4,"type":"bold"},{"offset":27,"length":7,"type":"italic"},{"offset":34,"length":15,"type":"bold"},{"offset":34,"length":15,"type":"italic"}]}}'
|
||||
message_3 = types.Update.de_json(sample_string_3).message
|
||||
assert message_3.html_text == "This is a <b>bold</b> text with a <i>nested </i><i><b>italic and bold</b></i> text."
|
||||
|
||||
|
||||
sample_string_4 = r'{"update_id":934522437,"message":{"message_id":1374619,"from":{"id":927266710,"is_bot":false,"first_name":">_run","username":"coder2020","language_code":"en","is_premium":true},"chat":{"id":927266710,"first_name":">_run","username":"coder2020","type":"private"},"date":1682189507,"forward_from":{"id":927266710,"is_bot":false,"first_name":">_run","username":"coder2020","language_code":"en","is_premium":true},"forward_date":1682189124,"text":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa😋😋","entities":[{"offset":0,"length":76,"type":"bold"},{"offset":0,"length":76,"type":"italic"},{"offset":0,"length":76,"type":"underline"},{"offset":0,"length":76,"type":"strikethrough"},{"offset":76,"length":2,"type":"custom_emoji","custom_emoji_id":"5456188142006575553"},{"offset":78,"length":2,"type":"custom_emoji","custom_emoji_id":"5456188142006575553"}]}}'
|
||||
message_4 = types.Update.de_json(sample_string_4).message
|
||||
assert message_4.html_text == '<s><u><i><b>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</b></i></u></s><tg-emoji emoji-id="5456188142006575553">😋</tg-emoji><tg-emoji emoji-id="5456188142006575553">😋</tg-emoji>'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue