1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Compare commits

..

1052 Commits

Author SHA1 Message Date
92907ced30 Merge pull request #1966 from Badiboy/master
Bump version to 4.11.0
2023-04-15 22:40:59 +03:00
1b2ed0e2f7 Bump version to 4.11.0 2023-04-15 22:39:14 +03:00
370f0370c7 Merge pull request #1964 from Cub11k/add_state_list
Add state_list to StatesGroup
2023-04-15 01:53:00 +05:00
e4bddd91cb Define state_list in __init_subclass__ 2023-04-14 22:11:08 +03:00
d466da3542 Add state_list to StatesGroup 2023-04-14 22:00:42 +03:00
e64c06b7bc Merge pull request #1951 from mikelei8291/doc-fix
Fix documentation for `InlineKeyboardMarkup` and `quick_markup`
2023-04-03 19:10:10 +03:00
7d168ebbd8 Merge pull request #1961 from fcoagz/patch-2
Update README.md
2023-04-03 18:56:38 +03:00
c5689f383b edit 2023-04-03 11:49:21 -04:00
8796168efb Update README.md 2023-04-03 11:27:15 -04:00
100659fecd Merge pull request #1958 from coder2020official/master
Fix storage not saving data sometimes
2023-04-03 01:01:11 +05:00
7bf87a306a Update redis_storage.py 2023-04-03 01:00:48 +05:00
351d021e01 Update redis_storage.py 2023-04-03 01:00:29 +05:00
4ffe0f8833 Merge pull request #1952 from Badiboy/master
More changes from review of bot api 6.6
2023-03-27 23:17:24 +03:00
3f07dc4ce8 thumb
Co-authored-by: _run <khumogo1@gmail.com>
2023-03-26 20:04:29 +03:00
2e589ab6e1 Thumb type spec 2023-03-26 18:00:35 +03:00
8b63f6a6ef Merge branch 'master' of https://github.com/Badiboy/pyTelegramBotAPI 2023-03-26 17:41:25 +03:00
dc98aca173 Merge remote-tracking branch 'upstream/master' 2023-03-26 17:40:55 +03:00
39360e0640 send_video thumbnail hint
Co-authored-by: _run <khumogo1@gmail.com>
2023-03-25 16:38:16 +03:00
b1c172c421 send_document thumbnail hint
Co-authored-by: _run <khumogo1@gmail.com>
2023-03-25 16:38:05 +03:00
6b5c263ee8 send_animtion thumbnail hint
Co-authored-by: _run <khumogo1@gmail.com>
2023-03-25 16:37:46 +03:00
46100edd97 send_video_note thumbnail hint
Co-authored-by: _run <khumogo1@gmail.com>
2023-03-25 16:37:22 +03:00
018b89cdc0 send_document thumbnail
Co-authored-by: _run <khumogo1@gmail.com>
2023-03-25 16:37:03 +03:00
f3486b3730 send_document thumbnail
Co-authored-by: _run <khumogo1@gmail.com>
2023-03-25 16:36:36 +03:00
b0e64d828c send_video thumbnail hint
Co-authored-by: _run <khumogo1@gmail.com>
2023-03-25 16:36:10 +03:00
14434b398e send_animation thumbnail hint
Co-authored-by: _run <khumogo1@gmail.com>
2023-03-25 16:34:08 +03:00
1d62bf2ac8 Merge pull request #1949 from codebyzen/master
I added CalendarIT Telegram bot (with link to bot), can post acquainted with what is happening today, tomorrow or what happened 20 years ago to channel.
2023-03-25 16:40:46 +04:00
fe2e9a7a30 thumb_url etc. converted to properties 2023-03-25 15:22:30 +03:00
c9ef0d71f0 Deprecation warnings equalisation 2023-03-25 15:17:29 +03:00
b0740a920a Set "thumb" as property in types 2023-03-25 15:08:40 +03:00
6a9c25cf80 Fix set_sticker_set_thumb and set_sticker_set_thumbnail 2023-03-25 14:56:31 +03:00
e56c60ac00 thumb deprecation typo and thumb->thumbnail param rename 2023-03-25 14:44:50 +03:00
7c7a063fb6 Fix some code hints 2023-03-25 14:38:02 +03:00
bd69492ed4 Fix documentation for InlineKeyboardMarkup and quick_markup 2023-03-23 18:52:40 +00:00
37cdb52ed2 Merge branch 'master' of https://github.com/eternnoir/pyTelegramBotAPI 2023-03-19 17:39:29 +03:00
d8569394b0 Update README.md
I added CalendarIT Telegram bot, can post acquainted with what is happening today, tomorrow or what happened 20 years ago to channel.
2023-03-19 17:39:24 +03:00
da57174635 Merge pull request #1948 from coder2020official/botapi6.6
Changes from review of bot api 6.6
2023-03-19 18:25:37 +04:00
776ce0a7eb Merge pull request #1942 from arashnm80/master
add SpotSeekBot
2023-03-19 17:36:48 +04:00
886806135e Merge branch 'botapi6.6' of https://github.com/coder2020official/pyTelegramBotAPI into botapi6.6 2023-03-19 17:31:55 +04:00
1e450ebd15 Bot API 6.6 review changes 2023-03-19 17:31:53 +04:00
41521f5618 Merge pull request #1937 from coder2020official/botapi6.6
I'm back: Bot API 6.6 Update
2023-03-19 13:27:52 +04:00
603a7cf9f2 Update telebot/asyncio_helper.py 2023-03-15 05:48:41 +04:00
535a14ca0c Update telebot/apihelper.py 2023-03-15 05:48:16 +04:00
67a52b2e98 Apply suggestions from code review 2023-03-15 05:46:03 +04:00
c47c26d2b0 Update README.md 2023-03-14 17:29:51 +03:30
9d2f7c02a4 Fixing tests attempt 1 2023-03-11 23:54:57 +04:00
991679bedc Renamed all necessary thumbs to thumbnails in types.py 2023-03-11 23:53:16 +04:00
3b4e6fed04 Renamed the method setStickerSetThumb to setStickerSetThumbnail and its parameter thumb to thumbnail. 2023-03-11 23:37:32 +04:00
5c6b867582 Renamed the field thumb in the classes Animation, Audio, Document, Sticker, Video, VideoNote, InputMediaAnimation, InputMediaAudio, InputMediaDocument, InputMediaVideo, StickerSet to thumbnail. Renamed the parameter thumb in the methods sendAnimation, sendAudio, sendDocument, sendVideo, sendVideoNote to thumbnail. 2023-03-11 23:34:17 +04:00
715aabaf49 Added the method setStickerMaskPosition for changing the mask position of a mask sticker. 2023-03-11 23:06:57 +04:00
9fa5b91e58 Added the method setStickerKeywords for changing the search keywords assigned to a sticker. 2023-03-11 22:58:41 +04:00
de5a32e45c Fixed custom_emoji_ids and added set_sticker_emoji_list, and and fixed some typehints 2023-03-11 22:53:33 +04:00
db087427fc Added the method deleteStickerSet for complete deletion of a given sticker set that was created by the bot. 2023-03-11 22:27:37 +04:00
385fc6a6da Added the method setStickerSetTitle for editing the title of sticker sets created by the bot. 2023-03-11 22:24:34 +04:00
ac0b386625 Added the method setCustomEmojiStickerSetThumbnail for editing the thumbnail of custom emoji sticker sets created by the bot. 2023-03-11 22:19:49 +04:00
ae44b0022d Added support for .WEBP, .TGS, and .WEBM files in uploadStickerFile by replacing the parameter png_sticker in the method uploadStickerFile with the parameters sticker and sticker_format. 2023-03-11 22:15:31 +04:00
73135d6012 Added support for .WEBP files in createNewStickerSet and addStickerToSet. 2023-03-11 22:03:37 +04:00
19dcce0d5b Added support for the creation of sticker sets with multiple initial stickers in createNewStickerSet by replacing the parameters png_sticker, tgs_sticker, webm_sticker, emojis and mask_position with the parameters stickers and sticker_format. 2023-03-11 21:59:22 +04:00
f527fc91f6 Replaced the parameters png_sticker, tgs_sticker, webm_sticker, emojis and mask_position in the method addStickerToSet with the parameter sticker of the type InputSticker. 2023-03-11 18:18:07 +04:00
c0185dad44 Added the field needs_repainting to the class Sticker. 2023-03-11 16:41:19 +04:00
8a858cac4e Added the parameter needs_repainting to the method createNewStickerSet to automatically change the color of emoji based on context (e.g., use text color in messages, accent color in statuses, etc.). 2023-03-11 16:39:04 +04:00
f30457bd75 Added support for the creation of custom emoji sticker sets in createNewStickerSet. 2023-03-11 16:33:02 +04:00
54caf30f69 Added the parameter emoji to the method sendSticker to specify an emoji for just uploaded stickers. 2023-03-11 15:50:09 +04:00
09e4a2a437 Added the ability to get the current bot short description in the given language as the class BotShortDescription using the method getMyShortDescription. 2023-03-11 15:46:35 +04:00
9b81a29a6a Added the ability to set different bot short descriptions for different user languages using the method setMyShortDescription. 2023-03-11 15:40:54 +04:00
65dcd67140 Added the ability to get the current bot description in the given language as the class BotDescription using the method getMyDescription. 2023-03-11 15:35:00 +04:00
c84b771e5a Added the ability to set different bot descriptions for different user languages using the method setMyDescription. 2023-03-10 21:36:44 +04:00
2bd81a5f5c I'm back: Bot API Update too :) 2023-03-10 15:21:07 +04:00
5d9a76b0dd Merge pull request #1917 from S1RANN/master
Add a function to extract contents of entities from messages
2023-03-03 11:00:03 +03:00
6459f13f25 Merge pull request #1927 from Badiboy/master
New content types added + typo fix
2023-02-22 09:51:22 +03:00
c9b6d3f868 New content types added + typo fix 2023-02-22 09:49:29 +03:00
80c1a4798d Merge pull request #1921 from zeldpol/patch-1
Fix .webm upload
2023-02-18 23:46:03 +03:00
7a67d5f9f9 Fix .webm async upload 2023-02-18 22:36:29 +02:00
d12ea91e12 Fix .webm upload
No need to pass file content as a header, it causes the http error "431 Request Header Fields Too Large".
2023-02-17 19:23:11 +02:00
4f2c89c4a8 Add a function to extract contents of entities from messages 2023-02-15 17:24:39 +08:00
fb7d60f09d Merge pull request #1913 from coder2020official/botapi6.5
Fix #1912
2023-02-09 19:49:17 +04:00
8dc4e77287 Update asyncio_helper.py 2023-02-09 19:27:05 +04:00
a999161384 Merge pull request #1911 from Badiboy/master
restrict_chat_member fix
2023-02-09 17:58:28 +03:00
b4196f5891 restrict_chat_member fix 2023-02-09 17:56:10 +03:00
e55fe962ca Merge pull request #1906 from Badiboy/master
Bump version to 4.10.0
2023-02-05 13:14:08 +03:00
3d2c5c9590 Bump version to 4.10.0 2023-02-05 13:11:07 +03:00
40567570e8 Merge pull request #1902 from coder2020official/botapi6.5
Bot API 6.5 update 🔥
2023-02-05 13:07:47 +04:00
4179e502c3 Fix description 2023-02-05 11:13:31 +04:00
a9b878107c Fix can_send_media_messages param, added warnings 2023-02-04 22:24:26 +04:00
2094120ec7 Added user_chat_id to ChatJoinRequest; And, i corrected typehints 2023-02-04 20:07:01 +04:00
d1348606e3 Added use_independent_chat_permissions to setchatpermissions 2023-02-04 20:04:07 +04:00
d0d03d0c09 Added use_independent_chat_permissions for restrictchatmember 2023-02-04 19:59:49 +04:00
fdd82a5e4b Merge pull request #1894 from Muhammad-Aadil/master
Added poll_example.py in the examples
2023-02-04 18:46:39 +03:00
9e68f76f5d Replaced the fields can_send_media_messages in the classes ChatMemberRestricted and ChatPermissions with separate fields can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes for different media types. 2023-02-04 18:57:06 +04:00
4000c9fb48 Added chat_shared and chatshared 2023-02-04 16:58:48 +04:00
ae42d0b1fe Added usershared and user_shared 2023-02-04 16:54:43 +04:00
a3891ff363 Pep 0563 proposed change
https://peps.python.org/pep-0563/
2023-02-04 16:29:48 +04:00
4d7f5310fb Added the class KeyboardButtonRequestChat and the field request_chat to the class KeyboardButton. 2023-02-04 16:24:05 +04:00
3e0d69f7f4 fixed checks x1 2023-02-04 16:16:34 +04:00
2e5fb10430 Added the class KeyboardButtonRequestUser and the field request_user to the class KeyboardButton. 2023-02-04 16:02:18 +04:00
c39c050abf Update README.md 2023-02-04 15:32:55 +04:00
ed6d6cc03f add poll answer handler to poll_example.py to show the example to send next poll or log user answers 2023-02-04 11:22:49 +05:00
10a80e1cfa add only quiz type poll example to the poll_example.py 2023-02-04 10:27:29 +05:00
d99f48f975 Merge pull request #1893 from artyl/master
RuntimeError("cannot join current thread")
2023-01-31 20:52:59 +03:00
dae2790c61 Merge pull request #1898 from Badiboy/master
Async allowed_updates fix
2023-01-31 20:59:35 +04:00
f5eac56afa Async allowed_updates fix 2023-01-31 11:19:11 +03:00
268c3a9210 Merge pull request #1890 from iamnalinor/master
Fix "invite link must be non-empty" error
2023-01-28 19:35:02 +04:00
ad7e4bbaf7 Added poll_example.py in the examples 2023-01-28 18:20:58 +05:00
b9bedef73f Avoid raise RuntimeError(cannot join current thread) 2023-01-28 12:26:25 +03:00
9fb5f89f18 Merge pull request #1892 from bgelov/patch-1
Update README.md
2023-01-27 09:24:07 +03:00
409ff49603 Update README.md
Change _handeler() to _handler() in readme
2023-01-26 22:49:41 -03:00
5e0da40fcd Fix "invite link must be non-empty" error
`bot.edit_chat_invite_link` method contained a mistake: `invite_link` and `name` were supposed to be vice-versa in `apihelper.edit_chat_invite_link(...)` call. This caused to be invite_link empty or contain invalid value, resulting to get `Bad Request: invite link must be non-empty` error.
This also affected the async version.
2023-01-21 17:00:36 +04:00
b743aa5813 Merge pull request #1884 from Cub11k/master
Remove redundant function from util
2023-01-16 16:58:58 +03:00
1797f076dc Remove redundant function 2023-01-16 15:45:59 +02:00
68c1fe8cb5 Merge pull request #1883 from Cub11k/master
Fix type of attribute id of InlineQuery from int to str
2023-01-15 17:22:22 +04:00
1eda7cafd4 Fix type of attribute id of InlineQuery from int to str 2023-01-15 15:04:07 +02:00
291566908b Merge pull request #1882 from CommanderCRM/patch-1
Added a bot with public source code to the list
2023-01-13 15:58:55 +03:00
bef29d9318 Added a bot with public source code to the list 2023-01-13 19:14:10 +07:00
a5af586a46 Merge pull request #1881 from Cub11k/master
Create method get_media_file_id() in util.py
2023-01-10 20:48:50 +03:00
93dcbbeb02 Create method get_media_file_id()
Method is used to get file id of different types of media
2023-01-10 19:35:36 +02:00
bd94d8d91c Merge pull request #1873 from coder2020official/circular_import_fix
Little code style improvement in service_utils
2023-01-08 09:55:33 +03:00
6b399ab8cd Being specific with except block 2023-01-08 10:49:27 +04:00
8744402efc Removed built-in io module from try/except block 2023-01-08 10:48:45 +04:00
d5bbaa900e Merge pull request #1870 from Cub11k/master
Make create_dir() method of StatePickleStorage cross-platform instead of POSIX only.
2023-01-07 13:02:26 +03:00
02ae255701 Revert changes in util.py 2023-01-06 22:39:27 +02:00
c27f60b94b Make create_dir() method cross-platform instead of POSIX only.
Fix for issue #1869
2023-01-06 22:36:08 +02:00
a781929a2d Merge pull request #1868 from Cub11k/master
Fix circular import
2023-01-06 22:51:52 +03:00
e6f8acadf4 rename _util.py to service_utils.py 2023-01-06 21:41:30 +02:00
c298d95d0f Move functions, required in types.py to _util.py
Add __all__ to util.py for sphinx to generate docs properly
2023-01-06 19:27:25 +02:00
8aee5372ee Update README.md - add link to ru docs 2023-01-05 16:25:16 +02:00
df105ab1d8 Merge pull request #1867 from Cub11k/master
Translated into russian files: index.po, calldata.po
2023-01-05 18:20:30 +04:00
b93ec5d0e0 Translated calldata.po to russian 2023-01-05 16:13:00 +02:00
f201df3275 Translated index.po to russian 2023-01-05 16:03:14 +02:00
206e4e024b Merge pull request #1865 from coder2020official/master
Fix docs issues
2023-01-04 18:08:35 +04:00
bd1290592b Fix docs issues 2023-01-04 18:07:29 +04:00
9b9eb775f7 Merge pull request #1863 from Cub11k/master
Finished translations into russian of files: sync_version.po, async_version.po
2023-01-04 17:39:34 +04:00
3cfa24f9c0 Fix msgid for forward_message:5 in async_version.po 2023-01-04 15:35:09 +02:00
b540a6c4d4 Fix msgid for forward_message:5 in sync_version.po 2023-01-04 15:33:18 +02:00
a0ba5ae9af Finished translations on sync and async versions.
Spelling fixes
2023-01-04 00:43:42 +02:00
651db29cb2 Fix typehints for stop_poll reply markup 2023-01-03 23:45:59 +02:00
490168f3f6 Some translations
Up to lines sync_version.po:4527 and async_version.po:4448
2023-01-03 19:43:36 +02:00
bf38071e8f Some translations
Up to lines sync_version.po:3691 and async_version.po:3609
2023-01-03 17:32:31 +02:00
e8aaa524fe Merge branch 'sync_and_async_upd' into master 2023-01-02 17:41:48 +02:00
e2e754fdff Merge pull request #3 from eternnoir/master
Update fork
2023-01-02 17:35:04 +02:00
d64f305fd4 Merge pull request #1861 from coder2020official/docs
Updated documentation locales
2023-01-02 19:29:40 +04:00
611bf4235c Updated documentation locales 2023-01-02 19:27:57 +04:00
fe0dc6930c Merge pull request #2 from Cub11k/master
Update branch from master
2023-01-02 17:14:33 +02:00
6d4d3f8005 Merge pull request #1 from eternnoir/master
Update fork
2023-01-02 17:12:49 +02:00
0f7464e8c4 Some translations
Up to lines sync_version.po:3008 and async_version.po:3122
2023-01-02 17:09:48 +02:00
6f86382e33 Merge pull request #1860 from Badiboy/master
Bump version to 4.9/0
2023-01-02 18:00:39 +03:00
43cc203654 Bump version to 4.9/0 2023-01-02 18:00:20 +03:00
3b62ad4765 Merge pull request #1855 from coder2020official/botapi6.4
Bot API 6.4
2023-01-02 17:55:32 +03:00
3be5015f9e Update telebot/types.py 2023-01-02 17:55:30 +04:00
267a33c329 Update telebot/types.py 2023-01-02 17:55:14 +04:00
667e82d073 Update telebot/types.py 2023-01-02 17:54:35 +04:00
dd50273c95 Some translations
Up to lines sync_version.po:2709 and async_version.po:2853
2022-12-31 14:16:13 +02:00
8e9d566d5c Minor fixes and some translations
Up to lines sync_version.po:2382 and async_version.po:2528
2022-12-31 00:56:38 +02:00
79bc869143 Merge pull request #1856 from Cub11k/master
Copied translations from sync_version.po to async_version.po
2022-12-30 23:56:32 +04:00
68edb4990c Fix async_version.po 2022-12-30 21:42:50 +02:00
19544ecc58 Copied translations from sync_version.po to async_version.po
Minor fixes in sync_version.po, found while copying
2022-12-30 21:24:13 +02:00
eed56be596 Added fields has_hidden_members and has_aggressive_anti_spam_enabled to class Chat 2022-12-30 20:38:26 +04:00
9f8256607a Added the parameter message_thread_id to the method sendChatAction for sending chat actions to a specific message thread or a forum topic.
Added the parameter message_thread_id to the method sendChatAction for sending chat actions to a specific message thread or a forum topic.
2022-12-30 20:23:53 +04:00
f297ad23c7 Added methods for topic management
Added the methods editGeneralForumTopic, closeGeneralForumTopic, reopenGeneralForumTopic, hideGeneralForumTopic, unhideGeneralForumTopic for managing the General topic in forums.
2022-12-30 20:19:50 +04:00
a20a3ae321 topic events and write_access_allowed
Added the classes ForumTopicEdited, GeneralForumTopicHidden, GeneralForumTopicUnhidden, and WriteAccessAllowed and the fields forum_topic_edited, general_forum_topic_hidden, general_forum_topic_unhidden, and write_access_allowed to the class Message.
2022-12-30 20:07:38 +04:00
107f92314b icon_custom_emoji_id and name parameters made optional for edit_forum_topic
The parameters name and icon_custom_emoji_id of the method editForumTopic are now optional. If they are omitted, the existing values are kept.
2022-12-30 19:50:14 +04:00
9f5d9861a4 Added the field has_media_spoiler to the class Message.
Added the field has_media_spoiler to the class Message.
2022-12-30 19:41:46 +04:00
4537b237c8 has_spoiler for types.py
Added the field has_spoiler to the classes InputMediaPhoto, InputMediaVideo, and InputMediaAnimation.
2022-12-30 19:27:38 +04:00
4d11e97c25 has_spoiler parameter
Added the parameter has_spoiler to the methods sendPhoto, sendVideo, and sendAnimation.
2022-12-30 19:20:23 +04:00
f0a1cefdda Added the field is_persistent to the class ReplyKeyboardMarkup
Added the field is_persistent to the class ReplyKeyboardMarkup, allowing to control when the keyboard is shown.
2022-12-30 19:08:37 +04:00
24cd014410 Update README.md 2022-12-30 18:52:00 +04:00
ba64180b5f Merge pull request #1854 from Cub11k/master
Fixed typehints for reply markup in editing methods
2022-12-30 16:44:31 +03:00
3812fd05e3 Fixed typehints for reply markup in editing methods (async) 2022-12-30 14:04:12 +02:00
69afd7232e Fixed typehints for reply markup in editing methods 2022-12-30 14:02:02 +02:00
81600cf27e Merge pull request #1849 from eternnoir/dependabot/pip/wheel-0.38.1
Bump wheel from 0.24.0 to 0.38.1
2022-12-30 00:02:27 +03:00
bb8023ecc6 Merge pull request #1852 from Cub11k/master
Fixed typehints for register_<any>_handler()
2022-12-28 22:14:50 +04:00
a50a6e2e54 Fixed typehints for register_<any>_handler() 2022-12-28 20:00:06 +02:00
0329e5adb8 Merge pull request #1850 from ayitinya/patch-1
Update README.md
2022-12-27 09:17:26 +03:00
2f25b56659 Update README.md
Adds a bot to Bots using this library list
2022-12-27 02:46:07 +00:00
2aaab08517 Bump wheel from 0.24.0 to 0.38.1
Bumps [wheel](https://github.com/pypa/wheel) from 0.24.0 to 0.38.1.
- [Release notes](https://github.com/pypa/wheel/releases)
- [Changelog](https://github.com/pypa/wheel/blob/main/docs/news.rst)
- [Commits](https://github.com/pypa/wheel/compare/0.24.0...0.38.1)

---
updated-dependencies:
- dependency-name: wheel
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-26 19:49:24 +00:00
a6a22c351a Merge pull request #1845 from Cub11k/master
Partly translated files: sync_version.po
2022-12-21 17:14:55 +04:00
d211db90cf Update sync_version.po 2022-12-21 15:04:43 +02:00
f2c211616c Merge pull request #1844 from coder2020official/master
✉️ Fixed escape_markdown: now it should escape { and } characters in a string as well.
2022-12-21 16:59:03 +04:00
c5e733a4c1 Escape both metachars 2022-12-20 23:47:12 +04:00
925f7012f1 Update formatting.py 2022-12-20 23:44:32 +04:00
625ae09573 Merge pull request #1839 from coder2020official/master
Fix bug with asyncwebhooks
2022-12-19 17:35:23 +04:00
5b279b7ad9 (A)SyncWebhookListener changes 2022-12-19 17:28:05 +04:00
247cddf23d Merge pull request #1831 from coder2020official/reloader_fix
Update reloader.py
2022-12-19 17:17:11 +04:00
171172d12e Update async_telebot.py 2022-12-19 17:12:15 +04:00
c3c12b93dd Merge pull request #1832 from coder2020official/master
Fix bug related to get_user_profile_photos
2022-12-14 14:18:18 +04:00
add240adfd Update asyncio_helper.py 2022-12-14 12:41:30 +04:00
45fe2ea319 Update reloader.py 2022-12-13 18:44:41 +04:00
6373af78f3 Merge pull request #1824 from reddere/patch-3
fixing escape()
2022-12-03 16:48:16 +03:00
4ed460b137 Update util.py 2022-12-03 14:23:10 +01:00
ae20cb9f31 Update util.py 2022-12-03 14:21:31 +01:00
669c18fdc0 update
updated "== None" to "is None" and adjusted the else statement
2022-12-03 14:11:07 +01:00
34acae9a59 fixing escape()
fixing escape() as replacing a None would throw an exception 'NoneType' object has no attribute 'replace'. useful in case of escaping a None string given from message.from_user.last_name as you dont know wether the user has a last name or not
2022-12-03 13:33:22 +01:00
109ae69f27 Merge pull request #1823 from Badiboy/master
Fixed register_next_step_handler_by_chat_id chat_id description
2022-12-03 00:01:57 +03:00
43abedbff7 Fixed register_next_step_handler_by_chat_id chat_id description 2022-12-02 23:59:59 +03:00
42d162f732 Merge pull request #1822 from Badiboy/master
Fix caption_entities miss in InputMediaXXX
2022-12-02 23:52:54 +03:00
cd4dc899a1 Fix caption_entities miss in InputMediaXXX 2022-12-02 23:46:26 +03:00
5066626692 Merge pull request #1818 from Cub11k/master
Translated to russian file: util.po
2022-12-01 12:46:16 +04:00
e255d9cbab Update docs/source/locales/ru/LC_MESSAGES/util.po
Co-authored-by: _run <khumogo1@gmail.com>
2022-11-30 23:12:33 +02:00
8e1c8a2742 Update docs/source/locales/ru/LC_MESSAGES/util.po
Co-authored-by: _run <khumogo1@gmail.com>
2022-11-30 23:12:25 +02:00
e358abc1bd Update util.po 2022-11-30 21:07:46 +02:00
42da2d1794 Merge pull request #1816 from Cub11k/master
Translated into russian file: formatting.po
2022-11-30 19:44:24 +04:00
feaef2b2b8 Merge remote-tracking branch 'origin/master' 2022-11-30 17:33:28 +02:00
6cf60a3dcb Update formatting.po according to comments 2022-11-30 17:33:06 +02:00
91ff06eeba Update docs/source/locales/ru/LC_MESSAGES/formatting.po
Co-authored-by: _run <khumogo1@gmail.com>
2022-11-30 16:49:46 +02:00
1c2111d689 Update formatting.po 2022-11-29 20:19:25 +02:00
bf039df122 Merge pull request #1815 from coder2020official/master
Update install.po
2022-11-29 19:25:40 +04:00
44309797d1 Update install.po 2022-11-29 19:21:05 +04:00
8489383eb4 Merge pull request #1814 from abdullaev388/master
Translated into russian files:  install.po, quick_start.po
2022-11-29 19:12:54 +04:00
848a2cc7ec Update docs/source/locales/ru/LC_MESSAGES/install.po
Co-authored-by: _run <khumogo1@gmail.com>
2022-11-29 10:11:27 -05:00
cc87dbce50 Update docs/source/locales/ru/LC_MESSAGES/install.po
Co-authored-by: _run <khumogo1@gmail.com>
2022-11-29 10:11:21 -05:00
15f6bbeacb Update docs/source/locales/ru/LC_MESSAGES/install.po
Co-authored-by: _run <khumogo1@gmail.com>
2022-11-29 10:09:48 -05:00
29befa4d0c Update install.po
translated into russian
2022-11-29 09:25:10 -05:00
cce03dab78 Update quick_start.po
translated into russian
2022-11-29 09:21:24 -05:00
7702d63fd7 Merge pull request #1813 from coder2020official/docs
Base of ru documentation added.
2022-11-29 17:39:30 +04:00
d636cdf88b Update doc_req.txt 2022-11-29 17:37:16 +04:00
06a28380d7 Update doc_req.txt 2022-11-29 17:33:42 +04:00
d7e9d3accc Update conf.py 2022-11-29 14:59:17 +04:00
736c03fe84 Update conf.py 2022-11-29 14:49:32 +04:00
7502d26b1a Added locales 2022-11-29 14:45:51 +04:00
b4d59fdf0a Merge pull request #1812 from Badiboy/master
Bump version to 4.8.0 and update Python versions
2022-11-28 19:24:46 +03:00
8d723bdcb3 Python 3.6 removed, Python 3.11 added 2022-11-28 19:17:23 +03:00
a169404a7c Bump version to 4.8.0 2022-11-28 19:14:07 +03:00
7a20017dfb Merge pull request #1811 from coder2020official/continuehandling-fix
Continuehandling fix
2022-11-27 11:30:37 +03:00
8d82b3d56b Update async_telebot.py 2022-11-26 20:08:00 +04:00
0759c8e081 Update __init__.py 2022-11-26 20:07:08 +04:00
8992db1d24 Merge pull request #1808 from coder2020official/master
Fix #1804
2022-11-26 20:05:00 +04:00
deb2099396 Update types.py 2022-11-22 18:36:15 +04:00
8a74198276 Merge pull request #1801 from coder2020official/master
Fixed bot api bug
2022-11-18 23:22:39 +04:00
15bd5f991a Update types.py 2022-11-18 23:21:06 +04:00
25571b581c Update types.py 2022-11-18 23:12:03 +04:00
bf617ab8da Merge pull request #1799 from Badiboy/master
content_type_media and content_type_service reviewed
2022-11-13 13:21:45 +03:00
74732f2eda content_type_media and content_type_service reviewed 2022-11-13 13:20:26 +03:00
0a79f7e4f3 Merge pull request #1783 from coder2020official/botapi-63
Bot API 6.3 Update
2022-11-13 12:39:38 +03:00
8b735aa114 Update __init__.py 2022-11-13 13:34:54 +04:00
ae1845f285 Added active_usernames and emoji_status_custom_emoji_id 2022-11-06 17:38:01 +04:00
0846852ea1 Added all necessary parameters
Added the parameter message_thread_id to the methods sendMessage, sendPhoto, sendVideo, sendAnimation, sendAudio, sendDocument, sendSticker, sendVideoNote, sendVoice, sendLocation, sendVenue, sendContact, sendPoll, sendDice, sendInvoice, sendGame, sendMediaGroup, copyMessage, forwardMessage to support sending of messages to a forum topic.
2022-11-06 17:31:49 +04:00
4825624d48 Added docs to types, added new methods
Added the methods createForumTopic, editForumTopic, closeForumTopic, reopenForumTopic, deleteForumTopic, unpinAllForumTopicMessages, and getForumTopicIconStickers for forum topic management.
2022-11-06 15:43:16 +04:00
876d679765 Added ForumTopic class and fixed previous classes by fixing de_json method. 2022-11-06 15:14:19 +04:00
7958d0dca7 Added can_manage_topics for promotechatmember
Added the parameter can_manage_topics to the method promoteChatMember.
2022-11-06 15:04:41 +04:00
4e2ea90db3 Added field can_manage_topics
Added the field can_manage_topics to the classes ChatAdministratorRights, ChatPermissions, ChatMemberAdministrator, and ChatMemberRestricted.
2022-11-06 15:00:20 +04:00
566aef1679 Fix wrong typehint for previous commit 2022-11-06 14:49:13 +04:00
2dad99ad95 Merge pull request #1761 from coder2020official/master
Extended exception handler behaviour for async
2022-11-06 09:23:02 +03:00
f288470b43 Added the classes ForumTopicCreated, ForumTopicClosed, and ForumTopicReopened and the fields forum_topic_created, forum_topic_closed, and forum_topic_reopened to the class Message. Note that service messages about forum topic creation can't be deleted with the deleteMessage method.
Added the classes ForumTopicCreated, ForumTopicClosed, and ForumTopicReopened and the fields forum_topic_created, forum_topic_closed, and forum_topic_reopened to the class Message. Note that service messages about forum topic creation can't be deleted with the deleteMessage method.
2022-11-06 01:04:33 +04:00
475394d241 Added message_thread_id & is_topic_message 2022-11-05 23:23:00 +04:00
76f06cacfe Fix typo 2022-11-05 23:15:10 +04:00
77738b2537 Added is_forum 2022-11-05 23:14:37 +04:00
070479f7af Update async_telebot.py 2022-11-05 23:06:28 +04:00
f1f18c6df2 Fix error description 2022-11-05 22:49:07 +04:00
81c8ee5820 Update README.md 2022-11-05 22:20:11 +04:00
76a689d939 Merge pull request #1774 from batmanscode/master
fixes: `debug` removed from uvicorn #1767
2022-11-02 13:29:45 +03:00
92ecfdec48 fixes: debug removed from uvicorn #1767 2022-10-30 17:21:53 +00:00
20376168c1 Merge pull request #1772 from sijokun/master
Added example of running serverless on AWS Lambda
2022-10-29 12:02:31 +03:00
507d53efbd Rename lambda_function.py to aws_lambda_function.py 2022-10-29 11:57:53 +03:00
1d8dc78c87 Added example of running serverless on AWS Lambda
Example of using of PyTelegramBotAPI in Amazon AWS Lambda
2022-10-29 01:18:52 +03:00
ebec3bf5c1 Merge pull request #1762 from reddere/patch-1
Fixed InlineQueryResultVideo params in example.
2022-10-24 19:25:15 +03:00
d11b9802da Fixed InlineQueryResultVideo params in example.
Fixed InlineQueryResultVideo params in example. String "Video" was passed in stead of the thumbnail url, making the example not work, This has been tested working.
2022-10-24 16:02:59 +02:00
572f103db7 Extended exception handler behaviour for async 2022-10-22 21:48:29 +04:00
231371f1f8 Merge pull request #1759 from Badiboy/master
Bump version to 4.7.1
2022-10-21 10:58:23 +03:00
623d8b27ec Bump version to 4.7.1 2022-10-21 10:18:47 +03:00
31c3a2b2a3 Merge pull request #1742 from byehack/ContinueHandling
Support ContinueHandling
2022-10-11 19:03:44 +03:00
c45af810f9 Updated docstrings for ContinueHandling 2022-10-11 19:15:38 +04:00
81f090cce6 Update asyncio_handler_backends.py 2022-10-11 19:15:01 +04:00
5d16b8bd4a Create continue_handling.py 2022-10-11 19:13:10 +04:00
0fecf46201 Create continue_handling.py 2022-10-11 19:09:59 +04:00
982e642c73 Update telebot/handler_backends.py 2022-10-11 19:05:55 +04:00
97bca49c00 ContinueHandling on asyncio_handler_backends 2022-10-09 02:28:05 +03:30
e0ee087162 Merge pull request #1749 from Badiboy/master
Check CUSTOM_REQUEST_SENDER before RETRY_xxx.
2022-10-08 23:43:44 +03:00
620b1364a6 Check CUSTOM_REQUEST_SENDER before RETRY_xxx. 2022-10-08 23:41:41 +03:00
c561cf3076 Merge pull request #1748 from coder2020official/master
Added warning for non_stop=False
2022-10-08 23:24:58 +03:00
b3953d6249 ℹ️ Better description 2022-10-08 23:03:04 +04:00
2d7170feee Added warning for non_stop=False 2022-10-08 22:35:22 +04:00
0ca8007633 Merge pull request #1747 from coder2020official/master
Update __init__.py
2022-10-07 20:57:49 +03:00
c541533762 Update __init__.py 2022-10-07 21:50:51 +04:00
4798c26188 improve code quality 2022-10-02 12:05:20 +03:30
30aaf8d0f1 Support ContinueHandling 2022-10-02 03:27:06 +03:30
82ad37fed8 Merge pull request #1693 from coder2020official/conflicts
Logging improvements(still not 100%), file restarts on file changes(needs tests), and more
2022-10-01 22:30:49 +03:00
2d1f39085d Improved code readability x 2 2022-10-01 22:34:49 +04:00
b523cec22f Improved code readability 2022-10-01 22:32:41 +04:00
27e0197855 Added examples and made it possible to specify --path path for path 2022-10-01 21:28:53 +04:00
ea69b8093d Added some notes 2022-10-01 21:15:24 +04:00
04ff428bba Added option to specify path to watch 2022-10-01 21:02:40 +04:00
eb576d83fb Fixed a bug, made improvements in reload system
Didn't test that much, there is still some stuff to do
2022-09-30 23:22:21 +04:00
d3080b6d4e Merge branch 'master' into conflicts 2022-09-30 22:53:19 +04:00
7c9b01b10a Merge pull request #1722 from Badiboy/master
Handlers and Middlewares processing union
2022-09-24 22:16:33 +03:00
b3993bb019 Merge remote-tracking branch 'upstream/master' 2022-09-24 22:14:45 +03:00
36b889feab Merge pull request #1736 from AntonGlyzin/antonglyzin-shopbotlist
Added a new bot to the list
2022-09-24 16:06:33 +03:00
d943f40643 Added a new bot to the list 2022-09-24 15:33:11 +03:00
dafafd2ad2 Merge pull request #1735 from coder2020official/class_params
⚙️ Added some frequent parameters to classes(see full list)
2022-09-23 22:06:09 +04:00
e002484a9b ⚙️ Added some frequent parameters to classes(see full list)
Added:
- disable_web_page_preview
- disable_notification
- protect_content
- allow_sending_without_reply
2022-09-23 21:52:40 +04:00
52e09637c2 Fix: do not call handler in one more task 2022-09-17 23:17:07 +03:00
e7a96ec2ed Rename also in Async 2022-09-17 14:09:05 +03:00
598de25b6d Rename _check_middlewares to _get_middlewares 2022-09-17 12:55:55 +03:00
b841fc10ed Merge pull request #1723 from byehack/patch-1
don't block loop
2022-09-17 13:42:57 +04:00
c14760d81c don't block loop 2022-09-17 13:58:28 +04:30
da639dd1f6 Handlers and Middlewares processing union
Call for handlers now union in a single function for future extension.

Plus minor fixes in storages.
2022-09-17 11:57:12 +03:00
96e137f5e6 Update setup.py 2022-09-16 22:39:40 +04:00
8d9dfcfac8 Merge pull request #1707 from S1RANN/master
raise other exceptions in antiflood function
2022-09-13 17:59:30 +03:00
a1c77db236 Merge pull request #1710 from coder2020official/bugfixes
Fixed difference between request_timeout and timeout.
2022-09-10 20:48:30 +04:00
4f97b26e81 Update asyncio_helper.py 2022-09-10 20:37:13 +04:00
0028feb4c5 Update asyncio_helper.py 2022-09-10 20:14:48 +04:00
a06b4a1e9c raise other exceptions in antiflood 2022-09-10 21:46:16 +08:00
da5084f53c Update asyncio_helper.py 2022-09-10 14:36:56 +04:00
2f8d878f06 Fixed difference between request_timeout and timeout.
getUpdates parameter may contain 2 parameters: request_timeout & timeout. other methods may contain timeout parameter that should be applied to ClientTimeout.
2022-09-10 14:34:56 +04:00
783beb165b raise other exceptions in antiflood 2022-09-10 15:59:40 +08:00
4fd01e3ac8 Merge pull request #1703 from coder2020official/downloadfile
Fix #1702
2022-09-09 21:09:25 +04:00
b4c28de104 Update asyncio_helper.py 2022-09-07 20:44:39 +04:00
de344bd5e0 Merge pull request #1701 from coder2020official/states
#1699 fixed
2022-09-06 18:16:06 +04:00
e3a4fdff9a Update asyncio_filters.py 2022-09-06 18:12:11 +04:00
71d3ec8b42 Changed user id and chat id 2022-09-06 18:11:40 +04:00
1b1d6c8239 Improved asyncio helper's logger 2022-08-30 21:26:56 +04:00
9216f15c16 Logs, file restarts, loggers to async
Added colorful logs, file restarts on changes, improved logger, added cached version of user-bot to async
2022-08-30 21:26:41 +04:00
0f7ab0d05f Added colorful logs, file restarts on changes to sync 2022-08-30 21:25:41 +04:00
e0ffe0b4f5 Added reloader to ext 2022-08-30 21:24:54 +04:00
f4c5dd0d22 Merge pull request #1691 from ananthb/master
Starlette ASGI example
2022-08-30 15:55:28 +03:00
e4179ea65f Add SSL cert 2022-08-30 17:27:43 +05:30
d7770bf670 Starlette ASGI example 2022-08-30 17:05:56 +05:30
095bf03227 Merge pull request #1688 from ananthb/patch-1
Import aioredis from redis module too
2022-08-30 12:28:18 +04:00
85bd174fdc Update redis_storage.py 2022-08-30 12:26:34 +04:00
b86c38367a Import aioredis from redis module too
aioredis is available in redis-py as of version 4.2.0rc1: https://github.com/aio-libs/aioredis-py#-aioredis-is-now-in-redis-py-420rc1-
Try importing from the new package as well.
2022-08-28 17:32:56 +05:30
b8214d32d5 Merge pull request #1679 from Badiboy/master
Code simplify and sync/async unificatiion
2022-08-22 12:20:36 +03:00
f4e66f6807 Added traceback for handlers exception 2022-08-21 22:27:02 +03:00
b1a4136603 Code simplify and sync/async unificatiion 2022-08-21 20:32:37 +03:00
3d97b08289 Merge pull request #1678 from coder2020official/master
Fixed bug with searching a new handler after the execution of handler
2022-08-21 19:38:59 +03:00
3d2576ca24 Fixed bug with searching a new handler after the execution of handler 2022-08-21 20:42:55 +05:00
b2d2ab5c33 Merge pull request #1675 from coder2020official/master
Fixed #1650
2022-08-17 00:38:59 +03:00
c9a732e3dd Merge branch 'eternnoir:master' into master 2022-08-16 21:39:55 +05:00
01be1fb583 Fixes #1650 2022-08-16 21:39:20 +05:00
7b95874627 Merge pull request #1672 from Badiboy/master
Typo fix
2022-08-16 17:34:57 +03:00
426f9f3787 Typo fix
and minor code opt
2022-08-16 17:12:50 +03:00
47ae696528 Merge pull request #1668 from coder2020official/master
Update asyncio_helper.py
2022-08-13 13:03:47 +03:00
a9b8baea2c Merge pull request #1667 from Badiboy/master
Readme update
2022-08-13 12:59:57 +03:00
d3cab9cdba Update asyncio_helper.py 2022-08-13 14:59:57 +05:00
d6ef67073e Readme fix 2022-08-13 12:59:13 +03:00
345fa3433c Readme update 2022-08-13 12:58:20 +03:00
c95ba8c9c2 Merge pull request #1666 from coder2020official/master
Update async_telebot.py
2022-08-13 14:58:11 +05:00
20bdb54e94 Update async_telebot.py 2022-08-13 14:57:39 +05:00
124dfbf392 Merge pull request #1665 from Badiboy/master
Bump version to 4.7.0
2022-08-13 12:53:00 +03:00
9f9821bbe8 Bump version to 4.7.0 2022-08-13 12:52:38 +03:00
c8d1dac61e Merge pull request #1663 from coder2020official/master
Bot API 6.2
2022-08-13 12:44:33 +03:00
ffb34da610 Fix 2022-08-13 14:40:20 +05:00
2647a02fc6 Contains_mask 2022-08-13 14:36:48 +05:00
dd4073fd74 Fixes regarding contains_masks 2022-08-13 13:22:25 +05:00
737c3a439d Fix tests(1st attempt) 2022-08-12 22:13:54 +05:00
40698408c9 Bot API 6.2 2022-08-12 22:10:08 +05:00
ffa1c37204 Update README.md 2022-08-12 20:12:44 +05:00
d42c8e2961 Merge pull request #1652 from coder2020official/master
Added InputFile
2022-08-12 17:35:20 +03:00
5471b88da6 Update apihelper.py 2022-08-12 19:25:46 +05:00
26db76f207 Fix backward comptability 2022-08-12 15:25:51 +05:00
e860f114c6 Forgot to remove unnecessary import 2022-08-12 14:37:00 +05:00
c5a69944be Documentation improvements and file name fix 2022-08-12 14:33:24 +05:00
2fe5ba403e Merge pull request #1662 from Peibolvig/add_web_app_data_content_type
Add 'web_app_data' content type to README
2022-08-12 10:14:03 +03:00
d2a7f975de Merge pull request #1661 from ablakely/patch-1
Update README.md
2022-08-12 10:08:09 +03:00
41b1519786 Add 'web_app_data' content type to README 2022-08-12 01:53:35 +02:00
93e1813139 Update README.md
Added TeleServ
2022-08-11 18:17:06 -05:00
dab5d7f632 Merge pull request #1660 from Mahakam20000/master
Example of async bot using webhook and aiohttp
2022-08-10 22:28:17 +03:00
1667b51034 Example of async bot using webhook and aiohttp
An async echo bot using aiohttp and webhoook
2022-08-10 19:57:30 +02:00
7d94e01009 Merge pull request #1655 from dasshit/master
Fix for token visibility in swagger in fastapi webhook example
2022-08-09 08:04:16 +03:00
c0ed659f30 Minor code style fixes 2022-08-08 23:07:04 +03:00
047777fada Fixed TOKEN visibility in fastapi swagger 2022-08-08 23:04:36 +03:00
839aced912 Merge pull request #1646 from coder2020official/test_branch
Removed state storages and fixed a typo(for docs)
2022-08-01 13:24:29 +03:00
d03f3b2c52 Updated asyncio_helper to support InputFile and fixed unecessary methods 2022-08-01 14:09:44 +05:00
65b353ffae Added InputFile 2022-08-01 12:40:43 +05:00
914c5fdf0c Merge pull request #1649 from Badiboy/master
Bump version to 4.6.1
2022-07-27 17:19:53 +03:00
8aa3d052cc Bump version to 4.6.1 2022-07-27 17:18:54 +03:00
5beb51f907 Removed state storages and fixed a typo 2022-07-27 13:48:20 +05:00
c145b7ef8f Merge pull request #1644 from coder2020official/test_branch
Updated all docstrings(visual)
2022-07-26 21:31:27 +03:00
6303ecc7c6 Little fix 2022-07-26 20:45:32 +05:00
fc01ec50fc Added .ext file to documentation 2022-07-26 16:30:51 +05:00
51b2ec701d Removed unecessary methods from documentation(to_json, de_json, to_dict) 2022-07-26 16:27:15 +05:00
3d7f334d79 Updated all docstrings for types(visual) 2022-07-26 16:16:35 +05:00
a61508ca0c Merge pull request #1643 from robz-tirtlib/patch-1
small fix
2022-07-25 21:42:22 +03:00
9d9e76e724 small fix
Fixed "ERROR - TeleBot: "message_handler: Commands filter should be list of strings (commands), unknown type supplied to the 'commands' filter list. Not able to use the supplied type."
2022-07-25 15:49:33 +03:00
b0e06253ff Completed docstrings for all files except types.py 2022-07-24 23:14:09 +05:00
7c12162576 Merge pull request #1640 from coder2020official/master
Updated all docstrings / typehints in __init__.py(visual)
2022-07-20 11:35:40 +03:00
f0feb45e87 Completed all docstrings / typehints up to 100%(visual) 2022-07-19 23:51:25 +05:00
c2cfe24426 Typehints & Docstrings completed for sync version up to 100%(visual) 2022-07-19 23:49:05 +05:00
f6ec3493ad Fixed 45% of typehints/docstrings for sync telebot 2022-07-19 00:27:21 +05:00
e553f3aa1d Merge pull request #1638 from coder2020official/master
Fixes #1637, #1636
2022-07-18 18:14:52 +03:00
49d3b463ed Fixes #1636 2022-07-18 14:01:14 +05:00
147278733b Fix #1637 2022-07-18 13:47:14 +05:00
54ad1582aa Merge pull request #1635 from coder2020official/master
Fixed description
2022-07-17 00:42:55 +03:00
e379708af6 Update __init__.py 2022-07-16 20:12:38 +05:00
9f7b113e2f Merge branch 'master' into master 2022-07-16 20:11:40 +05:00
482498e1e5 Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2022-07-16 20:09:54 +05:00
22beead3b5 Update __init__.py 2022-07-16 20:09:52 +05:00
2b01765627 Merge pull request #1633 from coder2020official/master
Update async_telebot.py
2022-07-16 18:04:52 +03:00
5dbe1b3523 Merge pull request #1631 from coder2020official/newfeatures
update_sensitive field for middlewares
2022-07-16 12:46:12 +03:00
3ffd06fcca Add feedback-bot to Bots using this library section 2022-07-15 23:26:55 +05:00
ea1efad1ea Update asyncio_helper.py 2022-07-15 22:28:43 +05:00
1efe465e9d Update async_telebot.py 2022-07-15 22:06:18 +05:00
0c6f84c79a update_sensitive field for middlewares 2022-07-15 16:24:15 +05:00
bf415e4bd7 Merge pull request #1624 from coder2020official/master
Set request_timeout to default aiohttp's timeout(5 minutes)
2022-07-13 20:01:30 +03:00
2fcfdc2584 Merge branch 'eternnoir:master' into master 2022-07-13 21:52:57 +05:00
659501efef Update async_telebot.py 2022-07-13 21:52:48 +05:00
92654ee970 Merge pull request #1623 from Badiboy/master
Fix exception with typed_middleware_handlers
2022-07-13 15:08:12 +03:00
a1bcd3c42e use_class_middlewares checks added 2022-07-13 13:10:16 +03:00
b276bfacaf Fix exception with typed_middleware_handlers
+ some additional checks
2022-07-13 12:30:13 +03:00
726b203724 Merge pull request #1621 from Badiboy/master
Typo
2022-07-12 22:48:01 +03:00
16703161aa Typo 2022-07-12 22:44:25 +03:00
a3a55e7393 Merge pull request #1617 from coder2020official/bugfixes
Extended exception handler behaviour with middlewares for synchronous version as well
2022-07-12 22:12:20 +03:00
1c11898ea1 Merge pull request #1612 from coder2020official/newfeatures
run_webhooks() built in function to listen and process webhook requests.
2022-07-11 23:33:39 +03:00
8c6f81546c A typo fixed 2022-07-11 23:24:22 +05:00
194bf6e95d Merge branch 'bugfixes' of https://github.com/coder2020official/pyTelegramBotAPI into bugfixes 2022-07-11 23:23:10 +05:00
124606fdcb Extend exception handler behaviour with middlewares 2022-07-11 23:22:11 +05:00
90a90d4a34 Divided async and sync versions into aio & sync folders 2022-07-09 22:30:36 +05:00
d67ee2a5c5 Delete webhooks.py 2022-07-08 21:16:01 +05:00
970b9d6be4 SyncWebhookListener was rewritten under fastapi. Extensions folder was divided into 2(namings are long, might be changed) 2022-07-08 21:13:07 +05:00
0b5b7ad39a Merge pull request #1614 from Badiboy/master
parse_web_app_data function fix
2022-07-08 11:19:35 +03:00
a7c420aa14 parse_web_app_data function fix 2022-07-08 11:15:50 +03:00
0cf2a0fe77 Added extra dependencies and fixed tests 2022-07-07 23:02:51 +05:00
2f32236680 Added run_webhooks for asynctelebot 2022-07-07 22:56:13 +05:00
f8f147f9f4 Fix certificate for webhooks 2022-07-07 15:53:27 +05:00
140befc132 Typehint fix if there is no flask installed 2022-07-07 15:15:24 +05:00
36fbb13663 Merge branch 'newfeatures' of https://github.com/coder2020official/pyTelegramBotAPI into newfeatures 2022-07-07 15:09:45 +05:00
e353572c03 Update webhooks listeners. 2022-07-07 15:09:02 +05:00
ebca668979 Create __init__.py 2022-07-06 23:35:59 +05:00
7b8c98d731 Test 2022-07-06 23:15:22 +05:00
3cf5305845 Rename 2022-07-06 22:06:49 +05:00
eb4cd7aba0 Webhook processing function using flask for sync 2022-07-06 21:31:03 +05:00
01f9e3b710 Merge pull request #1607 from coder2020official/newfeatures
ReadME update and filter updates
2022-07-05 22:40:54 +03:00
e1094c6f02 Update README.md 2022-07-05 21:50:11 +05:00
174bbf9c84 Merge branch 'eternnoir:master' into newfeatures 2022-07-05 21:19:21 +05:00
1df19e3b2d CallbackQuery fixes for custom filters
Now some custom filters support callback query messages
2022-07-05 21:18:42 +05:00
e0e6eee374 Merge pull request #1605 from Badiboy/master
ChatMember is now typed
2022-07-05 00:01:38 +03:00
78251cdf43 ChatMember type checking reordered 2022-07-04 22:41:01 +03:00
81cbddb8cd Added source data (json_string) to CallbackQuery 2022-07-04 22:36:42 +03:00
0aa9f0fb42 Update type fix 2022-07-04 22:26:24 +03:00
f3b1f97362 ChatMember is now typed
https://core.telegram.org/bots/api#chatmember
2022-07-03 23:33:55 +03:00
df1977911e Merge pull request #1603 from coder2020official/master
#1594 & fixes regarding handler execution in async
2022-07-02 23:12:49 +03:00
d861fd0042 Merge branch 'eternnoir:master' into master 2022-07-02 21:07:23 +05:00
1fb14e28d4 Fix handler execution and #1594 2022-07-02 21:07:00 +05:00
b691a467c0 Merge pull request #1602 from GooGuJiang/patch-1
Add bot to README.md
2022-07-02 11:18:04 +03:00
badf982147 Update README.md 2022-07-02 15:08:06 +08:00
6d52090ef9 Update README.md 2022-07-02 15:06:46 +08:00
cf3a85d699 Update README.md 2022-07-02 14:31:37 +08:00
ef86453126 Update README.md 2022-07-02 14:23:31 +08:00
d9ab5b0d28 Merge pull request #1599 from coder2020official/master
Fix group and supergroup issues with states
2022-07-01 13:55:48 +03:00
c920809fa9 Update asyncio_helper.py 2022-07-01 15:39:42 +05:00
5939e754bb Update asyncio_helper.py 2022-07-01 15:29:34 +05:00
3019b71f7f Merge branch 'eternnoir:master' into master 2022-06-30 17:54:25 +05:00
0bdf925fbe Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2022-06-30 17:54:16 +05:00
d14064a84d Fix group and supergroup issues 2022-06-30 17:51:58 +05:00
49c93b6027 Merge pull request #1598 from coder2020official/master
Fix typehint for set_state
2022-06-30 15:32:30 +03:00
36749cbdd9 Merge branch 'eternnoir:master' into master 2022-06-30 17:10:25 +05:00
6d12b1f2a7 Update callback_data.py 2022-06-30 17:10:14 +05:00
419bc5878f Fix typehint for ``set_state`` 2022-06-30 17:06:39 +05:00
b9b4885568 Merge pull request #1597 from Badiboy/master
Copyright update
2022-06-29 19:25:40 +03:00
ce0a974c91 Copyright update 2022-06-29 19:24:27 +03:00
c36f3a228e Update callback_data.py 2022-06-29 21:17:57 +05:00
ca525b5bea Copyright changes 2022-06-29 21:06:36 +05:00
6ff015689a Merge pull request #1595 from coder2020official/master
Add the possibility to getbase class of a State object
2022-06-29 18:34:06 +03:00
6459aded82 Merge branch 'eternnoir:master' into master 2022-06-29 20:22:59 +05:00
fec47cecaf Add the possibility to getbase class of a State object 2022-06-29 20:21:42 +05:00
3892b0fb80 Merge pull request #1593 from coder2020official/master
Fixed previous fix 🤦‍♂️
2022-06-29 12:58:43 +03:00
fbb9a73fc0 F###, forgot to put await 2022-06-29 14:52:37 +05:00
db5c53b8e5 Merge pull request #1591 from coder2020official/master
Pass only the necessary data
2022-06-28 17:58:35 +03:00
6e8abc709e Pass only the necessary data 2022-06-28 19:51:51 +05:00
752f35614c Merge pull request #1587 from coder2020official/master
Middleware update: everything in data will be passed to handler if ne…
2022-06-26 12:09:38 +03:00
a2893945b2 Async changes and sync improvements 2022-06-25 22:15:53 +05:00
1686ce4f44 Middleware update: everything in data will be passed to handler if needed. 2022-06-25 21:48:44 +05:00
24b1129c8a Merge pull request #1584 from coder2020official/master
Bot API 6.1 update
2022-06-23 10:50:39 +03:00
7f9dac4147 Fix previous commit 2022-06-23 12:46:27 +05:00
f96775e9eb Merge pull request #1585 from Prikalel/master
Rename `midddleware` to `middleware` in examples.
2022-06-23 10:41:20 +03:00
1342cab259 Fix boolean parameters 2022-06-23 12:05:26 +05:00
dd8125cbd0 Rename midddleware to middleware in examples. 2022-06-23 09:09:37 +03:00
8769802744 Bump version to 4.6.0 2022-06-21 15:44:42 +05:00
a7fb8a2bec Implemented some tests 2022-06-21 15:28:01 +05:00
d7f34ae370 Fix the typo 2022-06-21 15:27:45 +05:00
7d931abe37 Added secret token and create_invoice_link for asynctelebot 2022-06-21 15:22:00 +05:00
f52124827f Added all new changes for types (is_premium, added_to_attachment_menu, and etc) 2022-06-21 15:21:35 +05:00
0d0f9ef330 Added secret token and create_invoice_link 2022-06-21 15:20:55 +05:00
24cdcb1bcc Update README.md 2022-06-21 14:22:57 +05:00
7994a80a00 Merge pull request #1580 from e323w/master
Fixed async long polling
2022-06-15 11:21:12 +03:00
b2662274f9 Fixed async long polling 2022-06-15 03:24:51 +04:00
a21ab203a1 Merge pull request #1575 from coder2020official/bugfixes
Fix bug with unsaving data
2022-06-04 19:44:47 +03:00
e689e968db Fix bug with unsaving data 2022-06-04 21:33:05 +05:00
808810e6d6 Merge pull request #1574 from Mayson90/master
add hydrolib_bot to Bots using this library
2022-06-01 19:14:59 +03:00
5a60846c7f add hydrolib_bot to Bots using this library 2022-06-01 19:07:54 +03:00
d2c1615392 Merge pull request #1573 from tusharhero/master
Added my bot made using pyTelegramBotAPI
2022-06-01 10:56:01 +03:00
7cdb48c3e0 brought my bot ot end 2022-06-01 10:22:22 +05:30
28ae0867f8 Added my bot made using pyTelegramBotAPI
source code available here 
https://github.com/tusharhero/bincode-telegram-bot
2022-05-31 22:58:03 +05:30
e84cc0e0af Merge pull request #1571 from TECH-SAVVY-GUY/patch-1
Added `WebApp` functions
2022-05-30 15:25:05 +03:00
42ce47914d Fix typo in WebApp() functions 2022-05-30 17:21:33 +05:30
4401780ba9 Update WebApp() functions
Adjusted function name case to pythonic style.
2022-05-30 17:18:03 +05:30
82f056e88a Added WebApp functions
`validate_WebApp_data()` - Use to validate the data received by the WebApp from Telegram.

`parse_WebApp_data()` - Use to parse the data sent to the WebApp from the bot's backend.
2022-05-30 14:52:49 +05:30
6b19d631d1 Merge pull request #1565 from DevAdvik/master
Update create_invite_link.py
2022-05-23 14:16:42 +03:00
ee7adb00df Re-fix inlinekeyboardmarkup 2022-05-23 13:27:48 +05:30
82a8aa65f0 Merge pull request #1566 from coder2020official/master
More description for class-based middlewares in readme.
2022-05-22 11:21:49 +03:00
72aaf44dc7 Update README.md 2022-05-22 01:50:38 +05:00
1d0efce76e Update create_invite_link.py
Fix
2022-05-22 02:17:21 +05:30
74d0604c05 Update create_invite_link.py
Bug fix (Real FINAL FIX!!)
2022-05-22 01:54:02 +05:30
1943f659bc Merge pull request #1561 from coder2020official/bugfixes
Aiohttp client session management improvements.
2022-05-21 23:22:29 +03:00
d6ec104829 Update create_invite_link.py
Imported both inline keyboards in same line:|
2022-05-22 01:48:48 +05:30
7edaa51995 Update create_invite_link.py
Removed while loop
2022-05-22 01:43:24 +05:30
6bb47e9a44 Update create_invite_link.py
Added .types while importing inline markup keyboards (fix)
Removed threading import since message is not to be deleted
2022-05-22 01:38:32 +05:30
8da749ee05 Remove ssl 2022-05-22 01:02:55 +05:00
0c59d1187e Update requirements.txt 2022-05-22 00:11:16 +05:00
e9d1d98f03 Merge pull request #1562 from coder2020official/newfeatures
Added ability to hide a link in text
2022-05-21 16:51:51 +03:00
c63b0d6a3d Merge pull request #1560 from coder2020official/master
Changed behaviour of default parse mode in sync and async telebot.
2022-05-21 16:51:17 +03:00
388306b7fe Updated examples 2022-05-21 17:45:59 +05:00
5e3fd17436 Added ability to hide a link in text 2022-05-21 17:39:45 +05:00
ccc09ffaf3 Aiohttp client session management improvements. 2022-05-21 17:38:16 +05:00
e086303535 Merge branch 'eternnoir:master' into master 2022-05-21 17:11:14 +05:00
d6e93f85f1 Improved the comment for quick_markup 2022-05-21 17:10:57 +05:00
d954f8f5b3 Fixed default parse mode in asynctelebot 2022-05-21 17:10:45 +05:00
33375ac135 Added ability to set default parse_mode for explanation_parse_mode in send_poll 2022-05-21 17:10:29 +05:00
28662876a2 Add workspace exception in gitignore 2022-05-21 17:09:59 +05:00
0f44fd3c40 Merge pull request #1558 from DevAdvik/master
Created create_invite_link.py
2022-05-20 22:48:10 +03:00
8fefd7b5b3 Create create_invite_link.py
Added create_chat_invite_link() func example
2022-05-20 23:00:38 +05:30
7567750276 Merge pull request #1552 from m-cyx/patch-1
Small srtring formatter fix
2022-05-15 23:15:12 +03:00
f526a9d8a4 Small srtring formatter fix 2022-05-15 22:46:15 +03:00
feffe726dd Merge pull request #1551 from everpcpc/patch-1
fix: warning none_stop parameter is deprecated
2022-05-15 10:57:59 +03:00
3ff7e28467 fix: warning none_stop parameter is deprecated 2022-05-15 14:29:29 +08:00
5d74e18d1a Merge pull request #1550 from Badiboy/master
Poll type parameter parse fix
2022-05-15 01:06:04 +03:00
91b665ea94 Poll type parameter parse fix
Plus some typo
2022-05-15 00:59:35 +03:00
6e4c63b09c Merge pull request #1549 from coder2020official/master
Set escape=True by default.
2022-05-14 19:27:44 +03:00
42efb8488c Set escape=True by default. 2022-05-14 20:32:28 +05:00
03a567ea93 Merge pull request #1548 from AHOHNMYC/copy-message-fix
CopyMessage return type fix
2022-05-14 16:30:29 +03:00
3f28bb6e9d CopyMessage return type fix [async] 2022-05-14 15:48:27 +03:00
e051dda113 CopyMessage return type fix 2022-05-14 15:46:05 +03:00
856debe7d2 Merge pull request #1542 from abdullaev388/master
Added examples of multibot
2022-05-13 15:11:39 +03:00
42955d1886 added examples of multibot 2022-05-11 10:50:33 +05:00
a2f3cd03e1 Merge pull request #1540 from Badiboy/master
class File parse fix
2022-05-08 23:39:00 +03:00
7e68721475 class File parse fix 2022-05-08 23:34:56 +03:00
7965ba4f69 Merge pull request #1538 from coder2020official/master
Fix typo in readme
2022-05-08 18:45:32 +03:00
aba4d3e246 Merge pull request #1536 from atif5/master
Updated the "bots using this api" section in README
2022-05-08 18:45:07 +03:00
caae6bb93f Update README.md 2022-05-08 18:13:07 +05:00
096d7a4eea Update README.md 2022-05-08 00:02:40 +03:00
ab4140ba9f Update README.md 2022-05-08 00:01:45 +03:00
77c3587012 Update README.md 2022-05-08 00:00:46 +03:00
efb1b44e59 Merge pull request #1535 from Badiboy/master
Bump version to 4.5.1
2022-05-07 22:41:19 +03:00
2c8793b794 Bump version to 4.5.1 2022-05-07 22:40:26 +03:00
146fd57b10 Merge pull request #1531 from coder2020official/patch-3
Random unused import deleted
2022-05-05 09:26:57 +03:00
8a12ae3565 Update redis_storage.py 2022-05-04 19:55:43 +05:00
2d8c2312e3 Merge pull request #1529 from coder2020official/state-fixes
Allow only state objects
2022-05-03 13:02:24 +03:00
f9cd0d7e08 Avoid circular import 2022-05-02 14:45:43 +05:00
59cd1a00e7 Merge pull request #1528 from coder2020official/master
Seo improvements for documentation.
2022-05-02 00:30:55 +03:00
836130a718 Allow only state objects 2022-05-02 02:08:48 +05:00
a7db2d8d9c Merge branch 'eternnoir:master' into master 2022-05-01 23:20:02 +05:00
c022d49996 SEO improvements for documentation 2022-05-01 23:19:46 +05:00
825827cb1e Merge pull request #1527 from coder2020official/proxy-fix
Fixed proxy for asynctelebot
2022-05-01 17:26:54 +03:00
cd92b70d6b Update README.md 2022-05-01 19:13:49 +05:00
617c990994 Merge pull request #1526 from coder2020official/master
Key for custom filters
2022-05-01 17:01:37 +03:00
9b959373db Fixed proxy for asynctelebot 2022-05-01 18:43:07 +05:00
76c0197ab7 Key for custom filters 2022-05-01 16:11:00 +05:00
7d9658b062 Merge pull request #1525 from Badiboy/master
Polling exception logging updated
2022-05-01 14:00:50 +03:00
db0c946780 Polling exception logging updated
Polling exception logging arranged with infinity_polling mode
2022-05-01 00:17:14 +03:00
c6202da36f Merge pull request #1524 from coder2020official/master
Markdown & Html functions added(Beta version, still in progress)
2022-04-30 23:43:53 +03:00
532011138c Added examples for formatting 2022-05-01 00:58:06 +05:00
191164cba0 Fix traceback 2022-05-01 00:45:34 +05:00
5688aaa03b Markdown & Html functions added(Beta version, still in progress) 2022-05-01 00:28:00 +05:00
88a76c0a15 Merge pull request #1521 from Badiboy/master
Mistake in ChatAdministratorRights
2022-04-24 23:42:51 +03:00
e1dc6d7beb Mistake in ChatAdministratorRights 2022-04-24 23:41:08 +03:00
730d11012d Merge pull request #1517 from Badiboy/master
Bugfix in answer_web_app_query
2022-04-24 11:40:42 +03:00
b43b636ba0 Bugfix in answer_web_app_query 2022-04-24 11:33:19 +03:00
a7ca6c057e Merge pull request #1516 from Badiboy/master
i18n middleware - file revert
2022-04-24 11:29:47 +03:00
bd002c6429 i18n middleware - file revert 2022-04-24 11:28:20 +03:00
453df01f26 Merge pull request #1511 from abdullaev388/master
Added sync i18n class based middleware
2022-04-24 11:27:12 +03:00
24ae38cca6 added function based middleware i18n example 2022-04-24 12:51:01 +05:00
3b386965ea sync middleware examples separated into two folders 2022-04-24 11:52:01 +05:00
5077289d0d Merge pull request #1513 from Badiboy/master
typo
2022-04-23 20:20:17 +03:00
a54b21cb50 type 2022-04-23 20:19:25 +03:00
fa80cb0002 Merge pull request #1512 from Badiboy/master
Bot API 6.0. Deprecation fixes
2022-04-23 19:37:01 +03:00
ad5b92b650 Remove incorrect deprecation 2022-04-23 19:35:38 +03:00
9b1b324ab4 Bump version to 4.5.0 2022-04-23 16:33:59 +03:00
e444bc2a0b Payment example fix 2022-04-23 16:27:53 +03:00
dd25432359 Bot API 6.0. Deprecation fixes 2022-04-23 15:03:54 +03:00
cfbbfe84ad Merge pull request #1501 from coder2020official/master
Prepare for Bot API 6.0
2022-04-23 14:10:26 +03:00
b25d2846e9 TextFilter class supports case insensitiveness with lazy translations 2022-04-23 11:53:55 +05:00
ab64e17464 added new i18n class based middleware 2022-04-23 11:48:58 +05:00
3a5db47c1b removed old class based i18n middleware 2022-04-23 10:44:35 +05:00
4812dcb02b Fix typo in types.py 2022-04-22 23:06:11 +05:00
b146df346d Indentation fix to fit documentation. 2022-04-17 16:46:38 +05:00
5f2713bcfb Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2022-04-17 16:39:14 +05:00
a1bf961fd2 Bump Bot API 6.0(Beta) 2022-04-17 16:39:09 +05:00
a8451a5e30 Merge branch 'eternnoir:master' into master 2022-04-17 14:07:44 +05:00
9417c49d8e Merge pull request #1502 from Badiboy/master
Bump version to 4.4.1
2022-04-16 23:22:30 +03:00
1a40f1da7a Bump version to 4.4.1 2022-04-16 23:21:25 +03:00
5e28f27764 Bump version to 4.4.1 2022-04-16 23:17:19 +03:00
43d0e10ba4 Merge branch 'eternnoir:master' into master 2022-04-16 23:52:41 +05:00
9652fdbecb Update README.md 2022-04-16 23:50:45 +05:00
110575ca40 Merge pull request #1500 from coder2020official/master
Road to release(1st part)
2022-04-15 22:49:02 +03:00
22b4e636e2 Road to release(1st part) 2022-04-16 00:13:14 +05:00
1688a466f4 Merge pull request #1492 from nj-vs-vh/master
Issue #1491: missing await inserted
2022-04-01 18:54:37 +03:00
625da4cdd9 missing await inserted 2022-03-27 18:32:05 +04:00
a9e0f5b7b0 Merge pull request #1484 from coder2020official/master
Regular documentation update.
2022-03-21 01:36:15 +03:00
7b1b1a7caa Update PULL_REQUEST_TEMPLATE.md 2022-03-19 14:06:07 +05:00
a6477541c0 Documentation incorrect display is fixed now. 2022-03-19 13:49:36 +05:00
b652a9f6dc Update doc_req.txt 2022-03-19 13:26:09 +05:00
73b2813512 Update doc_req.txt 2022-03-10 20:22:42 +05:00
ace28983b6 Merge pull request #1475 from coder2020official/master
Fix
2022-03-08 22:53:55 +03:00
e82675320c Merge pull request #1474 from WuerfelDev/patch-1
Add TranslateThisVideoBot to the bot list
2022-03-08 22:53:13 +03:00
1e88671799 Merge branch 'eternnoir:master' into master 2022-03-08 12:07:09 +05:00
1cdf9640d7 Fix example on chat_member, fix middleware-exception for async 2022-03-08 12:07:00 +05:00
91badb53e5 Merge pull request #1473 from coder2020official/master
Docstrings of sync telebot updated to fit documentation. Basic middleware classes added.
2022-03-07 20:00:55 +03:00
477d02468d Fixed middlewares 2022-03-07 21:40:39 +05:00
9f3a270fae Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2022-03-07 21:13:49 +05:00
244b058648 Fix 2022-03-07 21:13:30 +05:00
886c9b9bc0 Update README.md 2022-03-07 20:38:22 +05:00
41025ba97b Update setup_python.yml 2022-03-07 20:26:11 +05:00
4875bb6188 Update requirements.txt 2022-03-07 19:04:12 +05:00
5f91c3d4e6 Added python 3.10 to tests 2022-03-07 18:56:16 +05:00
7b62915a5b Create PULL_REQUEST_TEMPLATE.md 2022-03-07 18:54:59 +05:00
05c3cb2c1d Update doc_req.txt 2022-03-07 18:08:41 +05:00
60a96d1400 Update README.md 2022-03-07 17:42:47 +05:00
dcd0df93da Update README.md 2022-03-07 17:39:42 +05:00
f15101fc6f Update doc_req.txt 2022-03-07 17:32:42 +05:00
5f03253398 Fix comments 2022-03-07 17:31:02 +05:00
8fab55e937 Create antiflood_middleware.py 2022-03-07 17:30:10 +05:00
60a23665cb Update flooding_middleware.py 2022-03-07 17:23:55 +05:00
b292b275cb Create basic_example.py 2022-03-07 17:21:59 +05:00
403028bf35 Update README.md 2022-03-07 17:14:51 +05:00
3dda5cff06 Create README.md 2022-03-07 17:14:25 +05:00
dd589e2490 Updated documentation to another theme. 2022-03-07 16:10:44 +05:00
c8fb83c97c Fix documentation 2022-03-07 14:24:28 +05:00
854f6a9506 Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2022-03-07 13:30:41 +05:00
be0557c2b5 Multiple middlewares allowed for async 2022-03-07 13:30:39 +05:00
436422e4da TranslateThisVideo Bot 2022-03-06 22:29:57 +01:00
fc72576aaa Update README.md 2022-03-07 00:39:25 +05:00
f69a2ba044 Update docstrings for asynctelebot. 2022-03-07 00:18:11 +05:00
c45e06c694 Updated description for TeleBot class 2022-03-06 23:23:33 +05:00
78bdf1ca4e Update docstrings 2022-03-06 23:14:07 +05:00
3c7d3c0196 Fix tests 2022-03-06 19:52:42 +05:00
441a5793cc Update docstrings to correct documentation. 2022-03-06 19:41:54 +05:00
388477686b Added middlewares.
Bumped middlewares
2022-03-06 18:39:41 +05:00
4f654d9e12 Add TranslateThisBot to the bot list 2022-03-06 04:26:40 +01:00
ac12d0fc02 Merge pull request #1467 from coder2020official/master
CallbackQuery usage with states.
2022-03-02 11:56:13 +03:00
b8ebe4fd58 Merge pull request #1469 from abdullaev388/master
argument of 'func' parameter in handlers can be async function
2022-03-01 18:11:20 +03:00
c84896391e argument of 'func' parameter in handlers can be async function 2022-03-01 14:39:00 +05:00
995e28e9d8 Remove unnecessary thing 2022-02-26 22:50:55 +05:00
1bfc082d46 Update documentation 2022-02-26 22:48:03 +05:00
1a35bbb127 Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2022-02-26 22:43:05 +05:00
e585c77830 Fix 2022-02-26 22:43:03 +05:00
5ca92ff637 Merge pull request #1465 from coder2020official/master
Added isinstance checkups in state filters
2022-02-26 13:07:53 +03:00
f4c76553ed Update asyncio_filters.py 2022-02-25 19:53:17 +05:00
75baf6dd96 Update custom_filters.py 2022-02-25 19:52:56 +05:00
301b9288a4 Merge branch 'eternnoir:master' into master 2022-02-25 19:47:50 +05:00
70b9fc86d2 Update custom_filters.py 2022-02-25 19:46:49 +05:00
dde9cd323c Update asyncio_filters.py 2022-02-25 19:45:52 +05:00
01a6827542 Merge pull request #1462 from coder2020official/master
Allow using non-class states
2022-02-23 11:32:01 +03:00
b960a9e574 Update custom_filters.py 2022-02-23 13:08:02 +05:00
102fe3a8fb Update asyncio_filters.py 2022-02-23 13:07:25 +05:00
292df419ba Merge pull request #1456 from abdullaev388/master
I18N class for sync telebot and middleware for async
2022-02-22 22:37:13 +03:00
7993e1d1c9 corrected setup middleware in async i18n middleware example 2022-02-21 20:08:03 +05:00
7309f92c36 Merge pull request #1459 from coder2020official/master
Fixed documentation and added link
2022-02-19 22:48:37 +03:00
7875ff293d Update README.md 2022-02-20 00:44:08 +05:00
4adac4d852 Update quick_start.rst 2022-02-20 00:40:25 +05:00
38bff65caf removed unused imports from util.py 2022-02-20 00:28:27 +05:00
9ecadf1bc1 Merge pull request #1458 from coder2020official/master
Bump documentation
2022-02-19 22:19:00 +03:00
5d7ae385ec token removed. 2022-02-20 00:12:14 +05:00
74e9780b30 BaseMiddleware returned to it's original place && I18N middleware is now only in examples 2022-02-20 00:08:14 +05:00
9b20f41ece I18N class removed from telebot.util.py 2022-02-19 23:57:21 +05:00
967309120e Merge pull request #1457 from Badiboy/master
Fix check of the regexp and commands types
2022-02-19 21:41:55 +03:00
94be2abdbd Typo 2022-02-19 21:39:52 +03:00
6c31b53cd9 Fix check of the regexp and commands types 2022-02-19 21:39:02 +03:00
9bfc0b2c6f preventet breaking change 2022-02-19 23:37:03 +05:00
fc374ec57a Merge pull request #1454 from Troshchk/message_handler_checking
Additional check of the regexp and commands types
2022-02-19 21:33:30 +03:00
7a8e60ddc2 Update index.rst 2022-02-19 22:41:09 +05:00
7f43f26886 Add telebot 2022-02-19 22:21:15 +05:00
4521982837 Create .readthedocs.yml 2022-02-19 22:17:29 +05:00
30c43b557c Documentation Bump 2022-02-19 21:56:51 +05:00
10b5886dcc Completed I18N examples descriptions 2022-02-19 18:56:27 +05:00
93b97fc3fe I18N middleware example was added 2022-02-19 18:47:36 +05:00
1f6e60fd74 I18N middleware implementation was added 2022-02-19 16:25:46 +05:00
5337d4838d asyncio_middlewares.py was created && BaseMiddleware class was replaced to asyncio_middlewares.py 2022-02-19 16:02:14 +05:00
ae5d183db0 slight TextFilter class improvement 2022-02-19 15:53:58 +05:00
0d85a34551 an example for i18n class was added 2022-02-19 15:07:46 +05:00
002c608d45 i18n class was added 2022-02-19 15:04:31 +05:00
ec766a3e43 Wrapping checking in private methods; warnings changed to errors 2022-02-16 14:05:54 +01:00
0ef8d04ed2 Merge pull request #1449 from abdullaev388/master
new advanced TextFilter was added && An example demostrating TextFilt…
2022-02-16 12:48:29 +03:00
3a86916e72 example of TextFilter starts_with and ends_with usage simultaneously 2022-02-16 12:43:23 +05:00
b41435f407 more descriptive exceptions 2022-02-16 12:29:27 +05:00
f689d90815 Merge pull request #1455 from Badiboy/master
Fix timer_bot.py
2022-02-15 19:55:32 +03:00
966f2e7ef7 Fix timer_bot.py 2022-02-15 19:55:12 +03:00
9075430210 Making first condition shorter, no change in functionality 2022-02-15 15:46:02 +01:00
68095ad69a Adding checks for the commands and regexp input types 2022-02-15 15:24:55 +01:00
8c3d1e608c new TextFilter examples were added 2022-02-12 21:53:40 +05:00
6822f18cbb multiple check patterns && multiple startwith, endswith fields 2022-02-12 21:41:10 +05:00
6e4f2e19d6 async text contains filter was fixed 2022-02-12 20:36:10 +05:00
8bbd062d13 text contains filter was fixed 2022-02-12 20:31:02 +05:00
5f7ccc8c9b created async TextFilter 2022-02-12 17:33:29 +05:00
5b1483f646 removed TextFilterKey in example, instead TextMatchFilter was modified 2022-02-12 17:07:59 +05:00
3cd86d0e93 token. again. 2022-02-12 15:31:54 +05:00
a893fbc358 async advanced callback_data example was added 2022-02-12 15:30:04 +05:00
6fd2a38fe9 An asyncio example demostrating TextFilter usage 2022-02-12 15:12:30 +05:00
b89ecb3e5a modified code 2022-02-12 14:32:59 +05:00
2e5590b566 token removed :) 2022-02-12 14:11:16 +05:00
733bb2ebbb new advanced TextFilter was added && An example demostrating TextFilter usage 2022-02-12 13:35:52 +05:00
64a22457e2 Merge pull request #1446 from abdullaev388/master
New CallbackData example
2022-02-10 12:26:12 +03:00
0c8e94d2c6 advanced usage of callbackdata was added 2022-02-10 13:43:19 +05:00
b9436821e0 callbackdata examples were separated into a directory 2022-02-10 13:33:44 +05:00
a8af9120de Merge pull request #1444 from skelly37/patch-1
Update README.md
2022-02-09 09:51:24 +03:00
0655a1f6b6 Update README.md
added my pyfram-telegram-bot
2022-02-09 00:27:18 +00:00
97dbedaa54 Fix &gt; 2022-02-07 00:57:33 +03:00
4028b44d07 Update README.md 2022-02-06 21:02:14 +03:00
661218c7e3 Merge pull request #1434 from coder2020official/master
Fix States
2022-02-02 13:57:08 +03:00
cd4a9add68 Fix States 2022-02-02 14:44:02 +04:00
7d2915c7f9 Merge pull request #1433 from Badiboy/master
Extend custom exception_handler behaviour
2022-02-02 10:40:58 +03:00
ce56a035b5 Extend custom exception_handler behaviour 2022-02-01 23:58:57 +03:00
9fa79aabc0 Merge pull request #1432 from coder2020official/master
Bot API 5.7
2022-02-01 17:31:35 +03:00
62fad9ca3a Fix tests 2022-02-01 18:16:53 +04:00
388f055643 Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2022-02-01 17:43:52 +04:00
71be20636a Bot API 5.7 2022-02-01 17:43:49 +04:00
3b38d1b46e Bot API 5.7 in readme 2022-02-01 14:51:36 +04:00
1e0c2ea633 Update README.md 2022-02-01 14:50:36 +04:00
4e7652be7a Bot API 5.7 2022-02-01 14:47:42 +04:00
723075d2da Merge pull request #1430 from barbax7/wrong_setup
Installing storage and asyncio_storage
2022-02-01 09:33:22 +03:00
7ba021871a Adding new way to install library 2022-01-31 23:09:18 +01:00
d7cb819502 Excluding tests and examples from packages to install 2022-01-31 22:58:52 +01:00
5ee2aa77c6 storage and asyncio_storage were not installed with previews setup function 2022-01-31 22:53:31 +01:00
80cf5d8d5b Merge pull request #1427 from barbax7/user
The output of get_me() is already an User object
2022-01-30 19:56:19 +03:00
69277400b7 The output of get_me() is already an User object 2022-01-30 17:53:55 +01:00
8d380b4913 Merge pull request #1423 from coder2020official/master
Code template
2022-01-25 14:42:29 +03:00
23d20e0753 Update README.md 2022-01-25 15:21:09 +04:00
6fc7beba57 Update README.md 2022-01-25 15:18:12 +04:00
8d49d22074 Merge pull request #1422 from Badiboy/master
Code base cleanup
2022-01-25 10:27:10 +03:00
6aa97d055f Bump version to 4.4.0 2022-01-25 10:25:53 +03:00
e55938e23a Keep python 3.6 check 2022-01-25 10:24:45 +03:00
4166fb229e Code base cleanup 2022-01-24 22:38:35 +03:00
2e9947277a Merge pull request #1421 from coder2020official/master
RedisStorage, middleware fix, pass_bot parameter and more
2022-01-24 21:25:16 +03:00
c350ea0ced Comment fixes 2022-01-24 21:34:50 +04:00
588b5c4d89 Fix parameter for example 2022-01-24 21:28:56 +04:00
91d0877c61 Fix parameter name to fit 2022-01-24 21:28:10 +04:00
8045ad56ea States Update 2022-01-24 21:24:56 +04:00
124b07ee44 Create __init__.py 2022-01-24 19:08:34 +04:00
195974ddc1 Fix 2022-01-24 18:33:59 +04:00
2b081b42bb Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2022-01-24 18:31:44 +04:00
321d241483 Delete types.py 2022-01-24 17:23:40 +04:00
ad4ff5835e Merge branch 'eternnoir:master' into master 2022-01-24 17:15:35 +04:00
a3cda2e0ff Updated sync and async. Fixes and new features. 2022-01-24 17:15:04 +04:00
cf2eb1fec7 Merge pull request #1418 from artyl/master
add default None for get_my_commands, examples for bot.set_my_commands
2022-01-21 22:48:11 +03:00
7eb759d1fd remove unused import 2022-01-21 22:25:06 +03:00
a07bf86c30 add default None for get_my_commands parameters scope and language_code sync\async, add examples for bot.set_my_commands 2022-01-21 21:50:33 +03:00
64c4aca3b7 Merge pull request #1417 from artyl/master
Add timer_bot sync and async example
2022-01-21 14:47:59 +03:00
40465643b9 Add timer_bot sync and async example 2022-01-21 12:32:23 +03:00
56fbf491bc Merge pull request #1411 from studentenherz/master
Removed redundant logger configuration in async_telebot
2022-01-12 10:26:35 +03:00
685c071056 Removed redundant logger configuration in async_telebot that made logs repeated twice 2022-01-11 19:24:16 -03:00
fdbc0e6a61 Merge pull request #1410 from barbax7/patch-1
Correct test for antiflood function
2022-01-10 18:36:15 +03:00
7fe8d27686 Correct test for antiflood function 2022-01-10 16:19:21 +01:00
9050f4af1f Merge pull request #1409 from Badiboy/master
Bugfix in send_data
2022-01-10 16:51:44 +03:00
9140044956 Tests ant type hint fix 2022-01-10 16:49:49 +03:00
2e6b6bda53 Additional bugfix
Additional bugfix
Plus protected methods removal
2022-01-10 16:40:33 +03:00
8d8aa5a380 Bugfix in send_data
Bugfix in send_data
Protected methods renamed
Some hints added
2022-01-10 14:38:28 +03:00
ae2dbd00fa Merge pull request #1405 from Badiboy/master
Bump version to 4.3.0
2022-01-08 20:03:30 +03:00
6550a5d745 Bump version to 4.3.0 2022-01-08 20:02:54 +03:00
593b27358b Merge pull request #1404 from coder2020official/master
Create webhook_fastapi_echo_bot.py
2022-01-03 23:01:37 +03:00
a51ff0f100 Fix readme typos 2022-01-03 16:30:49 +04:00
a96bc802bc Update README.md 2022-01-03 16:28:24 +04:00
df8f34e726 Create webhook_fastapi_echo_bot.py 2022-01-03 16:16:19 +04:00
00998ac9c8 Merge pull request #1402 from coder2020official/master
Push bot API to 5.6
2022-01-02 23:26:01 +03:00
3f243c64ca Fix data-typo 2022-01-02 22:09:09 +04:00
034241ba31 Fix commit 2022-01-02 14:58:15 +04:00
ed6fb57cb5 Added protect_content parameter to all methods 2022-01-02 14:53:47 +04:00
b71507387f Added spoiler 2022-01-02 14:12:15 +04:00
e7d0ec1f6c Fix asyncio_helper.py 2021-12-31 19:25:29 +04:00
b3b318fd28 Delete asyncio_types.py 2021-12-31 15:14:42 +04:00
d334f5cb8d Added protect_content parameter. Remade some methods. 2021-12-31 15:05:40 +04:00
7f06424980 Update README.md 2021-12-31 13:20:54 +04:00
7490aa0d26 Merge pull request #1400 from Badiboy/master
send_document param type fix
2021-12-25 16:26:50 +03:00
e59e2ee2ee send_document param type fix 2021-12-25 16:23:26 +03:00
f25dcad10c Merge pull request #1399 from coder2020official/master
_make_request edited
2021-12-25 15:32:51 +03:00
24a9491ec0 _make_request function edited 2021-12-25 16:04:29 +04:00
744549defe Merge pull request #1397 from EnriqueMoran/master
Added bot using pyTelegramBotAPI to readme
2021-12-23 23:38:03 +03:00
c86fc4c3fa Added bot to readme 2021-12-23 12:31:01 -08:00
943396767c Merge pull request #1392 from studentenherz/master
Added bot using pyTelegramBotAPI
2021-12-13 10:07:39 +03:00
13fffe58a1 Added bot using pyTelegramBotAPI 2021-12-12 23:23:52 -03:00
7fe60e19ef Merge pull request #1390 from coder2020official/master
Update README.md
2021-12-12 14:11:51 +03:00
ba9bf17f46 Update README.md 2021-12-12 15:54:06 +05:00
373ee4b45b Merge pull request #1389 from coder2020official/master
Polling is now asynchronous, and some readme fixes.
2021-12-12 13:28:57 +03:00
e5f0ba67fc Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2021-12-12 15:13:10 +05:00
096d58ae71 Update admin_filter_example.py 2021-12-12 15:13:07 +05:00
ed5b47cb96 Update README.md 2021-12-12 15:11:42 +05:00
e92946301f Asyncio.run back 2021-12-12 15:07:30 +05:00
7588c9fb9f infinity_polling 2021-12-10 21:32:57 +03:00
6d10bfefbd Merge pull request #1386 from zeph1997/master
Create a template for QWERTY custom keyboard an example for ReplyKeyboardMarkup
2021-12-10 21:32:19 +03:00
cebfbb83fa Merge branch 'master' of https://github.com/zeph1997/pyTelegramBotAPI 2021-12-11 02:28:41 +08:00
5a06d8021b changed markup.add row from hardcoded index to *row 2021-12-11 02:28:19 +08:00
a75841aa8e Merge branch 'eternnoir:master' into master 2021-12-11 02:11:44 +08:00
e76649bb49 Create reply_keyboard_markup_example.py
Example to show how to use ReplyKeyboardMarkup as well as a template for a QWERTY keyboard
2021-12-11 02:11:15 +08:00
7567c6cd71 Merge pull request #1384 from Badiboy/master
Bump version to 4.2.2
2021-12-08 23:45:27 +03:00
751deeafd7 Bump version to 4.2.2 2021-12-08 23:44:57 +03:00
3ebefa15bf Merge pull request #1383 from coder2020official/master
Bot API 5.5
2021-12-08 13:19:56 +03:00
bb19687854 fix 2021-12-08 15:15:57 +05:00
311eec6888 fix 2021-12-08 14:15:40 +05:00
08fc32b70a Comment fix 2021-12-08 14:13:39 +05:00
555257a3fe Documentation Bug fixed 2021-12-08 14:00:39 +05:00
5a03ab62d0 Update test_types.py 2021-12-07 22:27:19 +05:00
038be81db3 5.5 2021-12-07 22:17:51 +05:00
fbf34f5953 Bump version to 4.2.1 - AsyncTeleBot alpha 2021-12-04 20:25:39 +03:00
4347dd3dd9 Merge pull request #1380 from coder2020official/master
2 new examples and behaviour change
2021-12-04 20:08:26 +03:00
d830ae0b15 Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2021-12-04 22:03:56 +05:00
4f198bc6f5 Forgot to update file 2021-12-04 22:03:14 +05:00
66615a41c4 Merge branch 'eternnoir:master' into master 2021-12-04 21:57:32 +05:00
a5ee5f816c Update README.md 2021-12-04 21:57:16 +05:00
fb52137bff 2 new examples 2021-12-04 21:54:26 +05:00
7ee07f4dc7 Merge pull request #1379 from Badiboy/master
Readme
2021-12-04 19:44:00 +03:00
f224069a34 Update README.md 2021-12-04 19:43:33 +03:00
6cca77f755 Update README.md 2021-12-04 19:43:01 +03:00
084289baa4 Merge pull request #1378 from Badiboy/master
Readme minor fixed
2021-12-04 19:42:08 +03:00
e2dbb88459 Readme minor fixed 2021-12-04 19:41:25 +03:00
a2822c74ed Update README.md 2021-12-04 21:34:15 +05:00
4cd30c75ac Merge pull request #1377 from coder2020official/master
Exception handler, Boolean Fix and more
2021-12-04 19:33:53 +03:00
f4b9480588 Update README.md 2021-12-04 21:25:47 +05:00
482589af49 Update README.md 2021-12-04 21:25:14 +05:00
bbe4a96984 Update README.md 2021-12-04 21:23:23 +05:00
60294d0c41 Update README.md 2021-12-04 21:22:44 +05:00
3035763277 Update send_file_example.py 2021-12-04 21:22:00 +05:00
51eabde320 Update 2021-12-04 21:11:51 +05:00
a5305f551c Update README.md 2021-12-03 21:13:02 +05:00
1f918dece5 Merge pull request #1375 from coder2020official/master
Forgot to make polling sync
2021-11-27 23:12:15 +03:00
fc152f37ad Merge branch 'eternnoir:master' into master 2021-11-28 01:05:11 +05:00
411c7e915a No asyncio.run() 2021-11-28 01:04:49 +05:00
5bf2415653 Merge pull request #1374 from Badiboy/master
Python 3.10 added
2021-11-27 22:30:25 +03:00
7d9856dae3 Python 3.10 added 2021-11-27 22:29:57 +03:00
a308ab12fa Asynchronous TeleBot version Alpha release 2021-11-27 22:28:46 +03:00
d58336adcb Fix 2021-11-28 00:25:56 +05:00
bfc0b8ecd5 Update async_telebot.py 2021-11-28 00:21:09 +05:00
a9b422783f Middlewares, new file, and examples 2021-11-27 23:41:39 +05:00
e015b4c010 Merge pull request #1373 from Carlosma7/master
Add GrandQuiz Bot by Carlosma7
2021-11-27 18:49:05 +03:00
f666c15a1f Add GrandQuiz Bot by Carlosma7 2021-11-27 16:32:58 +01:00
6770011dd7 Middleware support 2021-11-27 19:04:03 +05:00
d7b0513fb1 Merge branch 'eternnoir:master' into master 2021-11-26 21:05:05 +05:00
9932ade00e Merge pull request #1369 from abdullaev388/master
CallbackData class added
2021-11-24 18:32:42 +03:00
8b6eba8203 Docstrings added 2021-11-24 20:26:58 +05:00
9c8ea29fc6 token removed :) 2021-11-23 18:15:52 +05:00
714ae7d67f CallbackData class added 2021-11-23 18:01:51 +05:00
1e4477c148 Logging fix 2021-11-20 16:01:38 +05:00
53f9232f36 Update requirements.txt 2021-11-20 15:54:43 +05:00
1f05b47ad6 Asynchronous Telebot 2021-11-20 15:47:55 +05:00
98d63d235f Merge pull request #1360 from JoachimStanislaus/master
added Google Sheet bot to list of bot examples.
2021-11-11 12:40:36 +03:00
7925bdc6c9 added Google Sheet bot to list of bot examples. 2021-11-11 17:21:56 +08:00
4ba23562ef Merge pull request #1358 from Badiboy/master
Update readme and typo
2021-11-08 19:11:11 +03:00
e22a7fecea One more readme update... 2021-11-08 18:53:10 +03:00
9b99bb5f21 Update readme and typo 2021-11-08 18:51:42 +03:00
c39b3aaaf3 Merge pull request #1357 from Badiboy/master
Bump to version 4.2.0
2021-11-08 18:37:03 +03:00
d14ac2fe85 Bump to version 4.2.0 2021-11-08 18:35:55 +03:00
04f3e518da Merge remote-tracking branch 'upstream/master' 2021-11-08 18:33:10 +03:00
5f5298bcd1 Merge pull request #1356 from Badiboy/master
RETRY_ENGINE
2021-11-08 18:33:00 +03:00
7f1497c5e9 Merge remote-tracking branch 'upstream/master' 2021-11-08 18:32:38 +03:00
5ac71baafe RETRY_ENGINE
Added RETRY_ENGINE var to api_helper.

Added RETRY_ENGINE = 2 based on native "requests" retry mechanism.
2021-11-07 23:02:23 +03:00
695c699893 Merge pull request #1353 from coder2020official/master
Bot API 5.4 features
2021-11-06 18:02:01 +03:00
bf96f13296 Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2021-11-06 19:59:59 +05:00
62b1ec04ab Update __init__.py 2021-11-06 19:59:44 +05:00
e412d2f084 Update README.md 2021-11-06 19:56:10 +05:00
8003ff5e59 Delete states.pkl 2021-11-06 19:51:29 +05:00
becce1f580 Update apihelper.py 2021-11-06 19:51:05 +05:00
3a6073e3a0 Update custom_states.py 2021-11-06 13:08:49 +05:00
fc347ae166 Update custom_states.py 2021-11-06 13:06:43 +05:00
8dcfa0c282 Little fix for states 2021-11-06 12:52:41 +05:00
6808ab3ebe Update test_types.py 2021-11-06 12:42:48 +05:00
31097c5380 Update test_types.py 2021-11-06 12:34:49 +05:00
d49c57699e Tests 2021-11-06 12:27:19 +05:00
ed6616e4c7 Bot API 5.4 2021-11-06 12:21:02 +05:00
953e2286b8 Bot API 5.4 2021-11-06 12:15:28 +05:00
06c8782127 Little update
Allowed other handlers, checked methods and other things
2021-11-05 23:22:03 +05:00
2623fa362c Merge pull request #1350 from Badiboy/master
Custom request sender
2021-11-03 18:50:25 +03:00
4a274ba440 Custom request sender
Added apihelper.CUSTOM_REQUEST_SENDER option. It allows to substitute requests.request to your own function.
2021-11-03 18:48:46 +03:00
bfef7e1ce2 Merge pull request #1349 from barbax7/antiflood
Antiflood
2021-11-03 17:38:32 +03:00
558b37b1c3 New antiflood function 2021-11-03 15:30:10 +01:00
d1c26f82aa Merge pull request #1346 from DevAdvik/patch-1
Added A New Bot - @ETHGasFeeTrackerBot
2021-10-24 19:09:04 +03:00
1a351bc8c7 Added A New Bot 2021-10-24 20:38:15 +05:30
27546daad9 Merge pull request #1345 from resinprotein2333/patch-1
Update README.md
2021-10-24 11:48:02 +03:00
bb58d3fead Update README.md
Add my bot into the bot list
2021-10-24 16:45:49 +08:00
099d638a7e Merge pull request #1338 from barbax7/exceptions
Added description of the ApiTelegramException as attribute of the class
2021-10-17 11:29:44 +03:00
5fb48e68a0 Added description of the ApiTelegramException as attribute of the class 2021-10-16 17:45:15 +02:00
b979c2fa1f Merge pull request #1336 from coder2020official/master
File support for states
2021-10-14 17:23:43 +03:00
b6625baec6 Update __init__.py 2021-10-13 19:02:17 +05:00
98044d6faa File support for states
File support. Now states can be saved in pickle file
2021-10-13 18:34:36 +05:00
2113846567 Merge pull request #1330 from Badiboy/master
Bump version 4.1.1
2021-10-09 22:31:59 +03:00
5c9d4edca9 Bump version 4.1.1 2021-10-09 22:31:34 +03:00
4dce9340b0 Merge pull request #1326 from TrevorWinstral/master
Added my bots to README
2021-10-08 13:45:24 +03:00
bf79e8341e Moved bots to bottom of list 2021-10-08 10:39:59 +00:00
dadfdc2f13 Updated README with my bots 2021-10-06 14:15:30 +02:00
585f627e1f Updated README with my bots 2021-10-06 14:14:05 +02:00
eead303d47 Updated README with my bots 2021-10-06 14:13:05 +02:00
14cc15c711 Merge pull request #1325 from coder2020official/master
Critical fix
2021-10-01 21:47:50 +03:00
bf8736e17e Critical fix 2021-10-01 23:29:59 +05:00
5014ca2459 Merge pull request #1324 from coder2020official/master
Update of state handlers
2021-10-01 14:55:09 +03:00
f337abe06e Update __init__.py 2021-10-01 16:09:20 +05:00
ff35f25211 Update __init__.py 2021-10-01 16:08:01 +05:00
2e4280a947 Update of state handlers
No need to create state handlers
2021-10-01 15:56:54 +05:00
4a6b5b3d28 Merge pull request #1322 from Badiboy/master
Bugfix with one_time_keyboard = False
2021-09-30 11:57:54 +03:00
a28af3903d Bugfix with one_time_keyboard = False 2021-09-30 11:56:36 +03:00
d1d5b9effb Merge pull request #1320 from Badiboy/master
polling should leave our world. :)
2021-09-28 19:18:32 +03:00
062fababf2 polling should leave our world. :) 2021-09-28 19:17:09 +03:00
946afcc3c1 Merge pull request #1317 from coder2020official/master
Update handler_backends.py
2021-09-25 21:35:25 +03:00
6e502cd1c6 Merge branch 'master' into master 2021-09-25 23:29:50 +05:00
0a7f897f05 Merge pull request #1318 from Badiboy/master
States minor update
2021-09-25 21:15:52 +03:00
b35f17124f States minor update 2021-09-25 21:15:24 +03:00
44b44ac2c5 Optimization 2021-09-25 23:05:36 +05:00
39e875c1ea Update handler_backends.py 2021-09-25 22:49:32 +05:00
be7317cc86 Merge pull request #1315 from coder2020official/master
States, New filter, and more
2021-09-25 20:43:33 +03:00
e1c33a1de6 Merge pull request #1316 from Badiboy/master
Release 4.1.0
2021-09-25 20:34:05 +03:00
8149551a15 Release 4.1.0 2021-09-25 20:33:32 +03:00
ab648ef3db Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2021-09-25 22:19:09 +05:00
e721910c0c Update __init__.py 2021-09-25 22:19:07 +05:00
9287eced49 Update a typo 2021-09-25 21:10:29 +05:00
967b94b14f Update handler_backends.py 2021-09-25 20:27:03 +05:00
2df6f00ba5 Optimization
Optimized code, added filters support
2021-09-25 18:22:54 +05:00
beb4f8df44 Update register_handler.py 2021-09-25 17:15:33 +05:00
92ac5a4166 States, and some minor improvements 2021-09-25 17:12:32 +05:00
716323e56a Register_XXX_Handler 2021-09-22 22:46:19 +05:00
cd92d95f91 Create admin_filter_example.py 2021-09-22 22:37:57 +05:00
9c86ed623d Update custom_filters.py 2021-09-22 22:37:18 +05:00
c6ff9b07df Merge pull request #1311 from SwissCorePy/master
added property `user` to TeleBot class
2021-09-20 15:40:14 +03:00
38cc96d0f3 added property user to TeleBot class
Added property `user` to TeleBot class. The idea is to have easy access to the user object representing the bot without doing an API call every time.
2021-09-20 14:31:00 +02:00
82518d8664 Merge pull request #1309 from bim-ba/master
Added new example: anonymous chat-bot
2021-09-19 17:50:51 +03:00
aba2a9e179 Improve readabilty of "elif-zone" 2021-09-19 17:41:07 +03:00
c5c4d081ea Added new example: anonymous chat-bot 2021-09-18 19:46:53 +03:00
f854163626 Merge pull request #1308 from coder2020official/master
Added example and editd description.
2021-09-14 13:08:45 +03:00
fc31a2d466 Update custom_filters.py 2021-09-14 15:02:54 +05:00
86a0a8cd68 Little fixes and example
Fixed is_forwarded custom filter & created example
2021-09-14 15:00:27 +05:00
31c3b3b28e Merge pull request #1307 from coder2020official/master
Update custom_filters.py
2021-09-13 23:26:40 +03:00
b95ab104e3 Update custom_filters.py 2021-09-13 23:09:06 +05:00
a54e4c22a8 Merge pull request #1305 from Badiboy/master
4.0.1 beta release
2021-09-12 21:13:38 +03:00
7913e25be2 4.0.1 beta release 2021-09-12 21:12:19 +03:00
63cbda8890 Merge pull request #1304 from Badiboy/master
README contents update
2021-09-12 20:53:04 +03:00
38851bce22 README contents update 2021-09-12 20:02:49 +03:00
74835c40ea Merge pull request #1303 from Badiboy/master
Update custom filters readme and examples
2021-09-12 19:42:36 +03:00
97e99b4910 Fix 2021-09-12 19:39:26 +03:00
4ced4d29f5 Update custom filters readme and examples 2021-09-12 19:36:23 +03:00
239a90de14 Merge pull request #1302 from coder2020official/master
Some useful filters
2021-09-12 19:14:46 +03:00
c86af0496b Update README.md 2021-09-12 20:43:09 +05:00
4071ab9124 Update README.md 2021-09-12 20:41:26 +05:00
5c715dabc3 Update README.md 2021-09-12 20:40:31 +05:00
43d2d8583e Update README.md 2021-09-12 20:32:16 +05:00
cf78234e3a Update README.md 2021-09-12 20:30:32 +05:00
5f4cd09490 Update README.md 2021-09-12 20:28:46 +05:00
8534804c0c Update README.md 2021-09-12 20:28:01 +05:00
cf75e76e5c Update README.md 2021-09-12 20:27:01 +05:00
7d5e9e5111 Added file custom_filters
Added file with custom filters. Updated the examples
2021-09-12 20:22:26 +05:00
1ceec3cb54 Update custom_filters.py 2021-09-12 19:38:54 +05:00
5f8c75816e Some useful filters
Created useful filters that can be used in message handlers.
Created some examples on using them.
2021-09-12 19:34:43 +05:00
4e37662ab3 upd 2021-09-12 00:30:56 +05:00
a97a917522 Merge pull request #1301 from coder2020official/master
Custom filters example
2021-09-11 22:30:50 +03:00
88f91518c7 Update __init__.py 2021-09-12 00:27:51 +05:00
e89acc8ba6 Update custom_filters.py 2021-09-12 00:27:04 +05:00
5d611ea7f3 upd 2021-09-12 00:24:52 +05:00
5c80f11261 Updated __init__.py 2021-09-12 00:21:35 +05:00
f2202b44fe Merge pull request #1300 from Badiboy/master
Custom filters upd
2021-09-11 21:51:09 +03:00
2da48c0adc Custom filters upd 2021-09-11 21:49:51 +03:00
389407e3ee Merge pull request #1299 from Badiboy/master
Custom filters upd
2021-09-11 21:14:43 +03:00
14be2b8c18 Custom filters upd 2021-09-11 21:10:21 +03:00
df7808264f Merge pull request #1298 from coder2020official/master
Custom filters
2021-09-11 21:03:28 +03:00
9d37503442 reupdated 2021-09-11 23:02:56 +05:00
dd6f39c3cd Merge pull request #1296 from Badiboy/master
Filter clearance
2021-09-11 20:57:55 +03:00
8e4d70b9c6 Update __init__.py 2021-09-11 22:30:53 +05:00
87fb30d57b Update __init__.py 2021-09-11 22:03:37 +05:00
8f3371dcd5 Update __init__.py 2021-09-11 21:59:28 +05:00
ec8975c9e3 Custom filters
Added new feature - from now you can create your own custom filters
2021-09-11 21:47:59 +05:00
16edfbb9dc Warning if commands or content_types filters are strings 2021-09-11 19:26:55 +03:00
f70b135359 Filter clearance
1. Filter optimization: should not store empty filters
2. Filter order: chat_type, content, others
3. Default session timeout set to 600 instead of "forever".
4. Type
2021-09-11 17:02:40 +03:00
78fb69ded1 Merge pull request #1295 from coder2020official/master
is_private filter
2021-09-10 22:17:05 +03:00
0f7eb1571e Update README.md 2021-09-10 20:42:48 +05:00
ac54b7abd4 Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2021-09-10 20:42:51 +05:00
0f3a6393fc Update __init__.py 2021-09-10 20:42:43 +05:00
de6f339cdf Update README.md 2021-09-10 17:57:19 +05:00
d0969bd5f3 Merge branch 'master' of https://github.com/coder2020official/pyTelegramBotAPI 2021-09-10 17:57:13 +05:00
4035a38507 Update __init__.py 2021-09-10 17:56:44 +05:00
944b077c65 Update README.md 2021-09-10 17:30:58 +05:00
644c6b9082 is_private 2021-09-10 17:30:17 +05:00
dc9f8db556 Merge pull request #1288 from SwissCorePy/master
Added missing content_type "animation"
2021-09-02 22:34:51 +03:00
07ebdeab25 Added missing content_type "animation" 2021-09-02 19:46:01 +02:00
e8738cce7d Merge pull request #1284 from Badiboy/master
Bump version to 4.0 release
2021-08-30 13:50:32 +03:00
d9e638a7df Bump version to 4.0 release 2021-08-30 13:49:28 +03:00
08b1dd31c8 Merge pull request #1277 from fgallaire/master
A Google Cloud Functions webhook
2021-08-25 15:19:51 +03:00
b4f0a6d546 add Google in the name 2021-08-25 14:17:25 +02:00
4eb28df1ab A Google Cloud Functions webhook 2021-08-24 13:01:10 +02:00
50e5e96bb1 Merge pull request #1275 from Badiboy/master
chat_invite_link bugfix
2021-08-22 22:17:30 +03:00
bd3a9bc350 chat_invite_link bugfix 2021-08-22 22:16:03 +03:00
06923c8274 Merge pull request #1272 from Badiboy/master
Simplify and speedup _test_filter
2021-08-20 15:55:10 +03:00
3efc2cf869 Typo 2021-08-19 23:36:37 +03:00
f5de0eeacf Simplify and speedup _test_filter 2021-08-19 22:46:12 +03:00
6e871b8eb1 Merge pull request #1270 from Badiboy/master
Check and update for full compatibility to Bot API up to 5.3
2021-08-18 23:31:15 +03:00
f6359bc32c Readme fix 2021-08-18 23:29:40 +03:00
2bc052ad5a Check and update for full compatibility to Bot API up to 5.3
Pre-release of 4.0.0
2021-08-18 23:27:28 +03:00
022ef6a64c Dependecies clearing 2021-08-18 22:16:30 +03:00
3232811543 Merge pull request #1269 from Badiboy/master
Check and update for full compatibility to Bot API up to 5.0
2021-08-18 22:01:12 +03:00
fabcd93dd7 API update fix 03 2021-08-18 21:57:56 +03:00
8053183cb5 API update fix 02 2021-08-18 19:36:48 +03:00
b2b7d90888 API update fix 01 2021-08-18 19:32:43 +03:00
3e9d73c25d Merge remote-tracking branch 'upstream/master' 2021-08-18 18:52:09 +03:00
d6501ddc0e Check and update for full compatibility to Bot API up to 5.0 2021-08-18 18:47:38 +03:00
e818e3875d Merge pull request #1266 from coder2020official/master
New set of register_xxx_handler functions for dynamic handlers registering.
2021-08-17 16:50:00 +03:00
56cd3971dc Update __init__.py 2021-08-16 22:41:27 +04:00
958ca34e9c Merge pull request #1264 from coder2020official/master
Added skip_pending parameter to polling and infinity_polling in addition to skip_pending in Telebot.Init. Allows skip pending updates for already created Bot instances.
2021-08-16 21:07:41 +03:00
f4ef2366b6 Update skip_updates_example.py 2021-08-16 22:03:17 +04:00
f553960096 Update __init__.py 2021-08-16 22:00:08 +04:00
24ef64456b Update __init__.py 2021-08-16 14:53:00 +04:00
3e7da0fd18 Update skip_updates_example.py 2021-08-16 14:49:45 +04:00
2c0f42b363 Update __init__.py 2021-08-16 14:48:21 +04:00
1e4a6e2125 Update __init__.py 2021-08-15 13:32:11 +04:00
beeb60aab8 skip_updates 2021-08-15 11:40:13 +04:00
5b942a5b31 Merge pull request #1263 from coder2020official/master
Create chat_member_example.py
2021-08-14 17:55:15 +03:00
3e4a6cd702 Create chat_member_example.py 2021-08-14 18:46:45 +04:00
0e369953cb Merge pull request #1261 from Badiboy/master
BotCommandScopeChatMember fix
2021-08-12 15:17:11 +03:00
911e356930 BotCommandScopeChatMember fix 2021-08-12 15:16:04 +03:00
554b39a49a Merge pull request #1257 from AmolDerickSoans/master
Add IPO bot
2021-08-06 14:48:51 +03:00
ea16f35432 Add IPO bot
Listed oneIPO bot created using pyTelegramBotAPI in  section : Bpts using this API
2021-08-06 12:29:00 +05:30
81d94687be Merge pull request #1254 from snikidev/bug/InputInvoiceMessageContent-return-statement
🐛 Bugfix: Add return statement to to_dict() method inside InputInvoiceMessageContent type
2021-08-03 21:03:38 +03:00
4ba4bc18cf add extra space 2021-08-03 17:35:59 +01:00
c117ff2d50 Add return statement to to_dict() method inside InputInvoiceMessageContent 2021-08-03 17:34:29 +01:00
735c224444 Merge pull request #1248 from coder2020official/master
caption_entities in edit_message_caption
2021-07-30 19:11:05 +03:00
81adfd335e UPD 2021-07-30 19:15:37 +05:00
7ebe589b46 Update __init__.py 2021-07-28 23:10:15 +05:00
9c1b19a9e4 upd 2021-07-28 23:06:31 +05:00
02b886465e new filters 2021-07-25 15:46:53 +05:00
2d89ceb745 Merge pull request #1241 from Badiboy/master
Release version 3.8.2
2021-07-21 21:54:29 +03:00
ae8c3252df Release version 3.8.2 2021-07-21 21:53:56 +03:00
7914f71938 Merge pull request #1237 from monosans/comprehension
Replace for loops with comprehensions
2021-07-19 23:40:55 +03:00
097ba9fec2 Replace for loops with comprehensions 2021-07-19 20:03:03 +03:00
d09d9f0c09 Merge pull request #1232 from Badiboy/master
Invoice tips typo fix
2021-07-15 09:27:49 +03:00
29c98b0230 Invoice tips typo fix 2021-07-15 09:27:07 +03:00
2b1db1f1b3 Merge pull request #1231 from vnagornyy/master
Added tip for invoice
2021-07-15 09:23:10 +03:00
fa80b1dba0 Added tip for invoice 2021-07-15 08:56:04 +03:00
b45db584df Merge pull request #1230 from Badiboy/master
Fix worker_pool issue
2021-07-13 22:16:48 +03:00
f52ea635e5 Fix worker_pool issue 2021-07-13 22:09:56 +03:00
9b56afd569 Merge pull request #1229 from Badiboy/master
Fix CallbackQuery issue for games
2021-07-13 20:13:36 +03:00
6fb10e92e4 Fix CallbackQuery issue for games 2021-07-13 20:11:47 +03:00
fcf4d91564 Merge remote-tracking branch 'upstream/master' 2021-07-13 20:00:17 +03:00
38319871e6 Merge pull request #1225 from dannkunt/patch-1
Fix wrong type hint
2021-07-13 11:32:06 +03:00
2d0b092ea4 Fix wrong type hint
call.id gives int
2021-07-10 22:03:31 +03:00
060b8c61bb Merge remote-tracking branch 'upstream/master' 2021-07-09 10:50:53 +03:00
db2accc2f8 Merge pull request #1223 from Badiboy/master
Timeouts in making requests are rethought
2021-07-09 10:50:46 +03:00
798fda4c8a Merge remote-tracking branch 'upstream/master' 2021-07-09 10:50:03 +03:00
2578e48134 Timeouts in making requests are rethought 2021-07-09 10:42:56 +03:00
ac20216a7a Merge pull request #1222 from Badiboy/master
Preserve dict change in de_json routines
2021-07-08 13:43:09 +03:00
beb5a456eb Preserve dict change in Update 2021-07-08 09:35:48 +03:00
41faadd572 Merge pull request #1221 from AndydeCleyre/feature/mentioncolorcodebot
mention colorcodebot as a project using this library
2021-07-08 08:36:22 +03:00
a15016d7d9 mention colorcodebot as a project using this library 2021-07-07 13:00:32 -04:00
47dd84c441 Merge pull request #1216 from SwissCorePy/master
fixed bug
2021-07-01 20:04:37 +03:00
c7b360e982 fixed bug 2021-07-01 18:54:39 +02:00
09041b018f Merge pull request #1215 from SwissCorePy/master
Added the property `difference` to the class ChatMemberUpdated
2021-06-30 17:33:13 +03:00
3a4cf47def Merge branch 'master' of https://github.com/SwissCorePy/pyTelegramBotAPI 2021-06-30 14:16:54 +02:00
56e4f68a83 added the property difference to ChatMemberUpdated 2021-06-30 14:16:38 +02:00
484e7fccbd Merge pull request #1214 from SwissCorePy/master
new deprecated decorator
2021-06-30 15:01:46 +03:00
791d65e95a replaced old deprecated decorator 2021-06-30 13:47:39 +02:00
073d7fb6a7 Update util.py
whoops warn is not optional
2021-06-30 13:11:48 +02:00
a6668397e1 new deprecated decorator
added a new deprecated decorator to util
2021-06-30 13:08:05 +02:00
983d626d87 Merge pull request #1212 from Badiboy/master
Update file_name to visible_file_name in send_document
2021-06-29 13:31:25 +03:00
a4e73a05c6 Update file_name to visible_file_name in send_document 2021-06-29 13:30:01 +03:00
30e304ffb5 Merge pull request #1204 from floydya/file-name-patch
Allows to set visible document file_name on send.
2021-06-29 13:27:44 +03:00
430b34c7a2 Merge pull request #1210 from SwissCorePy/master
README update
2021-06-28 17:15:45 +03:00
b222416fd8 Update README.md 2021-06-28 15:44:49 +02:00
f8110cd046 Update README.md
* Added the new message_handlers
* Added some information about local Bot API Server
* Replaced the split_string with the smart_split function
2021-06-28 15:17:53 +02:00
6bc60f4aa9 Merge pull request #1208 from SwissCorePy/master
get_chat_member_count and ban_chat_member added.
get_chat_members_count and kick_chat_member are marked as deprecated.
2021-06-28 13:09:19 +03:00
b48a445e9f Update __init__.py
updated docstrings
2021-06-28 12:02:40 +02:00
0b383498eb addded logger info for deprecated funcs 2021-06-28 11:59:21 +02:00
2e3b4223a5 Merge pull request #1209 from Badiboy/master
Release 3.8.1 - bugfix
2021-06-28 12:41:38 +03:00
60bb63ab2b Release 3.8.1 - bugfix 2021-06-28 12:41:15 +03:00
0aa7a8a8f6 new 5.3 function names
added the new function names (the previous names are still working) from 5.3 and some other small changes
2021-06-28 09:31:06 +02:00
a791ff4e46 Add tests for file sending with name 2021-06-27 11:58:33 +03:00
e56f134a7c Add file_name support to send_document method 2021-06-27 11:38:45 +03:00
38c4c21030 Add file_name argument to send_data method 2021-06-27 11:37:27 +03:00
174 changed files with 62751 additions and 2580 deletions

14
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,14 @@
## Description
Include changes, new features and etc:
## Describe your tests
How did you test your change?
Python version:
OS:
## Checklist:
- [ ] I added/edited example on new feature/change (if exists)
- [ ] My changes won't break backward compatibility
- [ ] I made changes both for sync and async

View File

@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.6','3.7','3.8','3.9', 'pypy-3.6', 'pypy-3.7' ] #'pypy-3.8', 'pypy-3.9' NOT SUPPORTED NOW
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9']
name: ${{ matrix.python-version }} and tests
steps:
- uses: actions/checkout@v2

5
.gitignore vendored
View File

@ -25,6 +25,7 @@ var/
.idea/
venv/
.venv/
# PyInstaller
# Usually these files are written by a python script from a template
@ -63,3 +64,7 @@ testMain.py
#VS Code
.vscode/
.DS_Store
*.code-workspace
# documentation
_build/

19
.readthedocs.yml Normal file
View File

@ -0,0 +1,19 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py
# Optionally build your docs in additional formats such as PDF and ePub
formats: all
# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: doc_req.txt

View File

@ -1,9 +1,10 @@
language: python
python:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "pypy3"
install: "pip install -r requirements.txt"
script:

540
README.md
View File

@ -1,13 +1,23 @@
# <p align="center">pyTelegramBotAPI
<p align="center">A simple, but extensible Python implementation for the <a href="https://core.telegram.org/bots/api">Telegram Bot API</a>.
[![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)
[![Build Status](https://travis-ci.org/eternnoir/pyTelegramBotAPI.svg?branch=master)](https://travis-ci.org/eternnoir/pyTelegramBotAPI)
[![Documentation Status](https://readthedocs.org/projects/pytba/badge/?version=latest)](https://pytba.readthedocs.io/en/latest/?badge=latest)
[![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)
* [Getting started.](#getting-started)
# <p align="center">pyTelegramBotAPI
<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#march-9-2023">6.6</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>
## Contents
* [Getting started](#getting-started)
* [Writing your first bot](#writing-your-first-bot)
* [Prerequisites](#prerequisites)
* [A simple echo bot](#a-simple-echo-bot)
@ -16,35 +26,53 @@
* [Methods](#methods)
* [General use of the API](#general-use-of-the-api)
* [Message handlers](#message-handlers)
* [Edited Message handler](#edited-message-handler)
* [Channel Post handler](#channel-post-handler)
* [Edited Channel Post handler](#edited-channel-post-handler)
* [Callback Query handlers](#callback-query-handler)
* [Middleware handlers](#middleware-handler)
* [Shipping Query Handler](#shipping-query-handler)
* [Pre Checkout Query Handler](#pre-checkout-query-handler)
* [Poll Handler](#poll-handler)
* [Poll Answer Handler](#poll-answer-handler)
* [My Chat Member Handler](#my-chat-member-handler)
* [Chat Member Handler](#chat-member-handler)
* [Chat Join request handler](#chat-join-request-handler)
* [Inline Mode](#inline-mode)
* [Inline handler](#inline-handler)
* [Chosen Inline handler](#chosen-inline-handler)
* [Answer Inline Query](#answer-inline-query)
* [Additional API features](#additional-api-features)
* [Middleware handlers](#middleware-handlers)
* [Custom filters](#custom-filters)
* [TeleBot](#telebot)
* [Reply markup](#reply-markup)
* [Inline Mode](#inline-mode)
* [Advanced use of the API](#advanced-use-of-the-api)
* [Asynchronous delivery of messages](#asynchronous-delivery-of-messages)
* [Using local Bot API Server](#using-local-bot-api-sever)
* [Asynchronous TeleBot](#asynchronous-telebot)
* [Sending large text messages](#sending-large-text-messages)
* [Controlling the amount of Threads used by TeleBot](#controlling-the-amount-of-threads-used-by-telebot)
* [The listener mechanism](#the-listener-mechanism)
* [Using web hooks](#using-web-hooks)
* [Logging](#logging)
* [Proxy](#proxy)
* [API conformance](#api-conformance)
* [Change log](#change-log)
* [Testing](#testing)
* [API conformance limitations](#api-conformance-limitations)
* [AsyncTeleBot](#asynctelebot)
* [F.A.Q.](#faq)
* [Bot 2.0](#bot-20)
* [How can I distinguish a User and a GroupChat in message.chat?](#how-can-i-distinguish-a-user-and-a-groupchat-in-messagechat)
* [How can I handle reocurring ConnectionResetErrors?](#how-can-i-handle-reocurring-connectionreseterrors)
* [The Telegram Chat Group](#the-telegram-chat-group)
* [Telegram Channel](#telegram-channel)
* [More examples](#more-examples)
* [Bots using this API](#bots-using-this-api)
* [Code Template](#code-template)
* [Bots using this library](#bots-using-this-library)
## Getting started.
## Getting started
This API is tested with Python Python 3.6-3.9 and Pypy 3.
This API is tested with Python 3.7-3.11 and Pypy 3.
There are two ways to install the library:
* Installation using pip (a Python package manager)*:
* Installation using pip (a Python package manager):
```
$ pip install pyTelegramBotAPI
@ -56,10 +84,17 @@ $ git clone https://github.com/eternnoir/pyTelegramBotAPI.git
$ cd pyTelegramBotAPI
$ python setup.py install
```
or:
```
$ pip install git+https://github.com/eternnoir/pyTelegramBotAPI.git
```
It is generally recommended to use the first option.
**While the API is production-ready, it is still under development and it has regular updates, do not forget to update it regularly by calling `pip install pytelegrambotapi --upgrade`*
*While the API is production-ready, it is still under development and it has regular updates, do not forget to update it regularly by calling*
```
pip install pytelegrambotapi --upgrade
```
## Writing your first bot
@ -103,13 +138,13 @@ This one echoes all incoming text messages back to the sender. It uses a lambda
We now have a basic bot which replies a static message to "/start" and "/help" commands and which echoes the rest of the sent messages. To start the bot, add the following to our source file:
```python
bot.polling()
bot.infinity_polling()
```
Alright, that's it! Our source file now looks like this:
```python
import telebot
bot = telebot.TeleBot("TOKEN")
bot = telebot.TeleBot("YOUR_BOT_TOKEN")
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
@ -119,7 +154,7 @@ def send_welcome(message):
def echo_all(message):
bot.reply_to(message, message.text)
bot.polling()
bot.infinity_polling()
```
To start the bot, simply open up a terminal and enter `python echo_bot.py` to run the bot! Test it by sending commands ('/start' and '/help') and arbitrary text messages.
@ -130,7 +165,7 @@ To start the bot, simply open up a terminal and enter `python echo_bot.py` to ru
All types are defined in types.py. They are all completely in line with the [Telegram API's definition of the types](https://core.telegram.org/bots/api#available-types), except for the Message's `from` field, which is renamed to `from_user` (because `from` is a Python reserved token). Thus, attributes such as `message_id` can be accessed directly with `message.message_id`. Note that `message.chat` can be either an instance of `User` or `GroupChat` (see [How can I distinguish a User and a GroupChat in message.chat?](#how-can-i-distinguish-a-user-and-a-groupchat-in-messagechat)).
The Message object also has a `content_type`attribute, which defines the type of the Message. `content_type` can be one of the following strings:
`text`, `audio`, `document`, `photo`, `sticker`, `video`, `video_note`, `voice`, `location`, `contact`, `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`.
`text`, `audio`, `document`, `photo`, `sticker`, `video`, `video_note`, `voice`, `location`, `contact`, `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`, `web_app_data`.
You can use some types in one function. Example:
@ -162,8 +197,9 @@ TeleBot supports the following filters:
|content_types|list of strings (default `['text']`)|`True` if message.content_type is in the list of strings.|
|regexp|a regular expression as a string|`True` if `re.search(regexp_arg)` returns `True` and `message.content_type == 'text'` (See [Python Regular Expressions](https://docs.python.org/2/library/re.html))|
|commands|list of strings|`True` if `message.content_type == 'text'` and `message.text` starts with a command that is in the list of strings.|
|func|a function (lambda or function reference)|`True` if the lambda or function reference returns `True`
|chat_types|list of chat types|`True` if `message.chat.type` in your filter|
|func|a function (lambda or function reference)|`True` if the lambda or function reference returns `True`|
Here are some examples of using the filters and message handlers:
```python
@ -207,28 +243,100 @@ def send_something(message):
```
**Important: all handlers are tested in the order in which they were declared**
#### Edited Message handlers
#### Edited Message handler
Handle edited messages
`@bot.edited_message_handler(filters) # <- passes a Message type object to your function`
@bot.edited_message_handler(filters)
#### Channel Post handler
Handle channel post messages
`@bot.channel_post_handler(filters) # <- passes a Message type object to your function`
#### channel_post_handler
@bot.channel_post_handler(filters)
#### edited_channel_post_handler
@bot.edited_channel_post_handler(filters)
#### Edited Channel Post handler
Handle edited channel post messages
`@bot.edited_channel_post_handler(filters) # <- passes a Message type object to your function`
#### Callback Query Handler
In bot2.0 update. You can get `callback_query` in update object. In telebot use `callback_query_handler` to process callback queries.
Handle callback queries
```python
@bot.callback_query_handler(func=lambda call: True)
def test_callback(call):
def test_callback(call): # <- passes a CallbackQuery type object to your function
logger.info(call)
```
#### Middleware Handler
#### Shipping Query Handler
Handle shipping queries
`@bot.shipping_query_handler() # <- passes a ShippingQuery type object to your function`
#### Pre Checkout Query Handler
Handle pre checkoupt queries
`@bot.pre_checkout_query_handler() # <- passes a PreCheckoutQuery type object to your function`
#### Poll Handler
Handle poll updates
`@bot.poll_handler() # <- passes a Poll type object to your function`
#### Poll Answer Handler
Handle poll answers
`@bot.poll_answer_handler() # <- passes a PollAnswer type object to your function`
#### My Chat Member Handler
Handle updates of a the bot's member status in a chat
`@bot.my_chat_member_handler() # <- passes a ChatMemberUpdated type object to your function`
#### Chat Member Handler
Handle updates of a chat member's status in a chat
`@bot.chat_member_handler() # <- passes a ChatMemberUpdated type object to your function`
*Note: "chat_member" updates are not requested by default. If you want to allow all update types, set `allowed_updates` in `bot.polling()` / `bot.infinity_polling()` to `util.update_types`*
#### Chat Join Request Handler
Handle chat join requests using:
`@bot.chat_join_request_handler() # <- passes ChatInviteLink type object to your function`
### Inline Mode
More information about [Inline mode](https://core.telegram.org/bots/inline).
#### Inline handler
Now, you can use inline_handler to get inline queries in telebot.
```python
@bot.inline_handler(lambda query: query.query == 'text')
def query_text(inline_query):
# Query message is text
```
#### Chosen Inline handler
Use chosen_inline_handler to get chosen_inline_result in telebot. Don't forgot add the /setinlinefeedback
command for @Botfather.
More information : [collecting-feedback](https://core.telegram.org/bots/inline#collecting-feedback)
```python
@bot.chosen_inline_handler(func=lambda chosen_inline_result: True)
def test_chosen(chosen_inline_result):
# Process all chosen_inline_result.
```
#### Answer Inline Query
```python
@bot.inline_handler(lambda query: query.query == 'text')
def query_text(inline_query):
try:
r = types.InlineQueryResultArticle('1', 'Result', types.InputTextMessageContent('Result message.'))
r2 = types.InlineQueryResultArticle('2', 'Result2', types.InputTextMessageContent('Result message2.'))
bot.answer_inline_query(inline_query.id, [r, r2])
except Exception as e:
print(e)
```
### Additional API features
#### Middleware Handlers
A middleware handler is a function that allows you to modify requests or the bot context as they pass through the
Telegram to the bot. You can imagine middleware as a chain of logic connection handled before any other handlers are
@ -249,6 +357,63 @@ def start(message):
```
There are other examples using middleware handler in the [examples/middleware](examples/middleware) directory.
#### Class-based middlewares
There are class-based middlewares.
Basic class-based middleware looks like this:
```python
class Middleware(BaseMiddleware):
def __init__(self):
self.update_types = ['message']
def pre_process(self, message, data):
data['foo'] = 'Hello' # just for example
# we edited the data. now, this data is passed to handler.
# return SkipHandler() -> this will skip handler
# return CancelUpdate() -> this will cancel update
def post_process(self, message, data, exception=None):
print(data['foo'])
if exception: # check for exception
print(exception)
```
Class-based middleware should have to functions: post and pre process.
So, as you can see, class-based middlewares work before and after handler execution.
For more, check out in [examples](https://github.com/eternnoir/pyTelegramBotAPI/tree/master/examples/middleware/class_based)
#### Custom filters
Also, you can use built-in custom filters. Or, you can create your own filter.
[Example of custom filter](https://github.com/eternnoir/pyTelegramBotAPI/blob/master/examples/custom_filters/general_custom_filters.py)
Also, we have examples on them. Check this links:
You can check some built-in filters in source [code](https://github.com/eternnoir/pyTelegramBotAPI/blob/master/telebot/custom_filters.py)
Example of [filtering by id](https://github.com/eternnoir/pyTelegramBotAPI/blob/master/examples/custom_filters/id_filter_example.py)
Example of [filtering by text](https://github.com/eternnoir/pyTelegramBotAPI/blob/master/examples/custom_filters/text_filter_example.py)
If you want to add some built-in filter, you are welcome to add it in custom_filters.py file.
Here is example of creating filter-class:
```python
class IsAdmin(telebot.custom_filters.SimpleCustomFilter):
# Class will check whether the user is admin or creator in group or not
key='is_chat_admin'
@staticmethod
def check(message: telebot.types.Message):
return bot.get_chat_member(message.chat.id,message.from_user.id).status in ['administrator','creator']
# To register filter, you need to use method add_custom_filter.
bot.add_custom_filter(IsAdmin())
# Now, you can use it in handler.
@bot.message_handler(is_chat_admin=True)
def admin_of_group(message):
bot.send_message(message.chat.id, 'You are admin of this group!')
```
#### TeleBot
```python
import telebot
@ -257,11 +422,10 @@ TOKEN = '<token_string>'
tb = telebot.TeleBot(TOKEN) #create a new Telegram Bot object
# Upon calling this function, TeleBot starts polling the Telegram servers for new messages.
# - none_stop: True/False (default False) - Don't stop polling when receiving an error from the Telegram servers
# - interval: True/False (default False) - The interval between polling requests
# Note: Editing this parameter harms the bot's response time
# - interval: int (default 0) - The interval between polling requests
# - timeout: integer (default 20) - Timeout in seconds for long polling.
tb.polling(none_stop=False, interval=0, timeout=20)
# - allowed_updates: List of Strings (default None) - List of update types to request
tb.infinity_polling(interval=0, timeout=20)
# getMe
user = tb.get_me()
@ -273,6 +437,7 @@ tb.remove_webhook()
# getUpdates
updates = tb.get_updates()
# or
updates = tb.get_updates(1234,100,20) #get_Updates(offset, limit, timeout):
# sendMessage
@ -394,49 +559,8 @@ ForceReply:
![ForceReply](https://farm4.staticflickr.com/3809/32418726814_d1baec0fc2_o_d.jpg "ForceReply")
### Inline Mode
More information about [Inline mode](https://core.telegram.org/bots/inline).
#### inline_handler
Now, you can use inline_handler to get inline queries in telebot.
```python
@bot.inline_handler(lambda query: query.query == 'text')
def query_text(inline_query):
# Query message is text
```
#### chosen_inline_handler
Use chosen_inline_handler to get chosen_inline_result in telebot. Don't forgot add the /setinlinefeedback
command for @Botfather.
More information : [collecting-feedback](https://core.telegram.org/bots/inline#collecting-feedback)
```python
@bot.chosen_inline_handler(func=lambda chosen_inline_result: True)
def test_chosen(chosen_inline_result):
# Process all chosen_inline_result.
```
#### answer_inline_query
```python
@bot.inline_handler(lambda query: query.query == 'text')
def query_text(inline_query):
try:
r = types.InlineQueryResultArticle('1', 'Result', types.InputTextMessageContent('Result message.'))
r2 = types.InlineQueryResultArticle('2', 'Result2', types.InputTextMessageContent('Result message2.'))
bot.answer_inline_query(inline_query.id, [r, r2])
except Exception as e:
print(e)
```
### Working with entities:
### Working with entities
This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
Attributes:
* `type`
@ -454,26 +578,38 @@ Refer [Bot Api](https://core.telegram.org/bots/api#messageentity) for extra deta
## Advanced use of the API
### Asynchronous delivery of messages
There exists an implementation of TeleBot which executes all `send_xyz` and the `get_me` functions asynchronously. This can speed up your bot __significantly__, but it has unwanted side effects if used without caution.
### Using local Bot API Sever
Since version 5.0 of the Bot API, you have the possibility to run your own [Local Bot API Server](https://core.telegram.org/bots/api#using-a-local-bot-api-server).
pyTelegramBotAPI also supports this feature.
```python
from telebot import apihelper
apihelper.API_URL = "http://localhost:4200/bot{0}/{1}"
```
**Important: Like described [here](https://core.telegram.org/bots/api#logout), you have to log out your bot from the Telegram server before switching to your local API server. in pyTelegramBotAPI use `bot.log_out()`**
*Note: 4200 is an example port*
### Asynchronous TeleBot
New: There is an asynchronous implementation of telebot.
To enable this behaviour, create an instance of AsyncTeleBot instead of TeleBot.
```python
tb = telebot.AsyncTeleBot("TOKEN")
```
Now, every function that calls the Telegram API is executed in a separate Thread. The functions are modified to return an AsyncTask instance (defined in util.py). Using AsyncTeleBot allows you to do the following:
Now, every function that calls the Telegram API is executed in a separate asynchronous task.
Using AsyncTeleBot allows you to do the following:
```python
import telebot
tb = telebot.AsyncTeleBot("TOKEN")
task = tb.get_me() # Execute an API call
# Do some other operations...
a = 0
for a in range(100):
a += 10
result = task.wait() # Get the result of the execution
@tb.message_handler(commands=['start'])
async def start_message(message):
await bot.send_message(message.chat.id, 'Hello!')
```
*Note: if you execute send_xyz functions after eachother without calling wait(), the order in which messages are delivered might be wrong.*
See more in [examples](https://github.com/eternnoir/pyTelegramBotAPI/tree/master/examples/asynchronous_telebot)
### Sending large text messages
Sometimes you must send messages that exceed 5000 characters. The Telegram API can not handle that many characters in one request, so we need to split the message in multiples. Here is how to do that using the API:
@ -484,6 +620,19 @@ large_text = open("large_text.txt", "rb").read()
# Split the text each 3000 characters.
# split_string returns a list with the splitted text.
splitted_text = util.split_string(large_text, 3000)
for text in splitted_text:
tb.send_message(chat_id, text)
```
Or you can use the new `smart_split` function to get more meaningful substrings:
```python
from telebot import util
large_text = open("large_text.txt", "rb").read()
# Splits one string into multiple strings, with a maximum amount of `chars_per_string` (max. 4096)
# Splits by last '\n', '. ' or ' ' in exactly this priority.
# smart_split returns a list with the splitted text.
splitted_text = util.smart_split(large_text, chars_per_string=3000)
for text in splitted_text:
tb.send_message(chat_id, text)
```
@ -505,7 +654,7 @@ def handle_messages(messages):
bot.reply_to(message, 'Hi')
bot.set_update_listener(handle_messages)
bot.polling()
bot.infinity_polling()
```
### Using web hooks
@ -514,7 +663,6 @@ When using webhooks telegram sends one Update per call, for processing it you sh
There are some examples using webhooks in the [examples/webhook_examples](examples/webhook_examples) directory.
### Logging
You can use the Telebot module logger to log debug info about Telebot. Use `telebot.logger` to get the logger of the TeleBot module.
It is possible to add custom logging Handlers to the logger. Refer to the [Python logging module page](https://docs.python.org/2/library/logging.html) for more info.
@ -526,13 +674,14 @@ telebot.logger.setLevel(logging.DEBUG) # Outputs debug messages to console.
```
### Proxy
For sync:
You can use proxy for request. `apihelper.proxy` object will use by call `requests` proxies argument.
```python
from telebot import apihelper
apihelper.proxy = {'http':'http://10.10.1.10:3128'}
apihelper.proxy = {'http':'http://127.0.0.1:3128'}
```
If you want to use socket5 proxy you need install dependency `pip install requests[socks]` and make sure, that you have the latest version of `gunicorn`, `PySocks`, `pyTelegramBotAPI`, `requests` and `urllib3`.
@ -541,57 +690,104 @@ If you want to use socket5 proxy you need install dependency `pip install reques
apihelper.proxy = {'https':'socks5://userproxy:password@proxy_address:port'}
```
For async:
```python
from telebot import asyncio_helper
## API conformance
_Checking is in progress..._
✅ [Bot API 4.5](https://core.telegram.org/bots/api-changelog#december-31-2019) _- To be checked..._
* ✔ [Bot API 4.4](https://core.telegram.org/bots/api-changelog#july-29-2019)
* ✔ [Bot API 4.3](https://core.telegram.org/bots/api-changelog#may-31-2019)
* ✔ [Bot API 4.2](https://core.telegram.org/bots/api-changelog#april-14-2019)
* [Bot API 4.1](https://core.telegram.org/bots/api-changelog#august-27-2018) - No Passport support.
* [Bot API 4.0](https://core.telegram.org/bots/api-changelog#july-26-2018) - No Passport support.
* ✔ [Bot API 3.6](https://core.telegram.org/bots/api-changelog#february-13-2018)
* ✔ [Bot API 3.5](https://core.telegram.org/bots/api-changelog#november-17-2017)
* ✔ [Bot API 3.4](https://core.telegram.org/bots/api-changelog#october-11-2017)
* ✔ [Bot API 3.3](https://core.telegram.org/bots/api-changelog#august-23-2017)
* ✔ [Bot API 3.2](https://core.telegram.org/bots/api-changelog#july-21-2017)
* ✔ [Bot API 3.1](https://core.telegram.org/bots/api-changelog#june-30-2017)
* ✔ [Bot API 3.0](https://core.telegram.org/bots/api-changelog#may-18-2017)
* ✔ [Bot API 2.3.1](https://core.telegram.org/bots/api-changelog#december-4-2016)
* ✔ [Bot API 2.3](https://core.telegram.org/bots/api-changelog#november-21-2016)
* ✔ [Bot API 2.2](https://core.telegram.org/bots/api-changelog#october-3-2016)
* ✔ [Bot API 2.1](https://core.telegram.org/bots/api-changelog#may-22-2016)
* ✔ [Bot API 2.0](https://core.telegram.org/bots/api-changelog#april-9-2016)
asyncio_helper.proxy = 'http://127.0.0.1:3128' #url
```
## Change log
### Testing
You can disable or change the interaction with real Telegram server by using
```python
apihelper.CUSTOM_REQUEST_SENDER = your_handler
```
parameter. You can pass there your own function that will be called instead of _requests.request_.
27.04.2020 - Poll and Dice are up to date.
Python2 conformance is not checked any more due to EOL.
For example:
```python
def custom_sender(method, url, **kwargs):
print("custom_sender. method: {}, url: {}, params: {}".format(method, url, kwargs.get("params")))
result = util.CustomRequestResponse('{"ok":true,"result":{"message_id": 1, "date": 1, "chat": {"id": 1, "type": "private"}}}')
return result
```
11.04.2020 - Refactoring. new_chat_member is out of support. Bugfix in html_text. Started Bot API conformance checking.
Then you can use API and proceed requests in your handler code.
```python
apihelper.CUSTOM_REQUEST_SENDER = custom_sender
tb = TeleBot("test")
res = tb.send_message(123, "Test")
```
06.06.2019 - Added polls support (Poll). Added functions send_poll, stop_poll
Result will be:
`custom_sender. method: post, url: https://api.telegram.org/botololo/sendMessage, params: {'chat_id': '123', 'text': 'Test'}`
## API conformance limitations
* [Bot API 4.5](https://core.telegram.org/bots/api-changelog#december-31-2019) - No nested MessageEntities and Markdown2 support
* [Bot API 4.1](https://core.telegram.org/bots/api-changelog#august-27-2018) - No Passport support
* [Bot API 4.0](https://core.telegram.org/bots/api-changelog#july-26-2018) - No Passport support
## AsyncTeleBot
### Asynchronous version of telebot
We have a fully asynchronous version of TeleBot.
This class is not controlled by threads. Asyncio tasks are created to execute all the stuff.
### EchoBot
Echo Bot example on AsyncTeleBot:
```python
# This is a simple echo bot using the decorator mechanism.
# It echoes any incoming text messages.
from telebot.async_telebot import AsyncTeleBot
import asyncio
bot = AsyncTeleBot('TOKEN')
# Handle '/start' and '/help'
@bot.message_handler(commands=['help', 'start'])
async def send_welcome(message):
await bot.reply_to(message, """\
Hi there, I am EchoBot.
I am here to echo your kind words back to you. Just say anything nice and I'll say the exact same thing to you!\
""")
# Handle all other messages with content_type 'text' (content_types defaults to ['text'])
@bot.message_handler(func=lambda message: True)
async def echo_message(message):
await bot.reply_to(message, message.text)
asyncio.run(bot.polling())
```
As you can see here, keywords are await and async.
### Why should I use async?
Asynchronous tasks depend on processor performance. Many asynchronous tasks can run parallelly, while thread tasks will block each other.
### Differences in AsyncTeleBot
AsyncTeleBot is asynchronous. It uses aiohttp instead of requests module.
### Examples
See more examples in our [examples](https://github.com/eternnoir/pyTelegramBotAPI/tree/master/examples/asynchronous_telebot) folder
## F.A.Q.
### Bot 2.0
April 9,2016 Telegram release new bot 2.0 API, which has a drastic revision especially for the change of method's interface.If you want to update to the latest version, please make sure you've switched bot's code to bot 2.0 method interface.
[More information about pyTelegramBotAPI support bot2.0](https://github.com/eternnoir/pyTelegramBotAPI/issues/130)
### How can I distinguish a User and a GroupChat in message.chat?
Telegram Bot API support new type Chat for message.chat.
- Check the ```type``` attribute in ```Chat``` object:
-
```python
if message.chat.type == "private":
# private chat message
# private chat message
if message.chat.type == "group":
# group chat message
@ -613,81 +809,87 @@ Bot instances that were idle for a long time might be rejected by the server whe
Get help. Discuss. Chat.
* Join the [pyTelegramBotAPI Telegram Chat Group](https://telegram.me/joinchat/Bn4ixj84FIZVkwhk2jag6A)
* We now have a Telegram Channel as well! Keep yourself up to date with API changes, and [join it](https://telegram.me/pytelegrambotapi).
## Telegram Channel
Join the [News channel](https://t.me/pyTelegramBotAPI). Here we will post releases and updates.
## More examples
* [Echo Bot](https://github.com/eternnoir/pyTelegramBotAPI/blob/master/examples/echo_bot.py)
* [Deep Linking](https://github.com/eternnoir/pyTelegramBotAPI/blob/master/examples/deep_linking.py)
* [next_step_handler Example](https://github.com/eternnoir/pyTelegramBotAPI/blob/master/examples/step_example.py)
## Bots using this API
## Code Template
Template is a ready folder that contains architecture of basic project.
Here are some examples of template:
* [AsyncTeleBot template](https://github.com/coder2020official/asynctelebot_template)
* [TeleBot template](https://github.com/coder2020official/telebot_template)
## Bots using this library
* [SiteAlert bot](https://telegram.me/SiteAlert_bot) ([source](https://github.com/ilteoood/SiteAlert-Python)) by *ilteoood* - Monitors websites and sends a notification on changes
* [TelegramLoggingBot](https://github.com/aRandomStranger/TelegramLoggingBot) by *aRandomStranger*
* [Send to Kindle Bot](https://telegram.me/Send2KindleBot) by *GabrielRF* - Send to Kindle files or links to files.
* [Telegram LMGTFY_bot](https://github.com/GabrielRF/telegram-lmgtfy_bot) ([source](https://github.com/GabrielRF/telegram-lmgtfy_bot)) by *GabrielRF* - Let me Google that for you.
* [Telegram UrlProBot](https://github.com/GabrielRF/telegram-urlprobot) ([source](https://github.com/GabrielRF/telegram-urlprobot)) by *GabrielRF* - URL shortener and URL expander.
* [Telegram Proxy Bot](https://github.com/mrgigabyte/proxybot) by *mrgigabyte* - `Credits for the original version of this bot goes to` **Groosha** `, simply added certain features which I thought were needed`.
* [Telegram LMGTFY_bot](https://github.com/GabrielRF/telegram-lmgtfy_bot) by *GabrielRF* - Let me Google that for you.
* [Telegram Proxy Bot](https://github.com/mrgigabyte/proxybot) by *mrgigabyte*
* [RadRetroRobot](https://github.com/Tronikart/RadRetroRobot) by *Tronikart* - Multifunctional Telegram Bot RadRetroRobot.
* [League of Legends bot](https://telegram.me/League_of_Legends_bot) ([source](https://github.com/i32ropie/lol)) by *i32ropie*
* [NeoBot](https://github.com/neoranger/NeoBot) by [@NeoRanger](https://github.com/neoranger)
* [TagAlertBot](https://github.com/pitasi/TagAlertBot) by *pitasi*
* [ColorCodeBot](https://t.me/colorcodebot) ([source](https://github.com/andydecleyre/colorcodebot)) - Share code snippets as beautifully syntax-highlighted HTML and/or images.
* [ComedoresUGRbot](http://telegram.me/ComedoresUGRbot) ([source](https://github.com/alejandrocq/ComedoresUGRbot)) by [*alejandrocq*](https://github.com/alejandrocq) - Telegram bot to check the menu of Universidad de Granada dining hall.
* [picpingbot](https://web.telegram.org/#/im?p=%40picpingbot) - Fun anonymous photo exchange by Boogie Muffin.
* [TheZigZagProject](https://github.com/WebShark025/TheZigZagProject) - The 'All In One' bot for Telegram! by WebShark025
* [proxybot](https://github.com/p-hash/proxybot) - Simple Proxy Bot for Telegram. by p-hash
* [DonantesMalagaBot](https://github.com/vfranch/DonantesMalagaBot)- DonantesMalagaBot facilitates information to Malaga blood donors about the places where they can donate today or in the incoming days. It also records the date of the last donation so that it helps the donors to know when they can donate again. - by vfranch
* [DonantesMalagaBot](https://github.com/vfranch/DonantesMalagaBot) - DonantesMalagaBot facilitates information to Malaga blood donors about the places where they can donate today or in the incoming days. It also records the date of the last donation so that it helps the donors to know when they can donate again. - by vfranch
* [DuttyBot](https://github.com/DmytryiStriletskyi/DuttyBot) by *Dmytryi Striletskyi* - Timetable for one university in Kiev.
* [dailypepebot](https://telegram.me/dailypepebot) by [*Jaime*](https://github.com/jiwidi/Dailypepe) - Get's you random pepe images and gives you their id, then you can call this image with the number.
* [DailyQwertee](https://t.me/DailyQwertee) by [*Jaime*](https://github.com/jiwidi/DailyQwertee) - Bot that manages a channel that sends qwertee daily tshirts every day at 00:00
* [wat-bridge](https://github.com/rmed/wat-bridge) by [*rmed*](https://github.com/rmed) - Send and receive messages to/from WhatsApp through Telegram
* [flibusta_bot](https://github.com/Kurbezz/flibusta_bot) by [*Kurbezz*](https://github.com/Kurbezz)
* [EmaProject](https://github.com/halkliff/emaproject) by [*halkliff*](https://github.com/halkliff) - Ema - Eastern Media Assistant was made thinking on the ease-to-use feature. Coding here is simple, as much as is fast and powerful.
* [filmratingbot](http://t.me/filmratingbot)([source](https://github.com/jcolladosp/film-rating-bot)) by [*jcolladosp*](https://github.com/jcolladosp) - Telegram bot using the Python API that gets films rating from IMDb and metacritic
* [you2mp3bot](http://t.me/you2mp3bot)([link](https://storebot.me/bot/you2mp3bot)) - This bot can convert a Youtube video to Mp3. All you need is send the URL video.
* [Send2Kindlebot](http://t.me/Send2KindleBot) ([source](https://github.com/GabrielRF/Send2KindleBot)) by *GabrielRF* - Send to Kindle service.
* [RastreioBot](http://t.me/RastreioBot) ([source](https://github.com/GabrielRF/RastreioBot)) by *GabrielRF* - Bot used to track packages on the Brazilian Mail Service.
* [filex_bot](http://t.me/filex_bot)([link](https://github.com/victor141516/FileXbot-telegram))
* [Spbu4UBot](http://t.me/Spbu4UBot)([link](https://github.com/EeOneDown/spbu4u)) by *EeOneDown* - Bot with timetables for SPbU students.
* [SmartySBot](http://t.me/ZDU_bot)([link](https://github.com/0xVK/SmartySBot)) by *0xVK* - Telegram timetable bot, for Zhytomyr Ivan Franko State University students.
* [yandex_music_bot](http://t.me/yandex_music_bot)- Downloads tracks/albums/public playlists from Yandex.Music streaming service for free.
* [LearnIt](https://t.me/LearnItbot)([link](https://github.com/tiagonapoli/LearnIt)) - A Telegram Bot created to help people to memorize other languages vocabulary.
* [MusicQuiz_bot](https://t.me/MusicQuiz_bot) by [Etoneja](https://github.com/Etoneja) - Listen to audio samples and try to name the performer of the song.
* [Bot-Telegram-Shodan ](https://github.com/rubenleon/Bot-Telegram-Shodan) by [rubenleon](https://github.com/rubenleon)
* [MandangoBot](https://t.me/MandangoBot) by @Alvaricias - Bot for managing Marvel Strike Force alliances (only in spanish, atm).
* [ManjaroBot](https://t.me/ManjaroBot) by [@NeoRanger](https://github.com/neoranger) - Bot for Manjaro Linux Spanish group with a lot of info for Manjaro Newbies.
* [VigoBusTelegramBot](https://t.me/vigobusbot) ([GitHub](https://github.com/Pythoneiro/VigoBus-TelegramBot)) - Bot that provides buses coming to a certain stop and their remaining time for the city of Vigo (Galicia - Spain)
* [kaishnik-bot](https://t.me/kaishnik_bot) ([source](https://github.com/airatk/kaishnik-bot)) by *airatk* - bot which shows all the necessary information to KNTRU-KAI students.
* [Creation Date](https://t.me/creationdatebot) by @karipov - interpolates account creation dates based on telegram given IDs
* [m0xbot](https://t.me/m0xbot) by [kor0p](https://github.com/kor0p) - tic-tac-toe.
* [kboardbot](https://t.me/kboardbot) by [kor0p](https://github.com/kor0p) - inline switches keyboard layout (English, Hebrew, Ukrainian, Russian).
* [Robbie](https://t.me/romdeliverybot) ([source](https://github.com/FacuM/romdeliverybot_support)) by @FacuM - Support Telegram bot for developers and maintainers.
* [AsadovBot](https://t.me/asadov_bot) ([source](https://github.com/desexcile/BotApi)) by @DesExcile - Сatalog of poems by Eduard Asadov.
* [thesaurus_com_bot](https://t.me/thesaurus_com_bot) ([source](https://github.com/LeoSvalov/words-i-learn-bot)) by @LeoSvalov - words and synonyms from [dictionary.com](https://www.dictionary.com) and [thesaurus.com](https://www.thesaurus.com) in the telegram.
* [InfoBot](https://t.me/info2019_bot) ([source](https://github.com/irevenko/info-bot)) by @irevenko - An all-round bot that displays some statistics (weather, time, crypto etc...)
* [FoodBot](https://t.me/ChensonUz_bot) ([source](https://github.com/Fliego/old_restaurant_telegram_chatbot)) by @Fliego - a simple bot for food ordering
* [Sporty](https://t.me/SportydBot) ([source](https://github.com/0xnu/sporty)) by @0xnu - Telegram bot for displaying the latest news, sports schedules and injury updates.
* [Neural style transfer](https://t.me/ebanyivolshebnikBot) ([source](https://github.com/timbyxty/StyleTransfer-tgbot)) by @timbyxty - bot for transferring style from one picture to another based on neural network.
* [JoinGroup Silencer Bot](https://t.me/joingroup_silencer_bot) ([source](https://github.com/zeph1997/Telegram-Group-Silencer-Bot)) by [@zeph1997](https://github.com/zeph1997) - A Telegram Bot to remove "join group" and "removed from group" notifications.
* [AdviceBook](https://t.me/adviceokbot) by [@barbax7](https://github.com/barbax7) - A Telegram Bot that allows you to receive random reading tips when you don't know which book to read.
* [Blue_CC_Bot](https://t.me/Blue_CC_Bot) by [@Akash](https://github.com/BLUE-DEVIL1134) - A Telegram Bot Which Checks Your Given Credit Cards And Says Which Is A Real,Card And Which Is Fake.
* [RandomInfoBot](https://t.me/RandomInfoBot) by [@Akash](https://github.com/BLUE-DEVIL1134) - A Telegram Bot Which Generates Random Information Of Humans Scraped From Over 13 Websites.
* [TasksListsBot](https://t.me/TasksListsBot) ([source](https://github.com/Pablo-Davila/TasksListsBot)) by [@Pablo-Davila](https://github.com/Pablo-Davila) - A (tasks) lists manager bot for Telegram.
* [MyElizaPsychologistBot](https://t.me/TasksListsBot) ([source](https://github.com/Pablo-Davila/MyElizaPsychologistBot)) by [@Pablo-Davila](https://github.com/Pablo-Davila) - An implementation of the famous Eliza psychologist chatbot.
* [Evdembot](https://t.me/Evdembot) by Adem Kavak. A bot that informs you about everything you want.
* [Frcstbot](https://t.me/frcstbot) ([source](https://github.com/Mrsqd/frcstbot_public)) by [Mrsqd](https://github.com/Mrsqd). A Telegram bot that will always be happy to show you the weather forecast.
* [Bot Hour](https://t.me/roadtocode_bot) a little bot that say the time in different countries by [@diegop384](https://github.com/diegop384) [repo](https://github.com/diegop384/telegrambothour)
* [moodforfood_bot](https://t.me/moodforfood_bot) This bot will provide you with a list of food place(s) near your current Telegram location, which you are prompted to share. The API for all this info is from https://foursquare.com/. by [@sophiamarani](https://github.com/sophiamarani)
* [Donation with Amazon](https://t.me/donamazonbot) by [@barbax7](https://github.com/barbax7) This bot donates amazon advertising commissions to the non-profit organization chosen by the user.
* [COVID-19 Galicia Bot](https://t.me/covid19_galicia_bot) by [@dgarcoe](https://github.com/dgarcoe) This bot provides daily data related to the COVID19 crisis in Galicia (Spain) obtained from official government sources.
* [MineGramBot](https://github.com/ModischFabrications/MineGramBot) by [ModischFabrications](https://github.com/ModischFabrications). This bot can start, stop and monitor a minecraft server.
* [Tabletop DiceBot](https://github.com/dexpiper/tabletopdicebot) by [dexpiper](https://github.com/dexpiper). This bot can roll multiple dices for RPG-like games, add positive and negative modifiers and show short descriptions to the rolls.
* [BarnameKon](https://t.me/BarnameKonBot) by [Anvaari](https://github.com/anvaari). This Bot make "Add to google calendar" link for your events. It give information about event and return link. It work for Jalali calendar and in Tehran Time. [Source code](https://github.com/anvaari/BarnameKon)
* [Price Tracker](https://t.me/trackokbot) by [@barbax7](https://github.com/barbax7). This bot tracks amazon.it product's prices the user is interested to and notify him when one price go down.
* [Torrent Hunt](https://t.me/torrenthuntbot) by [@Hemantapkh](https://github.com/hemantapkh/torrenthunt). Torrent Hunt bot is a multilingual bot with inline mode support to search and explore torrents from 1337x.to.
* Translator bot by [Areeg Fahad (source)](https://github.com/AREEG94FAHAD/translate_text_bot). This bot can be use to translate texts.
* Digital Cryptocurrency bot by [Areeg Fahad (source)](https://github.com/AREEG94FAHAD/currencies_bot). With this bot, you can now monitor the prices of more than 12 digital Cryptocurrency.
* [Anti-Tracking Bot](https://t.me/AntiTrackingBot) by [Leon Heess (source)](https://github.com/leonheess/AntiTrackingBot). Send any link, and the bot tries its best to remove all tracking from the link you sent.
* [Translator bot](https://github.com/AREEG94FAHAD/translate_text_bot) by Areeg Fahad. This bot can be used to translate texts.
* [Digital Cryptocurrency bot](https://github.com/AREEG94FAHAD/currencies_bot) by Areeg Fahad. With this bot, you can now monitor the prices of more than 12 digital Cryptocurrency.
* [Anti-Tracking Bot](https://t.me/AntiTrackingBot) by Leon Heess [(source)](https://github.com/leonheess/AntiTrackingBot). Send any link, and the bot tries its best to remove all tracking from the link you sent.
* [Developer Bot](https://t.me/IndDeveloper_bot) by [Vishal Singh](https://github.com/vishal2376) [(source code)](https://github.com/vishal2376/telegram-bot) This telegram bot can do tasks like GitHub search & clone,provide c++ learning resources ,Stackoverflow search, Codeforces(profile visualizer,random problems)
* [oneIPO bot](https://github.com/aaditya2200/IPO-proj) by [Aadithya](https://github.com/aaditya2200) & [Amol Soans](https://github.com/AmolDerickSoans) This Telegram bot provides live updates , data and documents on current and upcoming IPOs(Initial Public Offerings)
* [CoronaGraphsBot](https://t.me/CovidGraph_bot) ([source](https://github.com/TrevorWinstral/CoronaGraphsBot)) by *TrevorWinstral* - Gets live COVID Country data, plots it, and briefs the user
* [ETHLectureBot](https://t.me/ETHLectureBot) ([source](https://github.com/TrevorWinstral/ETHLectureBot)) by *TrevorWinstral* - Notifies ETH students when their lectures have been uploaded
* [Vlun Finder Bot](https://github.com/resinprotein2333/Vlun-Finder-bot) by [Resinprotein2333](https://github.com/resinprotein2333). This bot can help you to find The information of CVE vulnerabilities.
* [ETHGasFeeTrackerBot](https://t.me/ETHGasFeeTrackerBot) ([Source](https://github.com/DevAdvik/ETHGasFeeTrackerBot]) by *DevAdvik* - Get Live Ethereum Gas Fees in GWEI
* [Google Sheet Bot](https://github.com/JoachimStanislaus/Tele_Sheet_bot) by [JoachimStanislaus](https://github.com/JoachimStanislaus). This bot can help you to track your expenses by uploading your bot entries to your google sheet.
* [GrandQuiz Bot](https://github.com/Carlosma7/TFM-GrandQuiz) by [Carlosma7](https://github.com/Carlosma7). This bot is a trivia game that allows you to play with people from different ages. This project addresses the use of a system through chatbots to carry out a social and intergenerational game as an alternative to traditional game development.
* [Diccionario de la RAE](https://t.me/dleraebot) ([source](https://github.com/studentenherz/dleraebot)) This bot lets you find difinitions of words in Spanish using [RAE's dictionary](https://dle.rae.es/). It features direct message and inline search.
* [remoteTelegramShell](https://github.com/EnriqueMoran/remoteTelegramShell) by [EnriqueMoran](https://github.com/EnriqueMoran). Control your LinuxOS computer through Telegram.
* [Commerce Telegram Bot](https://github.com/ayitinya/commerce-telegram-bot/). Make purchases of items in a store with an Admin panel for data control and notifications.
* [Pyfram-telegram-bot](https://github.com/skelly37/pyfram-telegram-bot) Query wolframalpha.com and make use of its API through Telegram.
* [TranslateThisVideoBot](https://gitlab.com/WuerfelDev/translatethisvideo) This Bot can understand spoken text in videos and translate it to English
* [Zyprexa](https://t.me/mathemathicsBot) ([source](https://github.com/atif5/zyprexa)) Zyprexa can solve, help you solve any mathematical problem you encounter and convert your regular mathematical expressions into beautiful imagery using LaTeX.
* [Bincode-telegram-bot](https://github.com/tusharhero/bincode-telegram-bot) by [tusharhero](https://github.com/tusharhero) - Makes [bincodes](https://github.com/tusharhero/bincode) from text provides and also converts them back to text.
* [hydrolib_bot](https://github.com/Mayson90/hydrolib_bot) Toolset for Hydrophilia tabletop game (game cards, rules, structure...).
* [Gugumoe-bot](http://t.me/gugumoe_bot) ([source](https://github.com/GooGuJiang/Gugumoe-bot)) by [咕谷酱](https://gmoe.cc) GuXiaoJiang is a multi-functional robot, such as OSU game information query, IP test, animation screenshot search and other functions.
* [Feedback-bot](https://github.com/coder2020official/feedbackbot) A feedback bot for user-admin communication. Made on AsyncTeleBot, using [template](https://github.com/coder2020official/asynctelebot_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.
**Want to have your bot listed here? Just make a pull request.**
**Want to have your bot listed here? Just make a pull request. Only bots with public source code are accepted.**

5
doc_req.txt Normal file
View File

@ -0,0 +1,5 @@
-r requirements.txt
furo
sphinx_copybutton
git+https://github.com/eternnoir/pyTelegramBotAPI.git

20
docs/Makefile Normal file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -0,0 +1,48 @@
====================
AsyncTeleBot
====================
.. meta::
:description: Asynchronous pyTelegramBotAPI
:keywords: ptba, pytba, pyTelegramBotAPI, asynctelebot, documentation
AsyncTeleBot methods
--------------------
.. automodule:: telebot.async_telebot
:members:
:undoc-members:
:show-inheritance:
Asyncio filters
---------------
.. automodule:: telebot.asyncio_filters
:members:
:undoc-members:
:show-inheritance:
Asyncio handler backends
------------------------
.. automodule:: telebot.asyncio_handler_backends
:members:
:undoc-members:
:show-inheritance:
Extensions
------------------------
.. automodule:: telebot.ext.aio.webhooks
:members:
:undoc-members:
:show-inheritance:

17
docs/source/calldata.rst Normal file
View File

@ -0,0 +1,17 @@
=====================
Callback data factory
=====================
.. meta::
:description: Callback data factory in pyTelegramBotAPI
:keywords: ptba, pytba, pyTelegramBotAPI, callbackdatafactory, guide, callbackdata, factory
callback\_data file
-----------------------------
.. automodule:: telebot.callback_data
:members:
:undoc-members:
:show-inheritance:

72
docs/source/conf.py Normal file
View File

@ -0,0 +1,72 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'pyTelegramBotAPI Documentation'
copyright = '2022, coder2020official'
author = 'coder2020official'
# The full version, including alpha/beta/rc tags
release = '4.11.0'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autosectionlabel',
'sphinx.ext.autodoc',
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx_copybutton",
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'furo'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
#html_logo = 'logo.png'
html_theme_options = {
"light_css_variables": {
"color-brand-primary": "#7C4DFF",
"color-brand-content": "#7C4DFF",
},
"light_logo": "logo.png",
"dark_logo": "logo2.png",
}
locale_dirs = ["locales/"]

View File

@ -0,0 +1,12 @@
==================
Formatting options
==================
.. meta::
:description: Formatting options in pyTelegramBotAPI
:keywords: html, markdown, parse_mode, formatting, ptba, pytba, pyTelegramBotAPI
.. automodule:: telebot.formatting
:members:
:undoc-members:
:show-inheritance:

69
docs/source/index.rst Normal file
View File

@ -0,0 +1,69 @@
.. pyTelegramBotAPI documentation master file, created by
sphinx-quickstart on Fri Feb 18 20:58:37 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to pyTelegramBotAPI's documentation!
============================================
.. meta::
:description: Official documentation of pyTelegramBotAPI
:keywords: ptba, pytba, pyTelegramBotAPI, documentation, guide
=======
TeleBot
=======
TeleBot is synchronous and asynchronous implementation of `Telegram Bot API <https://core.telegram.org/bots/api>`_.
Chats
-----
English chat: `Private chat <https://telegram.me/joinchat/Bn4ixj84FIZVkwhk2jag6A>`__
Russian chat: `@pytelegrambotapi_talks_ru <https://t.me/pytelegrambotapi_talks_ru>`__
News: `@pyTelegramBotAPI <https://t.me/pytelegrambotapi>`__
Pypi: `Pypi <https://pypi.org/project/pyTelegramBotAPI/>`__
Source: `Github repository <https://github.com/eternnoir/pyTelegramBotAPI>`__
Some features:
--------------
Easy to learn and use.
Easy to understand.
Both sync and async.
Examples on features.
States
And more...
Content
--------
.. toctree::
install
quick_start
types
sync_version/index
async_version/index
calldata
util
formatting
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

45
docs/source/install.rst Normal file
View File

@ -0,0 +1,45 @@
==================
Installation Guide
==================
.. meta::
:description: Installation of pyTelegramBotAPI
:keywords: ptba, pytba, pyTelegramBotAPI, installation, guide
Using PIP
----------
.. code-block:: bash
$ pip install pyTelegramBotAPI
Using pipenv
------------
.. code-block:: bash
$ pipenv install pyTelegramBotAPI
By cloning repository
---------------------
.. code-block:: bash
$ git clone https://github.com/eternnoir/pyTelegramBotAPI.git
$ cd pyTelegramBotAPI
$ python setup.py install
Directly using pip
------------------
.. code-block:: bash
$ pip install git+https://github.com/eternnoir/pyTelegramBotAPI.git
It is generally recommended to use the first option.
While the API is production-ready, it is still under development and it has regular updates, do not forget to update it regularly by calling:
.. code-block:: bash
$ pip install pytelegrambotapi --upgrade

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,127 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022, coder2020official
# This file is distributed under the same license as the pyTelegramBotAPI
# Documentation package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-29 14:44+0400\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../calldata.rst:4
msgid "Callback data factory"
msgstr ""
#: ../../calldata.rst:6
msgid "Callback data factory in pyTelegramBotAPI"
msgstr ""
#: ../../calldata.rst:6
msgid ""
"ptba, pytba, pyTelegramBotAPI, callbackdatafactory, guide, callbackdata, "
"factory"
msgstr ""
#: ../../calldata.rst:12
msgid "callback\\_data file"
msgstr ""
#: of telebot.callback_data:1
msgid "Callback data factory's file."
msgstr ""
#: of telebot.callback_data.CallbackData:1
#: telebot.callback_data.CallbackDataFilter:1
msgid "Bases: :py:class:`object`"
msgstr ""
#: of telebot.callback_data.CallbackData:1
msgid "Callback data factory This class will help you to work with CallbackQuery"
msgstr ""
#: of telebot.callback_data.CallbackData.filter:1
msgid "Generate filter"
msgstr ""
#: of telebot.callback_data.CallbackData.filter
#: telebot.callback_data.CallbackData.new
#: telebot.callback_data.CallbackData.parse
#: telebot.callback_data.CallbackDataFilter.check
msgid "Parameters"
msgstr ""
#: of telebot.callback_data.CallbackData.filter:3
msgid "specified named parameters will be checked with CallbackQuery.data"
msgstr ""
#: of telebot.callback_data.CallbackData.filter
#: telebot.callback_data.CallbackData.new
#: telebot.callback_data.CallbackData.parse
#: telebot.callback_data.CallbackDataFilter.check
msgid "Returns"
msgstr ""
#: of telebot.callback_data.CallbackData.filter:4
msgid "CallbackDataFilter class"
msgstr ""
#: of telebot.callback_data.CallbackData.new:1
msgid "Generate callback data"
msgstr ""
#: of telebot.callback_data.CallbackData.new:3
msgid "positional parameters of CallbackData instance parts"
msgstr ""
#: of telebot.callback_data.CallbackData.new:4
msgid "named parameters"
msgstr ""
#: of telebot.callback_data.CallbackData.new:5
msgid "str"
msgstr ""
#: of telebot.callback_data.CallbackData.parse:1
msgid "Parse data from the callback data"
msgstr ""
#: of telebot.callback_data.CallbackData.parse:3
msgid ""
"string, use to telebot.types.CallbackQuery to parse it from string to a "
"dict"
msgstr ""
#: of telebot.callback_data.CallbackData.parse:4
msgid "dict parsed from callback data"
msgstr ""
#: of telebot.callback_data.CallbackDataFilter:1
msgid "Filter for CallbackData."
msgstr ""
#: of telebot.callback_data.CallbackDataFilter.check:1
msgid "Checks if query.data appropriates to specified config"
msgstr ""
#: of telebot.callback_data.CallbackDataFilter.check:3
msgid "telebot.types.CallbackQuery"
msgstr ""
#: of telebot.callback_data.CallbackDataFilter.check:6
msgid "True if query.data appropriates to specified config"
msgstr ""
#: of telebot.callback_data.CallbackDataFilter.check
msgid "Return type"
msgstr ""

View File

@ -0,0 +1,251 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022, coder2020official
# This file is distributed under the same license as the pyTelegramBotAPI
# Documentation package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-29 14:44+0400\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../formatting.rst:3
msgid "Formatting options"
msgstr ""
#: ../../formatting.rst:5
msgid "Formatting options in pyTelegramBotAPI"
msgstr ""
#: ../../formatting.rst:5
msgid "html, markdown, parse_mode, formatting, ptba, pytba, pyTelegramBotAPI"
msgstr ""
#: of telebot.formatting:1
msgid "Markdown & HTML formatting functions."
msgstr ""
#: of telebot.formatting.escape_html:1
msgid "Escapes HTML characters in a string of HTML."
msgstr ""
#: of telebot.formatting.escape_html telebot.formatting.escape_markdown
#: telebot.formatting.format_text telebot.formatting.hbold
#: telebot.formatting.hcode telebot.formatting.hide_link
#: telebot.formatting.hitalic telebot.formatting.hlink telebot.formatting.hpre
#: telebot.formatting.hspoiler telebot.formatting.hstrikethrough
#: telebot.formatting.hunderline telebot.formatting.mbold
#: telebot.formatting.mcode telebot.formatting.mitalic telebot.formatting.mlink
#: telebot.formatting.mspoiler telebot.formatting.mstrikethrough
#: telebot.formatting.munderline
msgid "Parameters"
msgstr ""
#: of telebot.formatting.escape_html:3
msgid "The string of HTML to escape."
msgstr ""
#: of telebot.formatting.escape_html telebot.formatting.escape_markdown
#: telebot.formatting.format_text telebot.formatting.hbold
#: telebot.formatting.hcode telebot.formatting.hide_link
#: telebot.formatting.hitalic telebot.formatting.hlink telebot.formatting.hpre
#: telebot.formatting.hspoiler telebot.formatting.hstrikethrough
#: telebot.formatting.hunderline telebot.formatting.mbold
#: telebot.formatting.mcode telebot.formatting.mitalic telebot.formatting.mlink
#: telebot.formatting.mspoiler telebot.formatting.mstrikethrough
#: telebot.formatting.munderline
msgid "Returns"
msgstr ""
#: of telebot.formatting.escape_html:6 telebot.formatting.escape_markdown:8
msgid "The escaped string."
msgstr ""
#: of telebot.formatting.escape_html telebot.formatting.escape_markdown
#: telebot.formatting.format_text telebot.formatting.hbold
#: telebot.formatting.hcode telebot.formatting.hide_link
#: telebot.formatting.hitalic telebot.formatting.hlink telebot.formatting.hpre
#: telebot.formatting.hspoiler telebot.formatting.hstrikethrough
#: telebot.formatting.hunderline telebot.formatting.mbold
#: telebot.formatting.mcode telebot.formatting.mitalic telebot.formatting.mlink
#: telebot.formatting.mspoiler telebot.formatting.mstrikethrough
#: telebot.formatting.munderline
msgid "Return type"
msgstr ""
#: of telebot.formatting.escape_html:7 telebot.formatting.escape_markdown:9
#: telebot.formatting.format_text:17 telebot.formatting.hbold:10
#: telebot.formatting.hcode:10 telebot.formatting.hide_link:7
#: telebot.formatting.hitalic:10 telebot.formatting.hlink:13
#: telebot.formatting.hpre:10 telebot.formatting.hspoiler:10
#: telebot.formatting.hstrikethrough:10 telebot.formatting.hunderline:10
#: telebot.formatting.mbold:10 telebot.formatting.mcode:10
#: telebot.formatting.mitalic:10 telebot.formatting.mlink:13
#: telebot.formatting.mspoiler:10 telebot.formatting.mstrikethrough:10
#: telebot.formatting.munderline:10
msgid ":obj:`str`"
msgstr ""
#: of telebot.formatting.escape_markdown:1
msgid "Escapes Markdown characters in a string of Markdown."
msgstr ""
#: of telebot.formatting.escape_markdown:3
msgid "Credits to: simonsmh"
msgstr ""
#: of telebot.formatting.escape_markdown:5
msgid "The string of Markdown to escape."
msgstr ""
#: of telebot.formatting.format_text:1
msgid "Formats a list of strings into a single string."
msgstr ""
#: of telebot.formatting.format_text:10
msgid "Strings to format."
msgstr ""
#: of telebot.formatting.format_text:13
msgid "The separator to use between each string."
msgstr ""
#: of telebot.formatting.format_text:16 telebot.formatting.hbold:9
#: telebot.formatting.hcode:9 telebot.formatting.hitalic:9
#: telebot.formatting.hlink:12 telebot.formatting.hpre:9
#: telebot.formatting.hspoiler:9 telebot.formatting.hstrikethrough:9
#: telebot.formatting.hunderline:9 telebot.formatting.mbold:9
#: telebot.formatting.mcode:9 telebot.formatting.mitalic:9
#: telebot.formatting.mlink:12 telebot.formatting.mspoiler:9
#: telebot.formatting.mstrikethrough:9 telebot.formatting.munderline:9
msgid "The formatted string."
msgstr ""
#: of telebot.formatting.hbold:1
msgid "Returns an HTML-formatted bold string."
msgstr ""
#: of telebot.formatting.hbold:3 telebot.formatting.mbold:3
msgid "The string to bold."
msgstr ""
#: of telebot.formatting.hbold:6 telebot.formatting.hcode:6
#: telebot.formatting.hitalic:6 telebot.formatting.hlink:9
#: telebot.formatting.hpre:6 telebot.formatting.hspoiler:6
#: telebot.formatting.hstrikethrough:6 telebot.formatting.hunderline:6
#: telebot.formatting.mbold:6 telebot.formatting.mcode:6
#: telebot.formatting.mitalic:6 telebot.formatting.mlink:9
#: telebot.formatting.mspoiler:6 telebot.formatting.mstrikethrough:6
#: telebot.formatting.munderline:6
msgid "True if you need to escape special characters. Defaults to True."
msgstr ""
#: of telebot.formatting.hcode:1
msgid "Returns an HTML-formatted code string."
msgstr ""
#: of telebot.formatting.hcode:3 telebot.formatting.mcode:3
msgid "The string to code."
msgstr ""
#: of telebot.formatting.hide_link:1
msgid "Hide url of an image."
msgstr ""
#: of telebot.formatting.hide_link:3
msgid "The url of the image."
msgstr ""
#: of telebot.formatting.hide_link:6
msgid "The hidden url."
msgstr ""
#: of telebot.formatting.hitalic:1
msgid "Returns an HTML-formatted italic string."
msgstr ""
#: of telebot.formatting.hitalic:3 telebot.formatting.mitalic:3
msgid "The string to italicize."
msgstr ""
#: of telebot.formatting.hlink:1
msgid "Returns an HTML-formatted link string."
msgstr ""
#: of telebot.formatting.hlink:3 telebot.formatting.mlink:3
msgid "The string to link."
msgstr ""
#: of telebot.formatting.hlink:6 telebot.formatting.mlink:6
msgid "The URL to link to."
msgstr ""
#: of telebot.formatting.hpre:1
msgid "Returns an HTML-formatted preformatted string."
msgstr ""
#: of telebot.formatting.hpre:3
msgid "The string to preformatted."
msgstr ""
#: of telebot.formatting.hspoiler:1
msgid "Returns an HTML-formatted spoiler string."
msgstr ""
#: of telebot.formatting.hspoiler:3 telebot.formatting.mspoiler:3
msgid "The string to spoiler."
msgstr ""
#: of telebot.formatting.hstrikethrough:1
msgid "Returns an HTML-formatted strikethrough string."
msgstr ""
#: of telebot.formatting.hstrikethrough:3 telebot.formatting.mstrikethrough:3
msgid "The string to strikethrough."
msgstr ""
#: of telebot.formatting.hunderline:1
msgid "Returns an HTML-formatted underline string."
msgstr ""
#: of telebot.formatting.hunderline:3 telebot.formatting.munderline:3
msgid "The string to underline."
msgstr ""
#: of telebot.formatting.mbold:1
msgid "Returns a Markdown-formatted bold string."
msgstr ""
#: of telebot.formatting.mcode:1
msgid "Returns a Markdown-formatted code string."
msgstr ""
#: of telebot.formatting.mitalic:1
msgid "Returns a Markdown-formatted italic string."
msgstr ""
#: of telebot.formatting.mlink:1
msgid "Returns a Markdown-formatted link string."
msgstr ""
#: of telebot.formatting.mspoiler:1
msgid "Returns a Markdown-formatted spoiler string."
msgstr ""
#: of telebot.formatting.mstrikethrough:1
msgid "Returns a Markdown-formatted strikethrough string."
msgstr ""
#: of telebot.formatting.munderline:1
msgid "Returns a Markdown-formatted underline string."
msgstr ""

View File

@ -0,0 +1,120 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022, coder2020official
# This file is distributed under the same license as the pyTelegramBotAPI
# Documentation package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-29 14:44+0400\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../index.rst:8
msgid "Welcome to pyTelegramBotAPI's documentation!"
msgstr ""
#: ../../index.rst:10
msgid "Official documentation of pyTelegramBotAPI"
msgstr ""
#: ../../index.rst:10
msgid "ptba, pytba, pyTelegramBotAPI, documentation, guide"
msgstr ""
#: ../../index.rst:17
msgid "TeleBot"
msgstr ""
#: ../../index.rst:18
msgid ""
"TeleBot is synchronous and asynchronous implementation of `Telegram Bot "
"API <https://core.telegram.org/bots/api>`_."
msgstr ""
#: ../../index.rst:21
msgid "Chats"
msgstr ""
#: ../../index.rst:22
msgid ""
"English chat: `Private chat "
"<https://telegram.me/joinchat/Bn4ixj84FIZVkwhk2jag6A>`__"
msgstr ""
#: ../../index.rst:24
msgid ""
"Russian chat: `@pytelegrambotapi_talks_ru "
"<https://t.me/pytelegrambotapi_talks_ru>`__"
msgstr ""
#: ../../index.rst:26
msgid "News: `@pyTelegramBotAPI <https://t.me/pytelegrambotapi>`__"
msgstr ""
#: ../../index.rst:28
msgid "Pypi: `Pypi <https://pypi.org/project/pyTelegramBotAPI/>`__"
msgstr ""
#: ../../index.rst:30
msgid ""
"Source: `Github repository "
"<https://github.com/eternnoir/pyTelegramBotAPI>`__"
msgstr ""
#: ../../index.rst:33
msgid "Some features:"
msgstr ""
#: ../../index.rst:34
msgid "Easy to learn and use."
msgstr ""
#: ../../index.rst:36
msgid "Easy to understand."
msgstr ""
#: ../../index.rst:38
msgid "Both sync and async."
msgstr ""
#: ../../index.rst:40
msgid "Examples on features."
msgstr ""
#: ../../index.rst:42
msgid "States"
msgstr ""
#: ../../index.rst:44
msgid "And more..."
msgstr ""
#: ../../index.rst:47
msgid "Content"
msgstr ""
#: ../../index.rst:63
msgid "Indices and tables"
msgstr ""
#: ../../index.rst:65
msgid ":ref:`genindex`"
msgstr ""
#: ../../index.rst:66
msgid ":ref:`modindex`"
msgstr ""
#: ../../index.rst:67
msgid ":ref:`search`"
msgstr ""

View File

@ -0,0 +1,58 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022, coder2020official
# This file is distributed under the same license as the pyTelegramBotAPI
# Documentation package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-29 14:44+0400\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../install.rst:3
msgid "Installation Guide"
msgstr ""
#: ../../install.rst:5
msgid "Installation of pyTelegramBotAPI"
msgstr ""
#: ../../install.rst:5
msgid "ptba, pytba, pyTelegramBotAPI, installation, guide"
msgstr ""
#: ../../install.rst:11
msgid "Using PIP"
msgstr ""
#: ../../install.rst:17
msgid "Using pipenv"
msgstr ""
#: ../../install.rst:23
msgid "By cloning repository"
msgstr ""
#: ../../install.rst:31
msgid "Directly using pip"
msgstr ""
#: ../../install.rst:37
msgid "It is generally recommended to use the first option."
msgstr ""
#: ../../install.rst:39
msgid ""
"While the API is production-ready, it is still under development and it "
"has regular updates, do not forget to update it regularly by calling:"
msgstr ""

View File

@ -0,0 +1,40 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022, coder2020official
# This file is distributed under the same license as the pyTelegramBotAPI
# Documentation package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-29 14:44+0400\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../quick_start.rst:4
msgid "Quick start"
msgstr ""
#: ../../quick_start.rst:6
msgid "Quickstart guide"
msgstr ""
#: ../../quick_start.rst:6
msgid "ptba, pytba, pyTelegramBotAPI, quickstart, guide"
msgstr ""
#: ../../quick_start.rst:11
msgid "Synchronous TeleBot"
msgstr ""
#: ../../quick_start.rst:16
msgid "Asynchronous TeleBot"
msgstr ""

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,345 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022, coder2020official
# This file is distributed under the same license as the pyTelegramBotAPI
# Documentation package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-29 14:44+0400\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../util.rst:3
msgid "Utils"
msgstr ""
#: ../../util.rst:5
msgid "Utils in pyTelegramBotAPI"
msgstr ""
#: ../../util.rst:5
msgid "ptba, pytba, pyTelegramBotAPI, utils, guide"
msgstr ""
#: ../../util.rst:11
msgid "util file"
msgstr ""
#: of telebot.util.antiflood:1
msgid ""
"Use this function inside loops in order to avoid getting TooManyRequests "
"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
#: 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 "Parameters"
msgstr ""
#: of telebot.util.antiflood:10
msgid "The function to call"
msgstr ""
#: of telebot.util.antiflood:13
msgid "The arguments to pass to the function"
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"
msgstr ""
#: of telebot.util.antiflood:19
msgid "None"
msgstr ""
#: of telebot.util.chunks:1
msgid "Yield successive n-sized chunks from lst."
msgstr ""
#: ../../docstring of telebot.util.content_type_media:1
msgid "Contains all media content types."
msgstr ""
#: ../../docstring of telebot.util.content_type_service:1
msgid "Contains all service content types such as `User joined the group`."
msgstr ""
#: of telebot.util.escape:1
msgid ""
"Replaces the following chars in `text` ('&' with '&amp;', '<' with '&lt;'"
" and '>' with '&gt;')."
msgstr ""
#: of telebot.util.escape:3
msgid "the text to escape"
msgstr ""
#: of telebot.util.escape:4
msgid "the escaped text"
msgstr ""
#: of telebot.util.extract_arguments:1
msgid "Returns the argument after the command."
msgstr ""
#: of telebot.util.extract_arguments:3 telebot.util.extract_command:4
msgid "Examples:"
msgstr ""
#: of telebot.util.extract_arguments:10
msgid "String to extract the arguments from a command"
msgstr ""
#: of telebot.util.extract_arguments:13
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
#: telebot.util.quick_markup telebot.util.smart_split telebot.util.split_string
#: telebot.util.user_link
msgid "Return type"
msgstr ""
#: of telebot.util.extract_arguments:14 telebot.util.extract_command:16
msgid ":obj:`str` or :obj:`None`"
msgstr ""
#: of telebot.util.extract_command:1
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 ""
#: of telebot.util.extract_command:12
msgid "String to extract the command from"
msgstr ""
#: of telebot.util.extract_command:15
msgid "the command if `text` is a command (according to is_command), else None."
msgstr ""
#: of telebot.util.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
msgid "a random token"
msgstr ""
#: of telebot.util.generate_random_token:4 telebot.util.user_link:22
msgid ":obj:`str`"
msgstr ""
#: of telebot.util.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
msgid "object to be checked"
msgstr ""
#: of telebot.util.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
msgid ":obj:`bool`"
msgstr ""
#: of telebot.util.is_command:1
msgid ""
"Checks if `text` is a command. Telegram chat commands start with the '/' "
"character."
msgstr ""
#: of telebot.util.is_command:3
msgid "Text to check."
msgstr ""
#: of telebot.util.is_command:6
msgid "True if `text` is a command, else False."
msgstr ""
#: of telebot.util.is_dict:1
msgid "Returns True if the given object is a dictionary."
msgstr ""
#: of telebot.util.is_dict:6
msgid "True if the given object is a dictionary."
msgstr ""
#: of telebot.util.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
msgid "True if the given object is a PIL.Image.Image object."
msgstr ""
#: of telebot.util.is_string:1
msgid "Returns True if the given object is a string."
msgstr ""
#: of telebot.util.parse_web_app_data:1
msgid "Parses web app data."
msgstr ""
#: of telebot.util.parse_web_app_data:3 telebot.util.validate_web_app_data:3
msgid "The bot token"
msgstr ""
#: of telebot.util.parse_web_app_data:6 telebot.util.validate_web_app_data:6
msgid "The raw init data"
msgstr ""
#: of telebot.util.parse_web_app_data:9 telebot.util.validate_web_app_data:9
msgid "The parsed init data"
msgstr ""
#: of telebot.util.quick_markup:1
msgid ""
"Returns a reply markup from a dict in this format: {'text': kwargs} This "
"is useful to avoid always typing 'btn1 = InlineKeyboardButton(...)' 'btn2"
" = InlineKeyboardButton(...)'"
msgstr ""
#: of telebot.util.quick_markup:4 telebot.util.user_link:5
msgid "Example:"
msgstr ""
#: of telebot.util.quick_markup:6
msgid "Using quick_markup:"
msgstr ""
#: of telebot.util.quick_markup:29
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"
msgstr ""
#: of telebot.util.quick_markup:35
msgid "InlineKeyboardMarkup"
msgstr ""
#: of telebot.util.quick_markup:36
msgid ":obj:`types.InlineKeyboardMarkup`"
msgstr ""
#: of telebot.util.smart_split:1
msgid ""
"Splits one string into multiple strings, with a maximum amount of "
"`chars_per_string` characters per string. This is very useful for "
"splitting one giant message into multiples. If `chars_per_string` > 4096:"
" `chars_per_string` = 4096. Splits by '\\n', '. ' or ' ' in exactly this "
"priority."
msgstr ""
#: of telebot.util.smart_split:6 telebot.util.split_string:4
msgid "The text to split"
msgstr ""
#: of telebot.util.smart_split:9
msgid "The number of maximum characters per part the text is split to."
msgstr ""
#: of telebot.util.smart_split:12 telebot.util.split_string:10
msgid "The splitted text as a list of strings."
msgstr ""
#: of telebot.util.smart_split:13 telebot.util.split_string:11
msgid ":obj:`list` of :obj:`str`"
msgstr ""
#: of telebot.util.split_string:1
msgid ""
"Splits one string into multiple strings, with a maximum amount of "
"`chars_per_string` characters per string. This is very useful for "
"splitting one giant message into multiples."
msgstr ""
#: of telebot.util.split_string:7
msgid "The number of characters per line the text is split into."
msgstr ""
#: ../../docstring of telebot.util.update_types:1
msgid "All update types, should be used for allowed_updates parameter in polling."
msgstr ""
#: 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 ""
#: of telebot.util.user_link:11
msgid ""
"You can use formatting.* for all other formatting options(bold, italic, "
"links, and etc.) This method is kept for backward compatibility, and it "
"is recommended to use formatting.* for more options."
msgstr ""
#: of telebot.util.user_link:15
msgid "the user (not the user_id)"
msgstr ""
#: of telebot.util.user_link:18
msgid "include the user_id"
msgstr ""
#: of telebot.util.user_link:21
msgid "HTML user link"
msgstr ""
#: of telebot.util.validate_web_app_data:1
msgid "Validates web app data."
msgstr ""
#: of telebot.util.webhook_google_functions:1
msgid "A webhook endpoint for Google Cloud Functions FaaS."
msgstr ""
#: of telebot.util.webhook_google_functions:3
msgid "The bot instance"
msgstr ""
#: of telebot.util.webhook_google_functions:6
msgid "The request object"
msgstr ""
#: of telebot.util.webhook_google_functions:9
msgid "The response object"
msgstr ""

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,130 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022, coder2020official
# This file is distributed under the same license as the pyTelegramBotAPI
# Documentation package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-29 14:44+0400\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../calldata.rst:4
msgid "Callback data factory"
msgstr "Фабрика callback data"
#: ../../calldata.rst:6
msgid "Callback data factory in pyTelegramBotAPI"
msgstr "Фабрика callback data в pyTelegramBotAPI"
#: ../../calldata.rst:6
msgid ""
"ptba, pytba, pyTelegramBotAPI, callbackdatafactory, guide, callbackdata, "
"factory"
msgstr ""
"ptba, pytba, pyTelegramBotAPI, callbackdatafactory, гайд, callbackdata, "
"фабрика"
#: ../../calldata.rst:12
msgid "callback\\_data file"
msgstr "Файл callback\\_data"
#: of telebot.callback_data:1
msgid "Callback data factory's file."
msgstr "Файл фабрики callback data."
#: of telebot.callback_data.CallbackData:1
#: telebot.callback_data.CallbackDataFilter:1
msgid "Bases: :py:class:`object`"
msgstr "Базовые классы: :py:class:`object`"
#: of telebot.callback_data.CallbackData:1
msgid "Callback data factory This class will help you to work with CallbackQuery"
msgstr "Фабрика Callback data. Этот класс поможет вам в работе с CallbackQuery"
#: of telebot.callback_data.CallbackData.filter:1
msgid "Generate filter"
msgstr "Сгенерировать фильтр"
#: of telebot.callback_data.CallbackData.filter
#: telebot.callback_data.CallbackData.new
#: telebot.callback_data.CallbackData.parse
#: telebot.callback_data.CallbackDataFilter.check
msgid "Parameters"
msgstr ""
#: of telebot.callback_data.CallbackData.filter:3
msgid "specified named parameters will be checked with CallbackQuery.data"
msgstr "заданные именованные параметры будут проверены в CallbackQuery.data"
#: of telebot.callback_data.CallbackData.filter
#: telebot.callback_data.CallbackData.new
#: telebot.callback_data.CallbackData.parse
#: telebot.callback_data.CallbackDataFilter.check
msgid "Returns"
msgstr ""
#: of telebot.callback_data.CallbackData.filter:4
msgid "CallbackDataFilter class"
msgstr "Класс CallbackDataFilter"
#: of telebot.callback_data.CallbackData.new:1
msgid "Generate callback data"
msgstr "Сгенерировать callback data"
#: of telebot.callback_data.CallbackData.new:3
msgid "positional parameters of CallbackData instance parts"
msgstr "позиционные параметры экземпляра CallbackData"
#: of telebot.callback_data.CallbackData.new:4
msgid "named parameters"
msgstr "именованные параметры"
#: of telebot.callback_data.CallbackData.new:5
msgid "str"
msgstr ""
#: of telebot.callback_data.CallbackData.parse:1
msgid "Parse data from the callback data"
msgstr "Получить данные из callback data"
#: of telebot.callback_data.CallbackData.parse:3
msgid ""
"string, use to telebot.types.CallbackQuery to parse it from string to a "
"dict"
msgstr ""
"string, примените к telebot.types.CallbackQuery, чтобы преобразовать "
"callback_data из строки (str) в словарь (dict)"
#: of telebot.callback_data.CallbackData.parse:4
msgid "dict parsed from callback data"
msgstr "словарь (dict), полученный из callback data"
#: of telebot.callback_data.CallbackDataFilter:1
msgid "Filter for CallbackData."
msgstr "Фильтр для CallbackData."
#: of telebot.callback_data.CallbackDataFilter.check:1
msgid "Checks if query.data appropriates to specified config"
msgstr "Проверяет, соответствует ли query.data заданной конфигурации"
#: of telebot.callback_data.CallbackDataFilter.check:3
msgid "telebot.types.CallbackQuery"
msgstr ""
#: of telebot.callback_data.CallbackDataFilter.check:6
msgid "True if query.data appropriates to specified config"
msgstr "True, если query.data соответствует заданной конфигурации"
#: of telebot.callback_data.CallbackDataFilter.check
msgid "Return type"
msgstr ""

View File

@ -0,0 +1,251 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022, coder2020official
# This file is distributed under the same license as the pyTelegramBotAPI
# Documentation package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-29 14:44+0400\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../formatting.rst:3
msgid "Formatting options"
msgstr "Параметры форматирования"
#: ../../formatting.rst:5
msgid "Formatting options in pyTelegramBotAPI"
msgstr "Параметры форматирования в pyTelegramBotAPI"
#: ../../formatting.rst:5
msgid "html, markdown, parse_mode, formatting, ptba, pytba, pyTelegramBotAPI"
msgstr "html, markdown, parse_mode, форматирование, ptba, pytba, pyTelegramBotAPI"
#: of telebot.formatting:1
msgid "Markdown & HTML formatting functions."
msgstr "Функции форматирования Markdown & HTML."
#: of telebot.formatting.escape_html:1
msgid "Escapes HTML characters in a string of HTML."
msgstr "Пропускает HTML символы в HTML строке."
#: of telebot.formatting.escape_html telebot.formatting.escape_markdown
#: telebot.formatting.format_text telebot.formatting.hbold
#: telebot.formatting.hcode telebot.formatting.hide_link
#: telebot.formatting.hitalic telebot.formatting.hlink telebot.formatting.hpre
#: telebot.formatting.hspoiler telebot.formatting.hstrikethrough
#: telebot.formatting.hunderline telebot.formatting.mbold
#: telebot.formatting.mcode telebot.formatting.mitalic telebot.formatting.mlink
#: telebot.formatting.mspoiler telebot.formatting.mstrikethrough
#: telebot.formatting.munderline
msgid "Parameters"
msgstr ""
#: of telebot.formatting.escape_html:3
msgid "The string of HTML to escape."
msgstr "HTML строка, которую нужно пропустить."
#: of telebot.formatting.escape_html telebot.formatting.escape_markdown
#: telebot.formatting.format_text telebot.formatting.hbold
#: telebot.formatting.hcode telebot.formatting.hide_link
#: telebot.formatting.hitalic telebot.formatting.hlink telebot.formatting.hpre
#: telebot.formatting.hspoiler telebot.formatting.hstrikethrough
#: telebot.formatting.hunderline telebot.formatting.mbold
#: telebot.formatting.mcode telebot.formatting.mitalic telebot.formatting.mlink
#: telebot.formatting.mspoiler telebot.formatting.mstrikethrough
#: telebot.formatting.munderline
msgid "Returns"
msgstr ""
#: of telebot.formatting.escape_html:6 telebot.formatting.escape_markdown:8
msgid "The escaped string."
msgstr "Пропускаемая строка."
#: of telebot.formatting.escape_html telebot.formatting.escape_markdown
#: telebot.formatting.format_text telebot.formatting.hbold
#: telebot.formatting.hcode telebot.formatting.hide_link
#: telebot.formatting.hitalic telebot.formatting.hlink telebot.formatting.hpre
#: telebot.formatting.hspoiler telebot.formatting.hstrikethrough
#: telebot.formatting.hunderline telebot.formatting.mbold
#: telebot.formatting.mcode telebot.formatting.mitalic telebot.formatting.mlink
#: telebot.formatting.mspoiler telebot.formatting.mstrikethrough
#: telebot.formatting.munderline
msgid "Return type"
msgstr ""
#: of telebot.formatting.escape_html:7 telebot.formatting.escape_markdown:9
#: telebot.formatting.format_text:17 telebot.formatting.hbold:10
#: telebot.formatting.hcode:10 telebot.formatting.hide_link:7
#: telebot.formatting.hitalic:10 telebot.formatting.hlink:13
#: telebot.formatting.hpre:10 telebot.formatting.hspoiler:10
#: telebot.formatting.hstrikethrough:10 telebot.formatting.hunderline:10
#: telebot.formatting.mbold:10 telebot.formatting.mcode:10
#: telebot.formatting.mitalic:10 telebot.formatting.mlink:13
#: telebot.formatting.mspoiler:10 telebot.formatting.mstrikethrough:10
#: telebot.formatting.munderline:10
msgid ":obj:`str`"
msgstr ""
#: of telebot.formatting.escape_markdown:1
msgid "Escapes Markdown characters in a string of Markdown."
msgstr "Пропускает Markdown символы в Markdown строке."
#: of telebot.formatting.escape_markdown:3
msgid "Credits to: simonsmh"
msgstr ""
#: of telebot.formatting.escape_markdown:5
msgid "The string of Markdown to escape."
msgstr "Markdown строка, которую нужно пропустить."
#: of telebot.formatting.format_text:1
msgid "Formats a list of strings into a single string."
msgstr "Преобразовывает набор строк в одну."
#: of telebot.formatting.format_text:10
msgid "Strings to format."
msgstr "Строки для преобразования."
#: of telebot.formatting.format_text:13
msgid "The separator to use between each string."
msgstr "Символ для разделения строк."
#: of telebot.formatting.format_text:16 telebot.formatting.hbold:9
#: telebot.formatting.hcode:9 telebot.formatting.hitalic:9
#: telebot.formatting.hlink:12 telebot.formatting.hpre:9
#: telebot.formatting.hspoiler:9 telebot.formatting.hstrikethrough:9
#: telebot.formatting.hunderline:9 telebot.formatting.mbold:9
#: telebot.formatting.mcode:9 telebot.formatting.mitalic:9
#: telebot.formatting.mlink:12 telebot.formatting.mspoiler:9
#: telebot.formatting.mstrikethrough:9 telebot.formatting.munderline:9
msgid "The formatted string."
msgstr "Преобразованная строка."
#: of telebot.formatting.hbold:1
msgid "Returns an HTML-formatted bold string."
msgstr "Возвращает выделенную жирным шрифтом HTML строку."
#: of telebot.formatting.hbold:3 telebot.formatting.mbold:3
msgid "The string to bold."
msgstr "Строка для выделения жирным шрифтом."
#: of telebot.formatting.hbold:6 telebot.formatting.hcode:6
#: telebot.formatting.hitalic:6 telebot.formatting.hlink:9
#: telebot.formatting.hpre:6 telebot.formatting.hspoiler:6
#: telebot.formatting.hstrikethrough:6 telebot.formatting.hunderline:6
#: telebot.formatting.mbold:6 telebot.formatting.mcode:6
#: telebot.formatting.mitalic:6 telebot.formatting.mlink:9
#: telebot.formatting.mspoiler:6 telebot.formatting.mstrikethrough:6
#: telebot.formatting.munderline:6
msgid "True if you need to escape special characters. Defaults to True."
msgstr "True если вам нужно пропустить спец. символы. По умолчанию True."
#: of telebot.formatting.hcode:1
msgid "Returns an HTML-formatted code string."
msgstr "Возвращает выделенную как код HTML строку."
#: of telebot.formatting.hcode:3 telebot.formatting.mcode:3
msgid "The string to code."
msgstr "Строка для выделения как код."
#: of telebot.formatting.hide_link:1
msgid "Hide url of an image."
msgstr "Делает невидимым URL изображения."
#: of telebot.formatting.hide_link:3
msgid "The url of the image."
msgstr "URL изображения."
#: of telebot.formatting.hide_link:6
msgid "The hidden url."
msgstr "Невидимый URL."
#: of telebot.formatting.hitalic:1
msgid "Returns an HTML-formatted italic string."
msgstr "Возвращает выделенную курсивом HTML строку."
#: of telebot.formatting.hitalic:3 telebot.formatting.mitalic:3
msgid "The string to italicize."
msgstr "Строка для выделения курсивом."
#: of telebot.formatting.hlink:1
msgid "Returns an HTML-formatted link string."
msgstr "Возвращает HTML строку с гиперссылкой."
#: of telebot.formatting.hlink:3 telebot.formatting.mlink:3
msgid "The string to link."
msgstr "Строка для добавления гиперссылки."
#: of telebot.formatting.hlink:6 telebot.formatting.mlink:6
msgid "The URL to link to."
msgstr "URL для создания гиперссылки."
#: of telebot.formatting.hpre:1
msgid "Returns an HTML-formatted preformatted string."
msgstr "Возвращает предварительно отформатированную HTML строку."
#: of telebot.formatting.hpre:3
msgid "The string to preformatted."
msgstr "Строка для предварительного форматирования."
#: of telebot.formatting.hspoiler:1
msgid "Returns an HTML-formatted spoiler string."
msgstr "Возвращает выделенную как спойлер HTML строку."
#: of telebot.formatting.hspoiler:3 telebot.formatting.mspoiler:3
msgid "The string to spoiler."
msgstr "Строка для выделения как спойлер."
#: of telebot.formatting.hstrikethrough:1
msgid "Returns an HTML-formatted strikethrough string."
msgstr "Возвращает зачеркнутую HTML строку."
#: of telebot.formatting.hstrikethrough:3 telebot.formatting.mstrikethrough:3
msgid "The string to strikethrough."
msgstr "Строка для зачеркивания."
#: of telebot.formatting.hunderline:1
msgid "Returns an HTML-formatted underline string."
msgstr "Возвращает подчеркнутую HTML строку."
#: of telebot.formatting.hunderline:3 telebot.formatting.munderline:3
msgid "The string to underline."
msgstr "Строка для подчёркивания."
#: of telebot.formatting.mbold:1
msgid "Returns a Markdown-formatted bold string."
msgstr "Возвращает выделенную жирным шрифтом Markdown строку."
#: of telebot.formatting.mcode:1
msgid "Returns a Markdown-formatted code string."
msgstr "Возвращает выделенную как код Markdown строку."
#: of telebot.formatting.mitalic:1
msgid "Returns a Markdown-formatted italic string."
msgstr "Возвращает выделенную курсивом Markdown строку."
#: of telebot.formatting.mlink:1
msgid "Returns a Markdown-formatted link string."
msgstr "Возвращает Markdown строку с гиперссылкой."
#: of telebot.formatting.mspoiler:1
msgid "Returns a Markdown-formatted spoiler string."
msgstr "Возвращает выделенную как спойлер Markdown строку."
#: of telebot.formatting.mstrikethrough:1
msgid "Returns a Markdown-formatted strikethrough string."
msgstr "Возвращает зачеркнутую Markdown строку."
#: of telebot.formatting.munderline:1
msgid "Returns a Markdown-formatted underline string."
msgstr "Возвращает подчеркнутую Markdown строку."

View File

@ -0,0 +1,128 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022, coder2020official
# This file is distributed under the same license as the pyTelegramBotAPI
# Documentation package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-29 14:44+0400\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../index.rst:8
msgid "Welcome to pyTelegramBotAPI's documentation!"
msgstr "Добро пожаловать в документацию pyTelegramBotAPI!"
#: ../../index.rst:10
msgid "Official documentation of pyTelegramBotAPI"
msgstr "Официальная документация pyTelegramBotAPI"
#: ../../index.rst:10
msgid "ptba, pytba, pyTelegramBotAPI, documentation, guide"
msgstr "ptba, pytba, pyTelegramBotAPI, документация, гайд"
#: ../../index.rst:17
msgid "TeleBot"
msgstr ""
#: ../../index.rst:18
msgid ""
"TeleBot is synchronous and asynchronous implementation of `Telegram Bot "
"API <https://core.telegram.org/bots/api>`_."
msgstr ""
"TeleBot это синхронная и асинхронная реализация `Telegram Bot "
"API <https://core.telegram.org/bots/api>`_."
#: ../../index.rst:21
msgid "Chats"
msgstr "Чаты"
#: ../../index.rst:22
msgid ""
"English chat: `Private chat "
"<https://telegram.me/joinchat/Bn4ixj84FIZVkwhk2jag6A>`__"
msgstr ""
"Англоязычный чат: `Private chat "
"<https://telegram.me/joinchat/Bn4ixj84FIZVkwhk2jag6A>`__"
#: ../../index.rst:24
msgid ""
"Russian chat: `@pytelegrambotapi_talks_ru "
"<https://t.me/pytelegrambotapi_talks_ru>`__"
msgstr ""
"Русскоязычный чат: `@pytelegrambotapi_talks_ru "
"<https://t.me/pytelegrambotapi_talks_ru>`__"
#: ../../index.rst:26
msgid "News: `@pyTelegramBotAPI <https://t.me/pytelegrambotapi>`__"
msgstr "Новости: `@pyTelegramBotAPI <https://t.me/pytelegrambotapi>`__"
#: ../../index.rst:28
msgid "Pypi: `Pypi <https://pypi.org/project/pyTelegramBotAPI/>`__"
msgstr ""
#: ../../index.rst:30
msgid ""
"Source: `Github repository "
"<https://github.com/eternnoir/pyTelegramBotAPI>`__"
msgstr ""
"Исходники: `Github repository "
"<https://github.com/eternnoir/pyTelegramBotAPI>`__"
#: ../../index.rst:33
msgid "Some features:"
msgstr "Некоторые особенности:"
#: ../../index.rst:34
msgid "Easy to learn and use."
msgstr "Простой в изучении и использовании."
#: ../../index.rst:36
msgid "Easy to understand."
msgstr "Простой в понимании."
#: ../../index.rst:38
msgid "Both sync and async."
msgstr "И синхронный, и асинхронный."
#: ../../index.rst:40
msgid "Examples on features."
msgstr "Примеры возможностей."
#: ../../index.rst:42
msgid "States"
msgstr "Состояния (стейты, FSM)"
#: ../../index.rst:44
msgid "And more..."
msgstr "И другое..."
#: ../../index.rst:47
msgid "Content"
msgstr "Содержимое"
#: ../../index.rst:63
msgid "Indices and tables"
msgstr "Ссылки"
#: ../../index.rst:65
msgid ":ref:`genindex`"
msgstr ""
#: ../../index.rst:66
msgid ":ref:`modindex`"
msgstr ""
#: ../../index.rst:67
msgid ":ref:`search`"
msgstr ""

View File

@ -0,0 +1,59 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022, coder2020official
# This file is distributed under the same license as the pyTelegramBotAPI
# Documentation package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-29 14:44+0400\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../install.rst:3
msgid "Installation Guide"
msgstr "Гайд по установке"
#: ../../install.rst:5
msgid "Installation of pyTelegramBotAPI"
msgstr "Установка pyTelegramBotAPI"
#: ../../install.rst:5
msgid "ptba, pytba, pyTelegramBotAPI, installation, guide"
msgstr "ptba, pytba, pyTelegramBotAPI, установка, гайд"
#: ../../install.rst:11
msgid "Using PIP"
msgstr "Используя PIP"
#: ../../install.rst:17
msgid "Using pipenv"
msgstr "Используя pipenv"
#: ../../install.rst:23
msgid "By cloning repository"
msgstr "Клонируя репозиторий"
#: ../../install.rst:31
msgid "Directly using pip"
msgstr "Напрямую используя pip"
#: ../../install.rst:37
msgid "It is generally recommended to use the first option."
msgstr "Рекомендуется использовать первый вариант."
#: ../../install.rst:39
msgid ""
"While the API is production-ready, it is still under development and it "
"has regular updates, do not forget to update it regularly by calling:"
msgstr "Новые версии библиотеки имеют больше фич, улучшений и баг фиксов. Не забывайте"
" обновляться вызывая:"

View File

@ -0,0 +1,40 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022, coder2020official
# This file is distributed under the same license as the pyTelegramBotAPI
# Documentation package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-29 14:44+0400\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../quick_start.rst:4
msgid "Quick start"
msgstr "Быстрый старт"
#: ../../quick_start.rst:6
msgid "Quickstart guide"
msgstr "Быстрый старт - гайд"
#: ../../quick_start.rst:6
msgid "ptba, pytba, pyTelegramBotAPI, quickstart, guide"
msgstr "ptba, pytba, pyTelegramBotAPI, быстрый старт, гайд"
#: ../../quick_start.rst:11
msgid "Synchronous TeleBot"
msgstr "Синхронный телебот"
#: ../../quick_start.rst:16
msgid "Asynchronous TeleBot"
msgstr "Асинхронный телебот"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,366 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022, coder2020official
# This file is distributed under the same license as the pyTelegramBotAPI
# Documentation package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pyTelegramBotAPI Documentation \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-29 14:44+0400\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../util.rst:3
msgid "Utils"
msgstr "Утилиты"
#: ../../util.rst:5
msgid "Utils in pyTelegramBotAPI"
msgstr "Утилиты в pyTelegramBotAPI"
#: ../../util.rst:5
msgid "ptba, pytba, pyTelegramBotAPI, utils, guide"
msgstr "ptba, pytba, pyTelegramBotAPI, утилиты, гайд"
#: ../../util.rst:11
msgid "util file"
msgstr "Файл util"
#: of telebot.util.antiflood:1
msgid ""
"Use this function inside loops in order to avoid getting TooManyRequests "
"error. Example:"
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
#: 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 "Parameters"
msgstr ""
#: of telebot.util.antiflood:10
msgid "The function to call"
msgstr "Вызываемая функция"
#: of telebot.util.antiflood:13
msgid "The arguments to pass to the function"
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"
msgstr ""
#: of telebot.util.antiflood:19
msgid "None"
msgstr ""
#: of telebot.util.chunks:1
msgid "Yield successive n-sized chunks from lst."
msgstr "Генерирует последовательные части списка, состоящие из n элементов."
#: ../../docstring of telebot.util.content_type_media:1
msgid "Contains all media content types."
msgstr "Содержит все виды медиа."
#: ../../docstring of telebot.util.content_type_service:1
msgid "Contains all service content types such as `User joined the group`."
msgstr "Содержит все виды сервисных сообщений, такие как `User joined the group`."
#: of telebot.util.escape:1
msgid ""
"Replaces the following chars in `text` ('&' with '&amp;', '<' with '&lt;'"
" and '>' with '&gt;')."
msgstr "Заменяет следующие символы в `text` ('&' на '&amp;', '<' на '&lt;'"
" и '>' на '&gt;')."
#: of telebot.util.escape:3
msgid "the text to escape"
msgstr "Текст для замены символов"
#: of telebot.util.escape:4
msgid "the escaped text"
msgstr "Отформатированный текст"
#: of telebot.util.extract_arguments:1
msgid "Returns the argument after the command."
msgstr "Возвращает аргументы команды."
#: of telebot.util.extract_arguments:3 telebot.util.extract_command:4
msgid "Examples:"
msgstr "Примеры:"
#: of telebot.util.extract_arguments:10
msgid "String to extract the arguments from a command"
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."
#: 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
#: telebot.util.quick_markup telebot.util.smart_split telebot.util.split_string
#: telebot.util.user_link
msgid "Return type"
msgstr ""
#: of telebot.util.extract_arguments:14 telebot.util.extract_command:16
msgid ":obj:`str` or :obj:`None`"
msgstr ":obj:`str` или :obj:`None`"
#: of telebot.util.extract_command:1
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."
#: of telebot.util.extract_command:12
msgid "String to extract the command from"
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."
#: of telebot.util.generate_random_token:1
msgid ""
"Generates a random token consisting of letters and digits, 16 characters "
"long."
msgstr "Генерирует рандомный токен, состоящий из латинских букв и цифр длиной 16 символов."
#: of telebot.util.generate_random_token:3
msgid "a random token"
msgstr "Сгенерированный токен"
#: of telebot.util.generate_random_token:4 telebot.util.user_link:22
msgid ":obj:`str`"
msgstr ""
#: of telebot.util.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
msgid "object to be checked"
msgstr "Объект для проверки"
#: of telebot.util.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
msgid ":obj:`bool`"
msgstr ""
#: of telebot.util.is_command:1
msgid ""
"Checks if `text` is a command. Telegram chat commands start with the '/' "
"character."
msgstr ""
"Проверяет, является ли `text` командой. Команды в Telegram начинаются "
"с символа '/'."
#: of telebot.util.is_command:3
msgid "Text to check."
msgstr "Текст для проверки."
#: of telebot.util.is_command:6
msgid "True if `text` is a command, else False."
msgstr "True, если `text` является командой, иначе False."
#: of telebot.util.is_dict:1
msgid "Returns True if the given object is a dictionary."
msgstr "Возвращает True, если полученный объект является словарём (dict)."
#: of telebot.util.is_dict:6
msgid "True if the given object is a dictionary."
msgstr "True, если полученный объект является словарём (dict)."
#: of telebot.util.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
msgid "True if the given object is a PIL.Image.Image object."
msgstr "True, если полученный объект является PIL.Image.Image."
#: of telebot.util.is_string:1
msgid "Returns True if the given object is a string."
msgstr "Возвращает True, если полученный объект является строкой (str)."
#: of telebot.util.parse_web_app_data:1
msgid "Parses web app data."
msgstr "Обрабатывает данные, полученные от web app."
#: of telebot.util.parse_web_app_data:3 telebot.util.validate_web_app_data:3
msgid "The bot token"
msgstr "Токен бота"
#: of telebot.util.parse_web_app_data:6 telebot.util.validate_web_app_data:6
msgid "The raw init data"
msgstr "Необработанные данные"
#: of telebot.util.parse_web_app_data:9 telebot.util.validate_web_app_data:9
msgid "The parsed init data"
msgstr "Обработанные данные"
#: of telebot.util.quick_markup:1
msgid ""
"Returns a reply markup from a dict in this format: {'text': kwargs} This "
"is useful to avoid always typing 'btn1 = InlineKeyboardButton(...)' 'btn2"
" = InlineKeyboardButton(...)'"
msgstr ""
"Возвращает reply markup из словаря следующего формата: {'text': kwargs}. Удобно "
"использовать вместо постоянного использования 'btn1 = InlineKeyboardButton(...)' 'btn2"
" = InlineKeyboardButton(...)'"
#: of telebot.util.quick_markup:4 telebot.util.user_link:5
msgid "Example:"
msgstr "Пример:"
#: of telebot.util.quick_markup:6
msgid "Using quick_markup:"
msgstr "Используя quick_markup:"
#: of telebot.util.quick_markup:29
msgid ""
"a dict containing all buttons to create in this format: {text: kwargs} "
"{str:}"
msgstr ""
"Словарь, содержащий все кнопки для создания reply markup в следующем "
"формате: {text: kwargs} {str:}"
#: of telebot.util.quick_markup:32
msgid "int row width"
msgstr "Количество кнопок в одной строке, int"
#: of telebot.util.quick_markup:35
msgid "InlineKeyboardMarkup"
msgstr ""
#: of telebot.util.quick_markup:36
msgid ":obj:`types.InlineKeyboardMarkup`"
msgstr ""
#: of telebot.util.smart_split:1
msgid ""
"Splits one string into multiple strings, with a maximum amount of "
"`chars_per_string` characters per string. This is very useful for "
"splitting one giant message into multiples. If `chars_per_string` > 4096:"
" `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', '. ' или ' ' "
"именно в таком порядке."
#: of telebot.util.smart_split:6 telebot.util.split_string:4
msgid "The text to split"
msgstr "Текст для разбиения"
#: of telebot.util.smart_split:9
msgid "The number of maximum characters per part the text is split to."
msgstr "Максимальное количество символов в части текста, на которые он будет разбит."
#: of telebot.util.smart_split:12 telebot.util.split_string:10
msgid "The splitted text as a list of strings."
msgstr "Список частей разбитого текста."
#: of telebot.util.smart_split:13 telebot.util.split_string:11
msgid ":obj:`list` of :obj:`str`"
msgstr ""
#: of telebot.util.split_string:1
msgid ""
"Splits one string into multiple strings, with a maximum amount of "
"`chars_per_string` characters per string. This is very useful for "
"splitting one giant message into multiples."
msgstr ""
"Разбивает одну строку на несколько, каждая из которых будет не длиннее `characters_per_string`. "
"Удобно использовать для разбиения одного гигантского сообщения на несколько."
#: of telebot.util.split_string:7
msgid "The number of characters per line the text is split into."
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."
#: 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!"
#: of telebot.util.user_link:11
msgid ""
"You can use formatting.* for all other formatting options(bold, italic, "
"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.* для большего количества вариантов."
#: of telebot.util.user_link:15
msgid "the user (not the user_id)"
msgstr "Пользователь (не id пользователя)"
#: of telebot.util.user_link:18
msgid "include the user_id"
msgstr "Добавить id пользователя"
#: of telebot.util.user_link:21
msgid "HTML user link"
msgstr "Ссылка на пользователя в формате HTML"
#: of telebot.util.validate_web_app_data:1
msgid "Validates web app data."
msgstr "Проверяет данные, полученные от web app."
#: of telebot.util.webhook_google_functions:1
msgid "A webhook endpoint for Google Cloud Functions FaaS."
msgstr "Endpoint вебхука для Google Cloud Functions FaaS."
#: of telebot.util.webhook_google_functions:3
msgid "The bot instance"
msgstr "Инстанс бота"
#: of telebot.util.webhook_google_functions:6
msgid "The request object"
msgstr "HTTP-запрос"
#: of telebot.util.webhook_google_functions:9
msgid "The response object"
msgstr "Объект, полученный в качестве ответа"

View File

@ -0,0 +1,20 @@
===========
Quick start
===========
.. meta::
:description: Quickstart guide
:keywords: ptba, pytba, pyTelegramBotAPI, quickstart, guide
Synchronous TeleBot
-------------------
.. literalinclude:: ../../examples/echo_bot.py
:language: python
Asynchronous TeleBot
--------------------
.. literalinclude:: ../../examples/asynchronous_telebot/echo_bot.py
:language: python

View File

@ -0,0 +1,41 @@
===============
TeleBot version
===============
.. meta::
:description: Synchronous pyTelegramBotAPI documentation
:keywords: ptba, pytba, pyTelegramBotAPI, methods, guide, files, sync
TeleBot methods
---------------
.. automodule:: telebot
:members:
:undoc-members:
:show-inheritance:
custom_filters file
------------------------------
.. automodule:: telebot.custom_filters
:members:
:undoc-members:
:show-inheritance:
handler_backends file
--------------------------------
.. automodule:: telebot.handler_backends
:members:
:undoc-members:
:show-inheritance:
Extensions
------------------------
.. automodule:: telebot.ext.sync.webhooks
:members:
:undoc-members:
:show-inheritance:

10
docs/source/types.rst Normal file
View File

@ -0,0 +1,10 @@
============
Types of API
============
.. automodule:: telebot.types
:members:
:undoc-members:
:show-inheritance:

16
docs/source/util.rst Normal file
View File

@ -0,0 +1,16 @@
============
Utils
============
.. meta::
:description: Utils in pyTelegramBotAPI
:keywords: ptba, pytba, pyTelegramBotAPI, utils, guide
util file
-------------------
.. automodule:: telebot.util
:members:
:undoc-members:
:show-inheritance:

117
examples/anonymous_bot.py Normal file
View File

@ -0,0 +1,117 @@
# This bot is needed to connect two people and their subsequent anonymous communication
#
# Avaiable commands:
# `/start` - Just send you a messsage how to start
# `/find` - Find a person you can contact
# `/stop` - Stop active conversation
import telebot
from telebot import types
# Initialize bot with your token
bot = telebot.TeleBot('TOKEN')
# The `users` variable is needed to contain chat ids that are either in the search or in the active dialog, like {chat_id, chat_id}
users = {}
# The `freeid` variable is needed to contain chat id, that want to start conversation
# Or, in other words: chat id of user in the search
freeid = None
# `/start` command handler
#
# That command only sends you 'Just use /find command!'
@bot.message_handler(commands=['start'])
def start(message: types.Message):
bot.send_message(message.chat.id, 'Just use /find command!')
# `/find` command handler
#
# That command finds opponent for you
#
# That command according to the following principle:
# 1. You have written `/find` command
# 2. If you are already in the search or have an active dialog, bot sends you 'Shut up!'
# 3. If not:
# 3.1. Bot sends you 'Finding...'
# 3.2. If there is no user in the search:
# 3.2.2. `freeid` updated with `your_chat_id`
# 3.3. If there is user in the search:
# 3.3.1. Both you and the user in the search recieve the message 'Founded!'
# 3.3.2. `users` updated with a {user_in_the_search_chat_id, your_chat_id}
# 3.3.3. `users` updated with a {your_chat_id, user_in_the_search_id}
# 3.3.4. `freeid` updated with `None`
@bot.message_handler(commands=['find'])
def find(message: types.Message):
global freeid
if message.chat.id not in users:
bot.send_message(message.chat.id, 'Finding...')
if freeid is None:
freeid = message.chat.id
else:
# Question:
# Is there any way to simplify this like `bot.send_message([message.chat.id, freeid], 'Founded!')`?
bot.send_message(message.chat.id, 'Founded!')
bot.send_message(freeid, 'Founded!')
users[freeid] = message.chat.id
users[message.chat.id] = freeid
freeid = None
print(users, freeid) # Debug purpose, you can remove that line
else:
bot.send_message(message.chat.id, 'Shut up!')
# `/stop` command handler
#
# That command stops your current conversation (if it exist)
#
# That command according to the following principle:
# 1. You have written `/stop` command
# 2. If you are not have active dialog or you are not in search, bot sends you 'You are not in search!'
# 3. If you are in active dialog:
# 3.1. Bot sends you 'Stopping...'
# 3.2. Bot sends 'Your opponent is leavin`...' to your opponent
# 3.3. {your_opponent_chat_id, your_chat_id} removes from `users`
# 3.4. {your_chat_id, your_opponent_chat_id} removes from `users`
# 4. If you are only in search:
# 4.1. Bot sends you 'Stopping...'
# 4.2. `freeid` updated with `None`
@bot.message_handler(commands=['stop'])
def stop(message: types.Message):
global freeid
if message.chat.id in users:
bot.send_message(message.chat.id, 'Stopping...')
bot.send_message(users[message.chat.id], 'Your opponent is leavin`...')
del users[users[message.chat.id]]
del users[message.chat.id]
print(users, freeid) # Debug purpose, you can remove that line
elif message.chat.id == freeid:
bot.send_message(message.chat.id, 'Stopping...')
freeid = None
print(users, freeid) # Debug purpose, you can remove that line
else:
bot.send_message(message.chat.id, 'You are not in search!')
# message handler for conversation
#
# That handler needed to send message from one opponent to another
# If you are not in `users`, you will recieve a message 'No one can hear you...'
# Otherwise all your messages are sent to your opponent
#
# Questions:
# 1. Is there any way to improve readability like `content_types=['all']`?
# 2. Is there any way to register this message handler only when i found the opponent?
@bot.message_handler(content_types=['animation', 'audio', 'contact', 'dice', 'document', 'location', 'photo', 'poll', 'sticker', 'text', 'venue', 'video', 'video_note', 'voice'])
def chatting(message: types.Message):
if message.chat.id in users:
bot.copy_message(users[message.chat.id], users[users[message.chat.id]], message.id)
else:
bot.send_message(message.chat.id, 'No one can hear you...')
bot.infinity_polling(skip_pending=True)

View File

@ -0,0 +1,26 @@
from telebot import types
from telebot.async_telebot import AsyncTeleBot
from telebot.asyncio_filters import AdvancedCustomFilter
from telebot.callback_data import CallbackData, CallbackDataFilter
calendar_factory = CallbackData("year", "month", prefix="calendar")
calendar_zoom = CallbackData("year", prefix="calendar_zoom")
class CalendarCallbackFilter(AdvancedCustomFilter):
key = 'calendar_config'
async def check(self, call: types.CallbackQuery, config: CallbackDataFilter):
return config.check(query=call)
class CalendarZoomCallbackFilter(AdvancedCustomFilter):
key = 'calendar_zoom_config'
async def check(self, call: types.CallbackQuery, config: CallbackDataFilter):
return config.check(query=call)
def bind_filters(bot: AsyncTeleBot):
bot.add_custom_filter(CalendarCallbackFilter())
bot.add_custom_filter(CalendarZoomCallbackFilter())

View File

@ -0,0 +1,92 @@
import calendar
from datetime import date, timedelta
from filters import calendar_factory, calendar_zoom
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
EMTPY_FIELD = '1'
WEEK_DAYS = [calendar.day_abbr[i] for i in range(7)]
MONTHS = [(i, calendar.month_name[i]) for i in range(1, 13)]
def generate_calendar_days(year: int, month: int):
keyboard = InlineKeyboardMarkup(row_width=7)
today = date.today()
keyboard.add(
InlineKeyboardButton(
text=date(year=year, month=month, day=1).strftime('%b %Y'),
callback_data=EMTPY_FIELD
)
)
keyboard.add(*[
InlineKeyboardButton(
text=day,
callback_data=EMTPY_FIELD
)
for day in WEEK_DAYS
])
for week in calendar.Calendar().monthdayscalendar(year=year, month=month):
week_buttons = []
for day in week:
day_name = ' '
if day == today.day and today.year == year and today.month == month:
day_name = '🔘'
elif day != 0:
day_name = str(day)
week_buttons.append(
InlineKeyboardButton(
text=day_name,
callback_data=EMTPY_FIELD
)
)
keyboard.add(*week_buttons)
previous_date = date(year=year, month=month, day=1) - timedelta(days=1)
next_date = date(year=year, month=month, day=1) + timedelta(days=31)
keyboard.add(
InlineKeyboardButton(
text='Previous month',
callback_data=calendar_factory.new(year=previous_date.year, month=previous_date.month)
),
InlineKeyboardButton(
text='Zoom out',
callback_data=calendar_zoom.new(year=year)
),
InlineKeyboardButton(
text='Next month',
callback_data=calendar_factory.new(year=next_date.year, month=next_date.month)
),
)
return keyboard
def generate_calendar_months(year: int):
keyboard = InlineKeyboardMarkup(row_width=3)
keyboard.add(
InlineKeyboardButton(
text=date(year=year, month=1, day=1).strftime('Year %Y'),
callback_data=EMTPY_FIELD
)
)
keyboard.add(*[
InlineKeyboardButton(
text=month,
callback_data=calendar_factory.new(year=year, month=month_number)
)
for month_number, month in MONTHS
])
keyboard.add(
InlineKeyboardButton(
text='Previous year',
callback_data=calendar_zoom.new(year=year - 1)
),
InlineKeyboardButton(
text='Next year',
callback_data=calendar_zoom.new(year=year + 1)
)
)
return keyboard

View File

@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
"""
This Example will show you an advanced usage of CallbackData.
In this example calendar was implemented
"""
import asyncio
from datetime import date
from filters import calendar_factory, calendar_zoom, bind_filters
from keyboards import generate_calendar_days, generate_calendar_months, EMTPY_FIELD
from telebot import types
from telebot.async_telebot import AsyncTeleBot
API_TOKEN = ''
bot = AsyncTeleBot(API_TOKEN)
@bot.message_handler(commands='start')
async def start_command_handler(message: types.Message):
await bot.send_message(message.chat.id,
f"Hello {message.from_user.first_name}. This bot is an example of calendar keyboard."
"\nPress /calendar to see it.")
@bot.message_handler(commands='calendar')
async def calendar_command_handler(message: types.Message):
now = date.today()
await bot.send_message(message.chat.id, 'Calendar',
reply_markup=generate_calendar_days(year=now.year, month=now.month))
@bot.callback_query_handler(func=None, calendar_config=calendar_factory.filter())
async def calendar_action_handler(call: types.CallbackQuery):
callback_data: dict = calendar_factory.parse(callback_data=call.data)
year, month = int(callback_data['year']), int(callback_data['month'])
await bot.edit_message_reply_markup(call.message.chat.id, call.message.id,
reply_markup=generate_calendar_days(year=year, month=month))
@bot.callback_query_handler(func=None, calendar_zoom_config=calendar_zoom.filter())
async def calendar_zoom_out_handler(call: types.CallbackQuery):
callback_data: dict = calendar_zoom.parse(callback_data=call.data)
year = int(callback_data.get('year'))
await bot.edit_message_reply_markup(call.message.chat.id, call.message.id,
reply_markup=generate_calendar_months(year=year))
@bot.callback_query_handler(func=lambda call: call.data == EMTPY_FIELD)
async def callback_empty_field_handler(call: types.CallbackQuery):
await bot.answer_callback_query(call.id)
if __name__ == '__main__':
bind_filters(bot)
asyncio.run(bot.infinity_polling())

View File

@ -0,0 +1,88 @@
# -*- coding: utf-8 -*-
"""
This Example will show you how to use CallbackData
"""
from telebot.callback_data import CallbackData, CallbackDataFilter
from telebot import types
from telebot.async_telebot import AsyncTeleBot
from telebot.asyncio_filters import AdvancedCustomFilter
API_TOKEN = 'TOKEN'
PRODUCTS = [
{'id': '0', 'name': 'xiaomi mi 10', 'price': 400},
{'id': '1', 'name': 'samsung s20', 'price': 800},
{'id': '2', 'name': 'iphone 13', 'price': 1300}
]
bot = AsyncTeleBot(API_TOKEN)
products_factory = CallbackData('product_id', prefix='products')
def products_keyboard():
return types.InlineKeyboardMarkup(
keyboard=[
[
types.InlineKeyboardButton(
text=product['name'],
callback_data=products_factory.new(product_id=product["id"])
)
]
for product in PRODUCTS
]
)
def back_keyboard():
return types.InlineKeyboardMarkup(
keyboard=[
[
types.InlineKeyboardButton(
text='',
callback_data='back'
)
]
]
)
class ProductsCallbackFilter(AdvancedCustomFilter):
key = 'config'
async def check(self, call: types.CallbackQuery, config: CallbackDataFilter):
return config.check(query=call)
@bot.message_handler(commands=['products'])
async def products_command_handler(message: types.Message):
await bot.send_message(message.chat.id, 'Products:', reply_markup=products_keyboard())
# Only product with field - product_id = 2
@bot.callback_query_handler(func=None, config=products_factory.filter(product_id='2'))
async def product_one_callback(call: types.CallbackQuery):
await bot.answer_callback_query(callback_query_id=call.id, text='Not available :(', show_alert=True)
# Any other products
@bot.callback_query_handler(func=None, config=products_factory.filter())
async def products_callback(call: types.CallbackQuery):
callback_data: dict = products_factory.parse(callback_data=call.data)
product_id = int(callback_data['product_id'])
product = PRODUCTS[product_id]
text = f"Product name: {product['name']}\n" \
f"Product price: {product['price']}"
await bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id,
text=text, reply_markup=back_keyboard())
@bot.callback_query_handler(func=lambda c: c.data == 'back')
async def back_callback(call: types.CallbackQuery):
await bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id,
text='Products:', reply_markup=products_keyboard())
bot.add_custom_filter(ProductsCallbackFilter())
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,12 @@
from telebot.async_telebot import AsyncTeleBot
import telebot
bot = AsyncTeleBot('TOKEN')
@bot.chat_join_request_handler()
async def make_some(message: telebot.types.ChatJoinRequest):
await bot.send_message(message.chat.id, 'I accepted a new user!')
await bot.approve_chat_join_request(message.chat.id, message.from_user.id)
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,34 @@
from telebot import types,util
from telebot.async_telebot import AsyncTeleBot
bot = AsyncTeleBot('TOKEN')
#chat_member_handler. When status changes, telegram gives update. check status from old_chat_member and new_chat_member.
@bot.chat_member_handler()
async def chat_m(message: types.ChatMemberUpdated):
old = message.old_chat_member
new = message.new_chat_member
if new.status == "member":
await bot.send_message(message.chat.id,"Hello {name}!".format(name=new.user.first_name)) # Welcome message
#if bot is added to group, this handler will work
@bot.my_chat_member_handler()
async def my_chat_m(message: types.ChatMemberUpdated):
old = message.old_chat_member
new = message.new_chat_member
if new.status == "member":
await bot.send_message(message.chat.id,"Somebody added me to group") # Welcome message, if bot was added to group
await bot.leave_chat(message.chat.id)
#content_Type_service is:
#'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'
# this handler deletes service messages
@bot.message_handler(content_types=util.content_type_service)
async def delall(message: types.Message):
await bot.delete_message(message.chat.id,message.message_id)
import asyncio
asyncio.run(bot.polling(allowed_updates=util.update_types))

View File

@ -0,0 +1,27 @@
from telebot.async_telebot import AsyncTeleBot
from telebot.asyncio_handler_backends import ContinueHandling
bot = AsyncTeleBot('TOKEN')
@bot.message_handler(commands=['start'])
async def start(message):
await bot.send_message(message.chat.id, 'Hello World!')
return ContinueHandling()
@bot.message_handler(commands=['start'])
async def start2(message):
"""
This handler comes after the first one, but it will never be called.
But you can call it by returning ContinueHandling() in the first handler.
If you return ContinueHandling() in the first handler, the next
registered handler with appropriate filters will be called.
"""
await bot.send_message(message.chat.id, 'Hello World2!')
import asyncio
asyncio.run(bot.polling()) # just a reminder that infinity polling
# wraps polling into try/except block just as sync version,
# but you can use any of them because neither of them stops if you
# pass non_stop=True

View File

@ -0,0 +1,14 @@
from telebot.async_telebot import AsyncTeleBot
from telebot import asyncio_filters
bot = AsyncTeleBot('TOKEN')
# Handler
@bot.message_handler(chat_types=['supergroup'], is_chat_admin=True)
async def answer_for_admin(message):
await bot.send_message(message.chat.id,"hello my admin")
# Register filter
bot.add_custom_filter(asyncio_filters.IsAdminFilter(bot))
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,127 @@
# -*- coding: utf-8 -*-
"""
This Example will show you usage of TextFilter
In this example you will see how to use TextFilter
with (message_handler, callback_query_handler, poll_handler)
"""
import asyncio
from telebot import types
from telebot.async_telebot import AsyncTeleBot
from telebot.asyncio_filters import TextMatchFilter, TextFilter, IsReplyFilter
bot = AsyncTeleBot("")
@bot.message_handler(text=TextFilter(equals='hello'))
async def hello_handler(message: types.Message):
await bot.send_message(message.chat.id, message.text)
@bot.message_handler(text=TextFilter(equals='hello', ignore_case=True))
async def hello_handler_ignore_case(message: types.Message):
await bot.send_message(message.chat.id, message.text + ' ignore case')
@bot.message_handler(text=TextFilter(contains=['good', 'bad']))
async def contains_handler(message: types.Message):
await bot.send_message(message.chat.id, message.text)
@bot.message_handler(text=TextFilter(contains=['good', 'bad'], ignore_case=True))
async def contains_handler_ignore_case(message: types.Message):
await bot.send_message(message.chat.id, message.text + ' ignore case')
@bot.message_handler(text=TextFilter(starts_with='st')) # stArk, steve, stONE
async def starts_with_handler(message: types.Message):
await bot.send_message(message.chat.id, message.text)
@bot.message_handler(text=TextFilter(starts_with='st', ignore_case=True)) # STark, sTeve, stONE
async def starts_with_handler_ignore_case(message: types.Message):
await bot.send_message(message.chat.id, message.text + ' ignore case')
@bot.message_handler(text=TextFilter(ends_with='ay')) # wednesday, SUNday, WeekDay
async def ends_with_handler(message: types.Message):
await bot.send_message(message.chat.id, message.text)
@bot.message_handler(text=TextFilter(ends_with='ay', ignore_case=True)) # wednesdAY, sundAy, WeekdaY
async def ends_with_handler_ignore_case(message: types.Message):
await bot.send_message(message.chat.id, message.text + ' ignore case')
@bot.message_handler(text=TextFilter(equals='/callback'))
async def send_callback(message: types.Message):
keyboard = types.InlineKeyboardMarkup(
keyboard=[
[types.InlineKeyboardButton(text='callback data', callback_data='example')],
[types.InlineKeyboardButton(text='ignore case callback data', callback_data='ExAmPLe')]
]
)
await bot.send_message(message.chat.id, message.text, reply_markup=keyboard)
@bot.callback_query_handler(func=None, text=TextFilter(equals='example'))
async def callback_query_handler(call: types.CallbackQuery):
await bot.answer_callback_query(call.id, call.data, show_alert=True)
@bot.callback_query_handler(func=None, text=TextFilter(equals='example', ignore_case=True))
async def callback_query_handler_ignore_case(call: types.CallbackQuery):
await bot.answer_callback_query(call.id, call.data + " ignore case", show_alert=True)
@bot.message_handler(text=TextFilter(equals='/poll'))
async def send_poll(message: types.Message):
await bot.send_poll(message.chat.id, question='When do you prefer to work?', options=['Morning', 'Night'])
await bot.send_poll(message.chat.id, question='WHEN DO you pRefeR to worK?', options=['Morning', 'Night'])
@bot.poll_handler(func=None, text=TextFilter(equals='When do you prefer to work?'))
async def poll_question_handler(poll: types.Poll):
print(poll.question)
@bot.poll_handler(func=None, text=TextFilter(equals='When do you prefer to work?', ignore_case=True))
async def poll_question_handler_ignore_case(poll: types.Poll):
print(poll.question + ' ignore case')
# either hi or contains one of (привет, salom)
@bot.message_handler(text=TextFilter(equals="hi", contains=('привет', 'salom'), ignore_case=True))
async def multiple_patterns_handler(message: types.Message):
await bot.send_message(message.chat.id, message.text)
# starts with one of (mi, mea) for ex. minor, milk, meal, meat
@bot.message_handler(text=TextFilter(starts_with=['mi', 'mea'], ignore_case=True))
async def multiple_starts_with_handler(message: types.Message):
await bot.send_message(message.chat.id, message.text)
# ends with one of (es, on) for ex. Jones, Davies, Johnson, Wilson
@bot.message_handler(text=TextFilter(ends_with=['es', 'on'], ignore_case=True))
async def multiple_ends_with_handler(message: types.Message):
await bot.send_message(message.chat.id, message.text)
# !ban /ban .ban !бан /бан .бан
@bot.message_handler(is_reply=True,
text=TextFilter(starts_with=('!', '/', '.'), ends_with=['ban', 'бан'], ignore_case=True))
async def ban_command_handler(message: types.Message):
if len(message.text) == 4 and message.chat.type != 'private':
try:
await bot.ban_chat_member(message.chat.id, message.reply_to_message.from_user.id)
await bot.reply_to(message.reply_to_message, 'Banned.')
except Exception as err:
print(err.args)
return
if __name__ == '__main__':
bot.add_custom_filter(TextMatchFilter())
bot.add_custom_filter(IsReplyFilter())
asyncio.run(bot.polling())

View File

@ -0,0 +1,44 @@
from telebot.async_telebot import AsyncTeleBot
import telebot
bot = AsyncTeleBot('TOKEN')
# AdvancedCustomFilter is for list, string filter values
class MainFilter(telebot.asyncio_filters.AdvancedCustomFilter):
key='text'
@staticmethod
async def check(message, text):
return message.text in text
# SimpleCustomFilter is for boolean values, such as is_admin=True
class IsAdmin(telebot.asyncio_filters.SimpleCustomFilter):
key='is_admin'
@staticmethod
async def check(message: telebot.types.Message):
result = await bot.get_chat_member(message.chat.id,message.from_user.id)
return result.status in ['administrator','creator']
@bot.message_handler(is_admin=True, commands=['admin']) # Check if user is admin
async def admin_rep(message):
await bot.send_message(message.chat.id, "Hi admin")
@bot.message_handler(is_admin=False, commands=['admin']) # If user is not admin
async def not_admin(message):
await bot.send_message(message.chat.id, "You are not admin")
@bot.message_handler(text=['hi']) # Response to hi message
async def welcome_hi(message):
await bot.send_message(message.chat.id, 'You said hi')
@bot.message_handler(text=['bye']) # Response to bye message
async def bye_user(message):
await bot.send_message(message.chat.id, 'You said bye')
# Do not forget to register filters
bot.add_custom_filter(MainFilter())
bot.add_custom_filter(IsAdmin())
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,18 @@
from telebot.async_telebot import AsyncTeleBot
import telebot
bot = AsyncTeleBot('TOKEN')
# Chat id can be private or supergroups.
@bot.message_handler(chat_id=[12345678], commands=['admin']) # chat_id checks id corresponds to your list or not.
async def admin_rep(message):
await bot.send_message(message.chat.id, "You are allowed to use this command.")
@bot.message_handler(commands=['admin'])
async def not_admin(message):
await bot.send_message(message.chat.id, "You are not allowed to use this command")
# Do not forget to register
bot.add_custom_filter(telebot.asyncio_filters.ChatFilter())
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,23 @@
from telebot.async_telebot import AsyncTeleBot
import telebot
bot = AsyncTeleBot('TOKEN')
# Check if message is a reply
@bot.message_handler(is_reply=True)
async def start_filter(message):
await bot.send_message(message.chat.id, "Looks like you replied to my message.")
# Check if message was forwarded
@bot.message_handler(is_forwarded=True)
async def text_filter(message):
await bot.send_message(message.chat.id, "I do not accept forwarded messages!")
# Do not forget to register filters
bot.add_custom_filter(telebot.asyncio_filters.IsReplyFilter())
bot.add_custom_filter(telebot.asyncio_filters.ForwardFilter())
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,21 @@
from telebot.async_telebot import AsyncTeleBot
import telebot
bot = AsyncTeleBot('TOKEN')
# Check if message starts with @admin tag
@bot.message_handler(text_startswith="@admin")
async def start_filter(message):
await bot.send_message(message.chat.id, "Looks like you are calling admin, wait...")
# Check if text is hi or hello
@bot.message_handler(text=['hi','hello'])
async def text_filter(message):
await bot.send_message(message.chat.id, "Hi, {name}!".format(name=message.from_user.first_name))
# Do not forget to register filters
bot.add_custom_filter(telebot.asyncio_filters.TextMatchFilter())
bot.add_custom_filter(telebot.asyncio_filters.TextStartsFilter())
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,91 @@
from telebot import asyncio_filters
from telebot.async_telebot import AsyncTeleBot
# list of storages, you can use any storage
from telebot.asyncio_storage import StateMemoryStorage
# new feature for states.
from telebot.asyncio_handler_backends import State, StatesGroup
# default state storage is statememorystorage
bot = AsyncTeleBot('TOKEN', state_storage=StateMemoryStorage())
# Just create different statesgroup
class MyStates(StatesGroup):
name = State() # statesgroup should contain states
surname = State()
age = State()
# set_state -> sets a new state
# delete_state -> delets state if exists
# get_state -> returns state if exists
@bot.message_handler(commands=['start'])
async def start_ex(message):
"""
Start command. Here we are starting state
"""
await bot.set_state(message.from_user.id, MyStates.name, message.chat.id)
await bot.send_message(message.chat.id, 'Hi, write me a name')
@bot.message_handler(state="*", commands='cancel')
async def any_state(message):
"""
Cancel state
"""
await bot.send_message(message.chat.id, "Your state was cancelled.")
await bot.delete_state(message.from_user.id, message.chat.id)
@bot.message_handler(state=MyStates.name)
async def name_get(message):
"""
State 1. Will process when user's state is MyStates.name.
"""
await bot.send_message(message.chat.id, f'Now write me a surname')
await bot.set_state(message.from_user.id, MyStates.surname, message.chat.id)
async with bot.retrieve_data(message.from_user.id, message.chat.id) as data:
data['name'] = message.text
@bot.message_handler(state=MyStates.surname)
async def ask_age(message):
"""
State 2. Will process when user's state is MyStates.surname.
"""
await bot.send_message(message.chat.id, "What is your age?")
await bot.set_state(message.from_user.id, MyStates.age, message.chat.id)
async with bot.retrieve_data(message.from_user.id, message.chat.id) as data:
data['surname'] = message.text
# result
@bot.message_handler(state=MyStates.age, is_digit=True)
async def ready_for_answer(message):
"""
State 3. Will process when user's state is MyStates.age.
"""
async with bot.retrieve_data(message.from_user.id, message.chat.id) as data:
await bot.send_message(message.chat.id, "Ready, take a look:\n<b>Name: {name}\nSurname: {surname}\nAge: {age}</b>".format(name=data['name'], surname=data['surname'], age=message.text), parse_mode="html")
await bot.delete_state(message.from_user.id, message.chat.id)
#incorrect number
@bot.message_handler(state=MyStates.age, is_digit=False)
async def age_incorrect(message):
"""
Will process for wrong input when state is MyState.age
"""
await bot.send_message(message.chat.id, 'Looks like you are submitting a string in the field age. Please enter a number')
# register filters
bot.add_custom_filter(asyncio_filters.StateFilter(bot))
bot.add_custom_filter(asyncio_filters.IsDigitFilter())
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,28 @@
#!/usr/bin/python
# This is a simple echo bot using the decorator mechanism.
# It echoes any incoming text messages.
from telebot.async_telebot import AsyncTeleBot
bot = AsyncTeleBot('TOKEN')
# Handle '/start' and '/help'
@bot.message_handler(commands=['help', 'start'])
async def send_welcome(message):
await bot.reply_to(message, """\
Hi there, I am EchoBot.
I am here to echo your kind words back to you. Just say anything nice and I'll say the exact same thing to you!\
""")
# Handle all other messages with content_type 'text' (content_types defaults to ['text'])
@bot.message_handler(func=lambda message: True)
async def echo_message(message):
await bot.reply_to(message, message.text)
import asyncio
# only for versions 4.7.0+
asyncio.run(bot.polling(restart_on_change=True))

View File

@ -0,0 +1,21 @@
import telebot
from telebot.async_telebot import AsyncTeleBot
bot = AsyncTeleBot('TOKEN')
@bot.message_handler(content_types=['photo'])
async def new_message(message: telebot.types.Message):
result_message = await bot.send_message(message.chat.id, '<i>Downloading your photo...</i>', parse_mode='HTML', disable_web_page_preview=True)
file_path = await bot.get_file(message.photo[-1].file_id)
downloaded_file = await bot.download_file(file_path.file_path)
with open('file.jpg', 'wb') as new_file:
new_file.write(downloaded_file)
await bot.edit_message_text(chat_id=message.chat.id, message_id=result_message.id, text='<i>Done!</i>', parse_mode='HTML')
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,27 @@
#!/usr/bin/python
# This is a simple echo bot using the decorator mechanism.
# It echoes any incoming text messages.
from telebot.async_telebot import AsyncTeleBot
bot = AsyncTeleBot('TOKEN')
# Handle '/start' and '/help'
@bot.message_handler(commands=['help', 'start'])
async def send_welcome(message):
await bot.reply_to(message, """\
Hi there, I am EchoBot.
I am here to echo your kind words back to you. Just say anything nice and I'll say the exact same thing to you!\
""")
# Handle all other messages with content_type 'text' (content_types defaults to ['text'])
@bot.message_handler(func=lambda message: True)
async def echo_message(message):
await bot.reply_to(message, message.text)
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,28 @@
import telebot
from telebot.async_telebot import AsyncTeleBot
import logging
logger = telebot.logger
telebot.logger.setLevel(logging.DEBUG) # Outputs debug messages to console.
class ExceptionHandler(telebot.ExceptionHandler):
def handle(self, exception):
logger.error(exception)
bot = AsyncTeleBot('TOKEN',exception_handler=ExceptionHandler())
@bot.message_handler(commands=['photo'])
async def photo_send(message: telebot.types.Message):
await bot.send_message(message.chat.id, 'Hi, this is an example of exception handlers.')
raise Exception('test') # Exception goes to ExceptionHandler if it is set
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,54 @@
from telebot.async_telebot import AsyncTeleBot
from telebot import formatting
bot = AsyncTeleBot('token')
@bot.message_handler(commands=['start'])
async def start_message(message):
await bot.send_message(
message.chat.id,
# function which connects all strings
formatting.format_text(
formatting.mbold(message.from_user.first_name),
formatting.mitalic(message.from_user.first_name),
formatting.munderline(message.from_user.first_name),
formatting.mstrikethrough(message.from_user.first_name),
formatting.mcode(message.from_user.first_name),
separator=" " # separator separates all strings
),
parse_mode='MarkdownV2'
)
# just a bold text using markdownv2
await bot.send_message(
message.chat.id,
formatting.mbold(message.from_user.first_name),
parse_mode='MarkdownV2'
)
# html
await bot.send_message(
message.chat.id,
formatting.format_text(
formatting.hbold(message.from_user.first_name),
formatting.hitalic(message.from_user.first_name),
formatting.hunderline(message.from_user.first_name),
formatting.hstrikethrough(message.from_user.first_name),
formatting.hcode(message.from_user.first_name),
# hide_link is only for html
formatting.hide_link('https://telegra.ph/file/c158e3a6e2a26a160b253.jpg'),
separator=" "
),
parse_mode='HTML'
)
# just a bold text in html
await bot.send_message(
message.chat.id,
formatting.hbold(message.from_user.first_name),
parse_mode='HTML'
)
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,38 @@
# Just a little example of middleware handlers
from telebot.asyncio_handler_backends import BaseMiddleware, CancelUpdate
from telebot.async_telebot import AsyncTeleBot
bot = AsyncTeleBot('TOKEN')
class SimpleMiddleware(BaseMiddleware):
def __init__(self, limit) -> None:
self.last_time = {}
self.limit = limit
self.update_types = ['message']
# Always specify update types, otherwise middlewares won't work
async def pre_process(self, message, data):
if not message.from_user.id in self.last_time:
# User is not in a dict, so lets add and cancel this function
self.last_time[message.from_user.id] = message.date
return
if message.date - self.last_time[message.from_user.id] < self.limit:
# User is flooding
await bot.send_message(message.chat.id, 'You are making request too often')
return CancelUpdate()
self.last_time[message.from_user.id] = message.date
async def post_process(self, message, data, exception):
pass
bot.setup_middleware(SimpleMiddleware(2))
@bot.message_handler(commands=['start'])
async def start(message):
await bot.send_message(message.chat.id, 'Hello!')
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,49 @@
#!/usr/bin/python
# This example shows how to implement i18n (internationalization) l10n (localization) to create
# multi-language bots with middleware handler.
#
# Also, you could check language code in handler itself too.
# But this example just to show the work of middlewares.
import telebot
from telebot.async_telebot import AsyncTeleBot
from telebot import asyncio_handler_backends
import logging
logger = telebot.logger
telebot.logger.setLevel(logging.DEBUG) # Outputs debug messages to console.
TRANSLATIONS = {
'hello': {
'en': 'hello',
'ru': 'привет',
'uz': 'salom'
}
}
bot = AsyncTeleBot('TOKEN')
class LanguageMiddleware(asyncio_handler_backends.BaseMiddleware):
def __init__(self):
self.update_types = ['message'] # Update types that will be handled by this middleware.
async def pre_process(self, message, data):
data['response'] = TRANSLATIONS['hello'][message.from_user.language_code]
async def post_process(self, message, data, exception):
if exception: # You can get exception occured in handler.
logger.exception(str(exception))
bot.setup_middleware(LanguageMiddleware()) # do not forget to setup
@bot.message_handler(commands=['start'])
async def start(message, data: dict):
# you can get the data in handler too.
# Not necessary to create data parameter in handler function.
await bot.send_message(message.chat.id, data['response'])
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,120 @@
import contextvars
import gettext
import os
from telebot.asyncio_handler_backends import BaseMiddleware
try:
from babel.support import LazyProxy
babel_imported = True
except ImportError:
babel_imported = False
class I18N(BaseMiddleware):
"""
This middleware provides high-level tool for internationalization
It is based on gettext util.
"""
context_lang = contextvars.ContextVar('language', default=None)
def __init__(self, translations_path, domain_name: str):
super().__init__()
self.update_types = self.process_update_types()
self.path = translations_path
self.domain = domain_name
self.translations = self.find_translations()
@property
def available_translations(self):
return list(self.translations)
def gettext(self, text: str, lang: str = None):
"""
Singular translations
"""
if lang is None:
lang = self.context_lang.get()
if lang not in self.translations:
return text
translator = self.translations[lang]
return translator.gettext(text)
def ngettext(self, singular: str, plural: str, lang: str = None, n=1):
"""
Plural translations
"""
if lang is None:
lang = self.context_lang.get()
if lang not in self.translations:
if n == 1:
return singular
return plural
translator = self.translations[lang]
return translator.ngettext(singular, plural, n)
def lazy_gettext(self, text: str, lang: str = None):
if not babel_imported:
raise RuntimeError('babel module is not imported. Check that you installed it.')
return LazyProxy(self.gettext, text, lang, enable_cache=False)
def lazy_ngettext(self, singular: str, plural: str, lang: str = None, n=1):
if not babel_imported:
raise RuntimeError('babel module is not imported. Check that you installed it.')
return LazyProxy(self.ngettext, singular, plural, lang, n, enable_cache=False)
async def get_user_language(self, obj):
"""
You need to override this method and return user language
"""
raise NotImplementedError
def process_update_types(self) -> list:
"""
You need to override this method and return any update types which you want to be processed
"""
raise NotImplementedError
async def pre_process(self, message, data):
"""
context language variable will be set each time when update from 'process_update_types' comes
value is the result of 'get_user_language' method
"""
self.context_lang.set(await self.get_user_language(obj=message))
async def post_process(self, message, data, exception):
pass
def find_translations(self):
"""
Looks for translations with passed 'domain' in passed 'path'
"""
if not os.path.exists(self.path):
raise RuntimeError(f"Translations directory by path: {self.path!r} was not found")
result = {}
for name in os.listdir(self.path):
translations_path = os.path.join(self.path, name, 'LC_MESSAGES')
if not os.path.isdir(translations_path):
continue
po_file = os.path.join(translations_path, self.domain + '.po')
mo_file = po_file[:-2] + 'mo'
if os.path.isfile(po_file) and not os.path.isfile(mo_file):
raise FileNotFoundError(f"Translations for: {name!r} were not compiled!")
with open(mo_file, 'rb') as file:
result[name] = gettext.GNUTranslations(file)
return result

View File

@ -0,0 +1,34 @@
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton, ReplyKeyboardMarkup, KeyboardButton
def languages_keyboard():
return InlineKeyboardMarkup(
keyboard=[
[
InlineKeyboardButton(text="English", callback_data='en'),
InlineKeyboardButton(text="Русский", callback_data='ru'),
InlineKeyboardButton(text="O'zbekcha", callback_data='uz_Latn')
]
]
)
def clicker_keyboard(_):
return InlineKeyboardMarkup(
keyboard=[
[
InlineKeyboardButton(text=_("click"), callback_data='click'),
]
]
)
def menu_keyboard(_):
keyboard = ReplyKeyboardMarkup(resize_keyboard=True)
keyboard.add(
KeyboardButton(text=_("My user id")),
KeyboardButton(text=_("My user name")),
KeyboardButton(text=_("My first name"))
)
return keyboard

View File

@ -0,0 +1,81 @@
# English translations for PROJECT.
# Copyright (C) 2022 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2022-02-19 18:37+0500\n"
"PO-Revision-Date: 2022-02-18 16:22+0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language-Team: en <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: keyboards.py:20
msgid "click"
msgstr ""
#: keyboards.py:29
msgid "My user id"
msgstr ""
#: keyboards.py:30
msgid "My user name"
msgstr ""
#: keyboards.py:31
msgid "My first name"
msgstr ""
#: main.py:97
msgid ""
"Hello, {user_fist_name}!\n"
"This is the example of multilanguage bot.\n"
"Available commands:\n"
"\n"
"/lang - change your language\n"
"/plural - pluralization example\n"
"/menu - text menu example"
msgstr ""
#: main.py:121
msgid "Language has been changed"
msgstr ""
#: main.py:130 main.py:150
#, fuzzy
msgid "You have {number} click"
msgid_plural "You have {number} clicks"
msgstr[0] ""
msgstr[1] ""
#: main.py:135 main.py:155
msgid ""
"This is clicker.\n"
"\n"
msgstr ""
#: main.py:163
msgid "This is ReplyKeyboardMarkup menu example in multilanguage bot."
msgstr ""
#: main.py:203
msgid "Seems you confused language"
msgstr ""
#~ msgid ""
#~ "Hello, {user_fist_name}!\n"
#~ "This is the example of multilanguage bot.\n"
#~ "Available commands:\n"
#~ "\n"
#~ "/lang - change your language\n"
#~ "/plural - pluralization example"
#~ msgstr ""

View File

@ -0,0 +1,82 @@
# Russian translations for PROJECT.
# Copyright (C) 2022 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2022-02-19 18:37+0500\n"
"PO-Revision-Date: 2022-02-18 16:22+0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: ru\n"
"Language-Team: ru <LL@li.org>\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: keyboards.py:20
msgid "click"
msgstr "Клик"
#: keyboards.py:29
msgid "My user id"
msgstr "Мой user id"
#: keyboards.py:30
msgid "My user name"
msgstr "Мой user name"
#: keyboards.py:31
msgid "My first name"
msgstr "Мой first name"
#: main.py:97
msgid ""
"Hello, {user_fist_name}!\n"
"This is the example of multilanguage bot.\n"
"Available commands:\n"
"\n"
"/lang - change your language\n"
"/plural - pluralization example\n"
"/menu - text menu example"
msgstr ""
"Привет, {user_fist_name}!\n"
"Это пример мультиязычного бота.\n"
"Доступные команды:\n"
"\n"
"/lang - изменить язык\n"
"/plural - пример плюрализации\n"
"/menu - Пример текстового меню"
#: main.py:121
msgid "Language has been changed"
msgstr "Язык был сменён"
#: main.py:130 main.py:150
msgid "You have {number} click"
msgid_plural "You have {number} clicks"
msgstr[0] "У вас {number} клик"
msgstr[1] "У вас {number} клика"
msgstr[2] "У вас {number} кликов"
#: main.py:135 main.py:155
msgid ""
"This is clicker.\n"
"\n"
msgstr ""
"Это кликер.\n"
"\n"
#: main.py:163
msgid "This is ReplyKeyboardMarkup menu example in multilanguage bot."
msgstr "Это пример ReplyKeyboardMarkup меню в мультиязычном боте."
#: main.py:203
msgid "Seems you confused language"
msgstr "Кажется, вы перепутали язык"

View File

@ -0,0 +1,80 @@
# Uzbek (Latin) translations for PROJECT.
# Copyright (C) 2022 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2022-02-19 18:37+0500\n"
"PO-Revision-Date: 2022-02-18 16:22+0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: uz_Latn\n"
"Language-Team: uz_Latn <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: keyboards.py:20
msgid "click"
msgstr "clik"
#: keyboards.py:29
msgid "My user id"
msgstr "Mani user id"
#: keyboards.py:30
msgid "My user name"
msgstr "Mani user name"
#: keyboards.py:31
msgid "My first name"
msgstr "Mani first name"
#: main.py:97
msgid ""
"Hello, {user_fist_name}!\n"
"This is the example of multilanguage bot.\n"
"Available commands:\n"
"\n"
"/lang - change your language\n"
"/plural - pluralization example\n"
"/menu - text menu example"
msgstr ""
"Salom, {user_fist_name}!\n"
"Bu multilanguage bot misoli.\n"
"Mavjud buyruqlar:\n"
"\n"
"/lang - tilni ozgartirish\n"
"/plural - pluralizatsiya misoli\n"
"/menu - text menu misoli"
#: main.py:121
msgid "Language has been changed"
msgstr "Til ozgartirildi"
#: main.py:130 main.py:150
msgid "You have {number} click"
msgid_plural "You have {number} clicks"
msgstr[0] "Sizda {number}ta clik"
msgstr[1] "Sizda {number}ta clik"
#: main.py:135 main.py:155
msgid ""
"This is clicker.\n"
"\n"
msgstr ""
"Bu clicker.\n"
"\n"
#: main.py:163
msgid "This is ReplyKeyboardMarkup menu example in multilanguage bot."
msgstr "Bu multilanguage bot da replykeyboardmarkup menyu misoli."
#: main.py:203
msgid "Seems you confused language"
msgstr "Tilni adashtirdiz"

View File

@ -0,0 +1,214 @@
"""
In this example you will learn how to adapt your bot to different languages
Using built-in middleware I18N.
You need to install babel package 'https://pypi.org/project/Babel/'
Babel provides a command-line interface for working with message catalogs
After installing babel package you have a script called 'pybabel'
Too see all the commands open terminal and type 'pybabel --help'
Full description for pybabel commands can be found here: 'https://babel.pocoo.org/en/latest/cmdline.html'
Create a directory 'locales' where our translations will be stored
First we need to extract texts:
pybabel extract -o locales/{domain_name}.pot --input-dirs .
{domain_name}.pot - is the file where all translations are saved
The name of this file should be the same as domain which you pass to I18N class
In this example domain_name will be 'messages'
For gettext (singular texts) we use '_' alias and it works perfect
You may also you some alias for ngettext (plural texts) but you can face with a problem that
your plural texts are not being extracted
That is because by default 'pybabel extract' recognizes the following keywords:
_, gettext, ngettext, ugettext, ungettext, dgettext, dngettext, N_
To add your own keyword you can use '-k' flag
In this example for 'ngettext' i will assign double underscore alias '__'
Full command with pluralization support will look so:
pybabel extract -o locales/{domain_name}.pot -k __:1,2 --input-dirs .
Then create directories with translations (get list of all locales: 'pybabel --list-locales'):
pybabel init -i locales/{domain_name}.pot -d locales -l en
pybabel init -i locales/{domain_name}.pot -d locales -l ru
pybabel init -i locales/{domain_name}.pot -d locales -l uz_Latn
Now you can translate the texts located in locales/{language}/LC_MESSAGES/{domain_name}.po
After you translated all the texts you need to compile .po files:
pybabel compile -d locales
When you delete/update your texts you also need to update them in .po files:
pybabel extract -o locales/{domain_name}.pot -k __:1,2 --input-dirs .
pybabel update -i locales/{domain_name}.pot -d locales
- translate
pybabel compile -d locales
If you have any exceptions check:
- you have installed babel
- translations are ready, so you just compiled it
- in the commands above you replaced {domain_name} to messages
- you are writing commands from correct path in terminal
"""
import asyncio
from typing import Union
import keyboards
from telebot import types
from telebot.async_telebot import AsyncTeleBot
from telebot.asyncio_filters import TextMatchFilter, TextFilter
from i18n_base_middleware import I18N
from telebot.asyncio_storage.memory_storage import StateMemoryStorage
class I18NMiddleware(I18N):
def process_update_types(self) -> list:
"""
Here you need to return a list of update types which you want to be processed
"""
return ['message', 'callback_query']
async def get_user_language(self, obj: Union[types.Message, types.CallbackQuery]):
"""
This method is called when new update comes (only updates which you return in 'process_update_types' method)
Returned language will be used in 'pre_process' method of parent class
Returned language will be set to context language variable.
If you need to get translation with user's actual language you don't have to pass it manually
It will be automatically passed from context language value.
However if you need some other language you can always pass it.
"""
user_id = obj.from_user.id
if user_id not in users_lang:
users_lang[user_id] = 'en'
return users_lang[user_id]
storage = StateMemoryStorage()
bot = AsyncTeleBot("", state_storage=storage)
i18n = I18NMiddleware(translations_path='locales', domain_name='messages')
_ = i18n.gettext # for singular translations
__ = i18n.ngettext # for plural translations
# These are example storages, do not use it in a production development
users_lang = {}
users_clicks = {}
@bot.message_handler(commands='start')
async def start_handler(message: types.Message):
text = _("Hello, {user_fist_name}!\n"
"This is the example of multilanguage bot.\n"
"Available commands:\n\n"
"/lang - change your language\n"
"/plural - pluralization example\n"
"/menu - text menu example")
# remember don't use f string for interpolation, use .format method instead
text = text.format(user_fist_name=message.from_user.first_name)
await bot.send_message(message.from_user.id, text)
@bot.message_handler(commands='lang')
async def change_language_handler(message: types.Message):
await bot.send_message(message.chat.id, "Choose language\nВыберите язык\nTilni tanlang",
reply_markup=keyboards.languages_keyboard())
@bot.callback_query_handler(func=None, text=TextFilter(contains=['en', 'ru', 'uz_Latn']))
async def language_handler(call: types.CallbackQuery):
lang = call.data
users_lang[call.from_user.id] = lang
# When you changed user language, you have to pass it manually beacause it is not changed in context
await bot.edit_message_text(_("Language has been changed", lang=lang), call.from_user.id, call.message.id)
@bot.message_handler(commands='plural')
async def pluralization_handler(message: types.Message):
if not users_clicks.get(message.from_user.id):
users_clicks[message.from_user.id] = 0
clicks = users_clicks[message.from_user.id]
text = __(
singular="You have {number} click",
plural="You have {number} clicks",
n=clicks
)
text = _("This is clicker.\n\n") + text.format(number=clicks)
await bot.send_message(message.chat.id, text, reply_markup=keyboards.clicker_keyboard(_))
@bot.callback_query_handler(func=None, text=TextFilter(equals='click'))
async def click_handler(call: types.CallbackQuery):
if not users_clicks.get(call.from_user.id):
users_clicks[call.from_user.id] = 1
else:
users_clicks[call.from_user.id] += 1
clicks = users_clicks[call.from_user.id]
text = __(
singular="You have {number} click",
plural="You have {number} clicks",
n=clicks
)
text = _("This is clicker.\n\n") + text.format(number=clicks)
await bot.edit_message_text(text, call.from_user.id, call.message.message_id,
reply_markup=keyboards.clicker_keyboard(_))
@bot.message_handler(commands='menu')
async def menu_handler(message: types.Message):
text = _("This is ReplyKeyboardMarkup menu example in multilanguage bot.")
await bot.send_message(message.chat.id, text, reply_markup=keyboards.menu_keyboard(_))
# For lazy tranlations
# lazy gettext is used when you don't know user's locale
# It can be used for example to handle text buttons in multilanguage bot
# The actual translation will be delayed until update comes and context language is set
l_ = i18n.lazy_gettext
# Handlers below will handle text according to user's language
@bot.message_handler(text=l_("My user id"))
async def return_user_id(message: types.Message):
await bot.send_message(message.chat.id, str(message.from_user.id))
@bot.message_handler(text=l_("My user name"))
async def return_user_id(message: types.Message):
username = message.from_user.username
if not username:
username = '-'
await bot.send_message(message.chat.id, username)
# You can make it case insensitive
@bot.message_handler(text=TextFilter(equals=l_("My first name"), ignore_case=True))
async def return_user_id(message: types.Message):
await bot.send_message(message.chat.id, message.from_user.first_name)
all_menu_texts = []
for language in i18n.available_translations:
for menu_text in ("My user id", "My user name", "My first name"):
all_menu_texts.append(_(menu_text, language))
# When user confused language. (handles all menu buttons texts)
@bot.message_handler(text=TextFilter(contains=all_menu_texts, ignore_case=True))
async def missed_message(message: types.Message):
await bot.send_message(message.chat.id, _("Seems you confused language"), reply_markup=keyboards.menu_keyboard(_))
if __name__ == '__main__':
bot.setup_middleware(i18n)
bot.add_custom_filter(TextMatchFilter())
asyncio.run(bot.infinity_polling())

View File

@ -0,0 +1,17 @@
You probably have seen bots which allow you to send them token of your bot and then handle updates providing some functionality for your bot.
<br>
This type of bots are called <b>multibots</b>. They are created using webhooks.
<br>
This is the example of simple multibot.<br>
In order to reproduce this example you need to have <b>domain and ssl connection</b>.
<br>
If you have, go to config.py and specify your data.
<br>
There is also file called <b>nginx_conf.conf</b>, we will use nginx as proxy-server and this file is example nginx.conf file.
<br>
Make sure that server_name and port are the same in both config and nginx_conf
<br>
(nginx_conf.conf IS NOT complete, you would probably use tools like certbot to add ssl connection to it)
<br>
Also, in this example I used dictionary as tokens storage, but in production you should use database so that you can re-set webhooks in case bot restarts.

View File

@ -0,0 +1,6 @@
MAIN_BOT_TOKEN = "your_main_bot_token"
WEBHOOK_HOST = "your_domain.com"
WEBHOOK_PATH = "telegram_webhook"
WEBAPP_HOST = "0.0.0.0"
WEBAPP_PORT = 3500

View File

@ -0,0 +1,15 @@
from telebot.async_telebot import AsyncTeleBot
from telebot import types
async def hello_handler(message: types.Message, bot: AsyncTeleBot):
await bot.send_message(message.chat.id, "Hi :)")
async def echo_handler(message: types.Message, bot: AsyncTeleBot):
await bot.send_message(message.chat.id, message.text)
def register_handlers(bot: AsyncTeleBot):
bot.register_message_handler(hello_handler, func=lambda message: message.text == 'Hello', pass_bot=True)
bot.register_message_handler(echo_handler, pass_bot=True)

View File

@ -0,0 +1,56 @@
import asyncio
from aiohttp import web
from telebot import types, util
from telebot.async_telebot import AsyncTeleBot
from handlers import register_handlers
import config
main_bot = AsyncTeleBot(config.MAIN_BOT_TOKEN)
app = web.Application()
tokens = {config.MAIN_BOT_TOKEN: True}
async def webhook(request):
token = request.match_info.get('token')
if not tokens.get(token):
return web.Response(status=404)
if request.headers.get('content-type') != 'application/json':
return web.Response(status=403)
json_string = await request.json()
update = types.Update.de_json(json_string)
if token == main_bot.token:
await main_bot.process_new_updates([update])
return web.Response()
from_update_bot = AsyncTeleBot(token)
register_handlers(from_update_bot)
await from_update_bot.process_new_updates([update])
return web.Response()
app.router.add_post("/" + config.WEBHOOK_PATH + "/{token}", webhook)
@main_bot.message_handler(commands=['add_bot'])
async def add_bot(message: types.Message):
token = util.extract_arguments(message.text)
tokens[token] = True
new_bot = AsyncTeleBot(token)
await new_bot.delete_webhook()
await new_bot.set_webhook(f"{config.WEBHOOK_HOST}/{config.WEBHOOK_PATH}/{token}")
await new_bot.send_message(message.chat.id, "Webhook was set.")
async def main():
await main_bot.delete_webhook()
await main_bot.set_webhook(f"{config.WEBHOOK_HOST}/{config.WEBHOOK_PATH}/{config.MAIN_BOT_TOKEN}")
web.run_app(app, host=config.WEBAPP_HOST, port=config.WEBAPP_PORT)
if __name__ == '__main__':
asyncio.run(main())

View File

@ -0,0 +1,8 @@
server {
server_name your_domain.com;
location /telegram_webhook/ {
proxy_pass http://localhost:3500;
}
}

View File

@ -0,0 +1,20 @@
from telebot.async_telebot import AsyncTeleBot
bot = AsyncTeleBot('TOKEN')
async def start_executor(message):
await bot.send_message(message.chat.id, 'Hello!')
bot.register_message_handler(start_executor, commands=['start']) # Start command executor
# See also
# bot.register_callback_query_handler(*args, **kwargs)
# bot.register_channel_post_handler(*args, **kwargs)
# bot.register_chat_member_handler(*args, **kwargs)
# bot.register_inline_handler(*args, **kwargs)
# bot.register_my_chat_member_handler(*args, **kwargs)
# bot.register_edited_message_handler(*args, **kwargs)
# And other functions..
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,29 @@
import telebot
from telebot.async_telebot import AsyncTeleBot
bot = AsyncTeleBot('TOKEN')
@bot.message_handler(commands=['photo'])
async def photo_send(message: telebot.types.Message):
with open('test.png', 'rb') as new_file:
await bot.send_photo(message.chat.id, new_file)
@bot.message_handler(commands=['document'])
async def document_send(message: telebot.types.Message):
with open('test.docx', 'rb') as new_file:
await bot.send_document(message.chat.id, new_file)
@bot.message_handler(commands=['photos'])
async def photos_send(message: telebot.types.Message):
with open('test.png', 'rb') as new_file, open('test2.png', 'rb') as new_file2:
await bot.send_media_group(message.chat.id, [telebot.types.InputMediaPhoto(new_file), telebot.types.InputMediaPhoto(new_file2)])
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,35 @@
#!/usr/bin/python
# This is a set_my_commands example.
# Press on [/] button in telegram client.
# Important, to update the command menu, be sure to exit the chat with the bot and log in again
# Important, command for chat_id and for group have a higher priority than for all
import asyncio
import telebot
from telebot.async_telebot import AsyncTeleBot
API_TOKEN = '<api_token>'
bot = AsyncTeleBot(API_TOKEN)
async def main():
# use in for delete with the necessary scope and language_code if necessary
await bot.delete_my_commands(scope=None, language_code=None)
await bot.set_my_commands(
commands=[
telebot.types.BotCommand("command1", "command1 description"),
telebot.types.BotCommand("command2", "command2 description")
],
# scope=telebot.types.BotCommandScopeChat(12345678) # use for personal command menu for users
# scope=telebot.types.BotCommandScopeAllPrivateChats() # use for all private chats
)
cmd = await bot.get_my_commands(scope=None, language_code=None)
print([c.to_json() for c in cmd])
if __name__ == '__main__':
asyncio.run(main())

View File

@ -0,0 +1,15 @@
from telebot.async_telebot import AsyncTeleBot
bot = AsyncTeleBot('TOKEN')
@bot.message_handler(commands=['start', 'help'])
async def send_welcome(message):
await bot.reply_to(message, "Howdy, how are you doing?")
@bot.message_handler(func=lambda message: True)
async def echo_all(message):
await bot.reply_to(message, message.text)
import asyncio
asyncio.run(bot.polling(skip_pending=True)) # to skip updates

View File

@ -0,0 +1,52 @@
#!/usr/bin/python3
# This is a simple bot with schedule timer
# https://github.com/ibrb/python-aioschedule
# https://schedule.readthedocs.io
import asyncio
import aioschedule
from telebot.async_telebot import AsyncTeleBot
API_TOKEN = '<api_token>'
bot = AsyncTeleBot(API_TOKEN)
async def beep(chat_id) -> None:
"""Send the beep message."""
await bot.send_message(chat_id, text='Beep!')
aioschedule.clear(chat_id) # return schedule.CancelJob not working in aioschedule use tag for delete
@bot.message_handler(commands=['help', 'start'])
async def send_welcome(message):
await bot.reply_to(message, "Hi! Use /set <seconds> to set a timer")
@bot.message_handler(commands=['set'])
async def set_timer(message):
args = message.text.split()
if len(args) > 1 and args[1].isdigit():
sec = int(args[1])
aioschedule.every(sec).seconds.do(beep, message.chat.id).tag(message.chat.id)
else:
await bot.reply_to(message, 'Usage: /set <seconds>')
@bot.message_handler(commands=['unset'])
def unset_timer(message):
aioschedule.clean(message.chat.id)
async def scheduler():
while True:
await aioschedule.run_pending()
await asyncio.sleep(1)
async def main():
await asyncio.gather(bot.infinity_polling(), scheduler())
if __name__ == '__main__':
asyncio.run(main())

View File

@ -0,0 +1,16 @@
from telebot.async_telebot import AsyncTeleBot
# Update listeners are functions that are called when any update is received.
bot = AsyncTeleBot(token='TOKEN')
async def update_listener(messages):
for message in messages:
if message.text == '/start':
await bot.send_message(message.chat.id, 'Hello!')
bot.set_update_listener(update_listener)
import asyncio
asyncio.run(bot.polling())

View File

@ -0,0 +1,93 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This is an async echo bot using decorators and webhook with aiohttp
# It echoes any incoming text messages and does not use the polling method.
import logging
import ssl
import asyncio
from aiohttp import web
import telebot
from telebot.async_telebot import AsyncTeleBot
API_TOKEN = '<api_token>'
WEBHOOK_HOST = '<ip/host where the bot is running>'
WEBHOOK_PORT = 8443 # 443, 80, 88 or 8443 (port need to be 'open')
WEBHOOK_LISTEN = '0.0.0.0' # In some VPS you may need to put here the IP addr
WEBHOOK_SSL_CERT = './webhook_cert.pem' # Path to the ssl certificate
WEBHOOK_SSL_PRIV = './webhook_pkey.pem' # Path to the ssl private key
WEBHOOK_URL_BASE = "https://{}:{}".format(WEBHOOK_HOST, WEBHOOK_PORT)
WEBHOOK_URL_PATH = "/{}/".format(API_TOKEN)
# Quick'n'dirty SSL certificate generation:
#
# openssl genrsa -out webhook_pkey.pem 2048
# openssl req -new -x509 -days 3650 -key webhook_pkey.pem -out webhook_cert.pem
#
# When asked for "Common Name (e.g. server FQDN or YOUR name)" you should reply
# with the same value in you put in WEBHOOK_HOST
logger = telebot.logger
telebot.logger.setLevel(logging.INFO)
bot = AsyncTeleBot(API_TOKEN)
# Process webhook calls
async def handle(request):
if request.match_info.get('token') == bot.token:
request_body_dict = await request.json()
update = telebot.types.Update.de_json(request_body_dict)
asyncio.ensure_future(bot.process_new_updates([update]))
return web.Response()
else:
return web.Response(status=403)
# Handle '/start' and '/help'
@bot.message_handler(commands=['help', 'start'])
async def send_welcome(message):
await bot.reply_to(message,
("Hi there, I am EchoBot.\n"
"I am here to echo your kind words back to you."))
# Handle all other messages
@bot.message_handler(func=lambda message: True, content_types=['text'])
async def echo_message(message):
await bot.reply_to(message, message.text)
# Remove webhook and closing session before exiting
async def shutdown(app):
logger.info('Shutting down: removing webhook')
await bot.remove_webhook()
logger.info('Shutting down: closing session')
await bot.close_session()
async def setup():
# Remove webhook, it fails sometimes the set if there is a previous webhook
logger.info('Starting up: removing old webhook')
await bot.remove_webhook()
# Set webhook
logger.info('Starting up: setting webhook')
await bot.set_webhook(url=WEBHOOK_URL_BASE + WEBHOOK_URL_PATH,
certificate=open(WEBHOOK_SSL_CERT, 'r'))
app = web.Application()
app.router.add_post('/{token}/', handle)
app.on_cleanup.append(shutdown)
return app
if __name__ == '__main__':
# Build ssl context
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
context.load_cert_chain(WEBHOOK_SSL_CERT, WEBHOOK_SSL_PRIV)
# Start aiohttp server
web.run_app(
setup(),
host=WEBHOOK_LISTEN,
port=WEBHOOK_PORT,
ssl_context=context,
)

View File

@ -0,0 +1,45 @@
#!/usr/bin/python
# This is a simple echo bot using the decorator mechanism.
# It echoes any incoming text messages.
# Example on built-in function to receive and process webhooks.
from telebot.async_telebot import AsyncTeleBot
import asyncio
bot = AsyncTeleBot('TOKEN')
WEBHOOK_SSL_CERT = './webhook_cert.pem' # Path to the ssl certificate
WEBHOOK_SSL_PRIV = './webhook_pkey.pem' # Path to the ssl private key
DOMAIN = '1.2.3.4' # either domain, or ip address of vps
# Quick'n'dirty SSL certificate generation:
#
# openssl genrsa -out webhook_pkey.pem 2048
# openssl req -new -x509 -days 3650 -key webhook_pkey.pem -out webhook_cert.pem
#
# When asked for "Common Name (e.g. server FQDN or YOUR name)" you should reply
# with the same value in you put in WEBHOOK_HOST
# Handle '/start' and '/help'
@bot.message_handler(commands=['help', 'start'])
async def send_welcome(message):
await bot.reply_to(message, """\
Hi there, I am EchoBot.
I am here to echo your kind words back to you. Just say anything nice and I'll say the exact same thing to you!\
""")
# Handle all other messages with content_type 'text' (content_types defaults to ['text'])
@bot.message_handler(func=lambda message: True)
async def echo_message(message):
await bot.reply_to(message, message.text)
# it uses fastapi + uvicorn
asyncio.run(bot.run_webhooks(
listen=DOMAIN,
certificate=WEBHOOK_SSL_CERT,
certificate_key=WEBHOOK_SSL_PRIV
))

View File

@ -0,0 +1,89 @@
#!/usr/bin/env python
"""
Asynchronous Telegram Echo Bot example.
This is a simple bot that echoes each message that is received onto the chat.
It uses the Starlette ASGI framework to receive updates via webhook requests.
"""
import uvicorn
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import PlainTextResponse, Response
from starlette.routing import Route
from telebot.async_telebot import AsyncTeleBot
from telebot.types import Message, Update
API_TOKEN = "TOKEN"
WEBHOOK_HOST = "<ip/domain>"
WEBHOOK_PORT = 8443 # 443, 80, 88 or 8443 (port need to be 'open')
WEBHOOK_LISTEN = "0.0.0.0"
WEBHOOK_SSL_CERT = "./webhook_cert.pem" # Path to the ssl certificate
WEBHOOK_SSL_PRIV = "./webhook_pkey.pem" # Path to the ssl private key
WEBHOOK_URL = f"https://{WEBHOOK_HOST}:{WEBHOOK_PORT}/telegram"
WEBHOOK_SECRET_TOKEN = "SECRET_TOKEN"
logger = telebot.logger
telebot.logger.setLevel(logging.INFO)
bot = AsyncTeleBot(token=API_TOKEN)
# BOT HANDLERS
@bot.message_handler(commands=["help", "start"])
async def send_welcome(message: Message):
"""
Handle '/start' and '/help'
"""
await bot.reply_to(
message,
("Hi there, I am EchoBot.\n" "I am here to echo your kind words back to you."),
)
@bot.message_handler(func=lambda _: True, content_types=["text"])
async def echo_message(message: Message):
"""
Handle all other messages
"""
await bot.reply_to(message, message.text)
# WEBSERVER HANDLERS
async def telegram(request: Request) -> Response:
"""Handle incoming Telegram updates."""
token_header_name = "X-Telegram-Bot-Api-Secret-Token"
if request.headers.get(token_header_name) != WEBHOOK_SECRET_TOKEN:
return PlainTextResponse("Forbidden", status_code=403)
await bot.process_new_updates([Update.de_json(await request.json())])
return Response()
async def startup() -> None:
"""Register webhook for telegram updates."""
webhook_info = await bot.get_webhook_info(30)
if WEBHOOK_URL != webhook_info.url:
logger.debug(
f"updating webhook url, old: {webhook_info.url}, new: {WEBHOOK_URL}"
)
if not await bot.set_webhook(
url=WEBHOOK_URL, secret_token=WEBHOOK_SECRET_TOKEN
):
raise RuntimeError("unable to set webhook")
app = Starlette(
routes=[
Route("/telegram", telegram, methods=["POST"]),
],
on_startup=[startup],
)
uvicorn.run(
app,
host=WEBHOOK_HOST,
port=WEBHOOK_LISTEN,
ssl_certfile=WEBHOOK_SSL_CERT,
ssl_keyfile=WEBHOOK_SSL_PRIV,
)

View File

@ -0,0 +1,25 @@
import telebot
from telebot import types, AdvancedCustomFilter
from telebot.callback_data import CallbackData, CallbackDataFilter
calendar_factory = CallbackData("year", "month", prefix="calendar")
calendar_zoom = CallbackData("year", prefix="calendar_zoom")
class CalendarCallbackFilter(AdvancedCustomFilter):
key = 'calendar_config'
def check(self, call: types.CallbackQuery, config: CallbackDataFilter):
return config.check(query=call)
class CalendarZoomCallbackFilter(AdvancedCustomFilter):
key = 'calendar_zoom_config'
def check(self, call: types.CallbackQuery, config: CallbackDataFilter):
return config.check(query=call)
def bind_filters(bot: telebot.TeleBot):
bot.add_custom_filter(CalendarCallbackFilter())
bot.add_custom_filter(CalendarZoomCallbackFilter())

View File

@ -0,0 +1,92 @@
import calendar
from datetime import date, timedelta
from examples.callback_data_examples.advanced_calendar_example.filters import calendar_factory, calendar_zoom
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
EMTPY_FIELD = '1'
WEEK_DAYS = [calendar.day_abbr[i] for i in range(7)]
MONTHS = [(i, calendar.month_name[i]) for i in range(1, 13)]
def generate_calendar_days(year: int, month: int):
keyboard = InlineKeyboardMarkup(row_width=7)
today = date.today()
keyboard.add(
InlineKeyboardButton(
text=date(year=year, month=month, day=1).strftime('%b %Y'),
callback_data=EMTPY_FIELD
)
)
keyboard.add(*[
InlineKeyboardButton(
text=day,
callback_data=EMTPY_FIELD
)
for day in WEEK_DAYS
])
for week in calendar.Calendar().monthdayscalendar(year=year, month=month):
week_buttons = []
for day in week:
day_name = ' '
if day == today.day and today.year == year and today.month == month:
day_name = '🔘'
elif day != 0:
day_name = str(day)
week_buttons.append(
InlineKeyboardButton(
text=day_name,
callback_data=EMTPY_FIELD
)
)
keyboard.add(*week_buttons)
previous_date = date(year=year, month=month, day=1) - timedelta(days=1)
next_date = date(year=year, month=month, day=1) + timedelta(days=31)
keyboard.add(
InlineKeyboardButton(
text='Previous month',
callback_data=calendar_factory.new(year=previous_date.year, month=previous_date.month)
),
InlineKeyboardButton(
text='Zoom out',
callback_data=calendar_zoom.new(year=year)
),
InlineKeyboardButton(
text='Next month',
callback_data=calendar_factory.new(year=next_date.year, month=next_date.month)
),
)
return keyboard
def generate_calendar_months(year: int):
keyboard = InlineKeyboardMarkup(row_width=3)
keyboard.add(
InlineKeyboardButton(
text=date(year=year, month=1, day=1).strftime('Year %Y'),
callback_data=EMTPY_FIELD
)
)
keyboard.add(*[
InlineKeyboardButton(
text=month,
callback_data=calendar_factory.new(year=year, month=month_number)
)
for month_number, month in MONTHS
])
keyboard.add(
InlineKeyboardButton(
text='Previous year',
callback_data=calendar_zoom.new(year=year - 1)
),
InlineKeyboardButton(
text='Next year',
callback_data=calendar_zoom.new(year=year + 1)
)
)
return keyboard

View File

@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
"""
This Example will show you an advanced usage of CallbackData.
In this example calendar was implemented
"""
from datetime import date
from examples.callback_data_examples.advanced_calendar_example.keyboards import generate_calendar_days, \
generate_calendar_months, EMTPY_FIELD
from filters import calendar_factory, calendar_zoom, bind_filters
from telebot import types, TeleBot
API_TOKEN = ''
bot = TeleBot(API_TOKEN)
@bot.message_handler(commands='start')
def start_command_handler(message: types.Message):
bot.send_message(message.chat.id,
f"Hello {message.from_user.first_name}. This bot is an example of calendar keyboard."
"\nPress /calendar to see it.")
@bot.message_handler(commands='calendar')
def calendar_command_handler(message: types.Message):
now = date.today()
bot.send_message(message.chat.id, 'Calendar', reply_markup=generate_calendar_days(year=now.year, month=now.month))
@bot.callback_query_handler(func=None, calendar_config=calendar_factory.filter())
def calendar_action_handler(call: types.CallbackQuery):
callback_data: dict = calendar_factory.parse(callback_data=call.data)
year, month = int(callback_data['year']), int(callback_data['month'])
bot.edit_message_reply_markup(call.message.chat.id, call.message.id,
reply_markup=generate_calendar_days(year=year, month=month))
@bot.callback_query_handler(func=None, calendar_zoom_config=calendar_zoom.filter())
def calendar_zoom_out_handler(call: types.CallbackQuery):
callback_data: dict = calendar_zoom.parse(callback_data=call.data)
year = int(callback_data.get('year'))
bot.edit_message_reply_markup(call.message.chat.id, call.message.id,
reply_markup=generate_calendar_months(year=year))
@bot.callback_query_handler(func=lambda call: call.data == EMTPY_FIELD)
def callback_empty_field_handler(call: types.CallbackQuery):
bot.answer_callback_query(call.id)
if __name__ == '__main__':
bind_filters(bot)
bot.infinity_polling()

View File

@ -0,0 +1,86 @@
# -*- coding: utf-8 -*-
"""
This Example will show you how to use CallbackData
"""
from telebot.callback_data import CallbackData, CallbackDataFilter
from telebot import types, TeleBot
from telebot.custom_filters import AdvancedCustomFilter
API_TOKEN = ''
PRODUCTS = [
{'id': '0', 'name': 'xiaomi mi 10', 'price': 400},
{'id': '1', 'name': 'samsung s20', 'price': 800},
{'id': '2', 'name': 'iphone 13', 'price': 1300}
]
bot = TeleBot(API_TOKEN)
products_factory = CallbackData('product_id', prefix='products')
def products_keyboard():
return types.InlineKeyboardMarkup(
keyboard=[
[
types.InlineKeyboardButton(
text=product['name'],
callback_data=products_factory.new(product_id=product["id"])
)
]
for product in PRODUCTS
]
)
def back_keyboard():
return types.InlineKeyboardMarkup(
keyboard=[
[
types.InlineKeyboardButton(
text='',
callback_data='back'
)
]
]
)
class ProductsCallbackFilter(AdvancedCustomFilter):
key = 'config'
def check(self, call: types.CallbackQuery, config: CallbackDataFilter):
return config.check(query=call)
@bot.message_handler(commands=['products'])
def products_command_handler(message: types.Message):
bot.send_message(message.chat.id, 'Products:', reply_markup=products_keyboard())
# Only product with field - product_id = 2
@bot.callback_query_handler(func=None, config=products_factory.filter(product_id='2'))
def product_one_callback(call: types.CallbackQuery):
bot.answer_callback_query(callback_query_id=call.id, text='Not available :(', show_alert=True)
# Any other products
@bot.callback_query_handler(func=None, config=products_factory.filter())
def products_callback(call: types.CallbackQuery):
callback_data: dict = products_factory.parse(callback_data=call.data)
product_id = int(callback_data['product_id'])
product = PRODUCTS[product_id]
text = f"Product name: {product['name']}\n" \
f"Product price: {product['price']}"
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id,
text=text, reply_markup=back_keyboard())
@bot.callback_query_handler(func=lambda c: c.data == 'back')
def back_callback(call: types.CallbackQuery):
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id,
text='Products:', reply_markup=products_keyboard())
bot.add_custom_filter(ProductsCallbackFilter())
bot.infinity_polling()

View File

@ -0,0 +1,11 @@
import telebot
bot = telebot.TeleBot('TOKEN')
@bot.chat_join_request_handler()
def make_some(message: telebot.types.ChatJoinRequest):
bot.send_message(message.chat.id, 'I accepted a new user!')
bot.approve_chat_join_request(message.chat.id, message.from_user.id)
bot.infinity_polling(allowed_updates=telebot.util.update_types)

View File

@ -0,0 +1,33 @@
import telebot
from telebot import types,util
bot = telebot.TeleBot("token")
#chat_member_handler. When status changes, telegram gives update. check status from old_chat_member and new_chat_member.
@bot.chat_member_handler()
def chat_m(message: types.ChatMemberUpdated):
old = message.old_chat_member
new = message.new_chat_member
if new.status == "member":
bot.send_message(message.chat.id,"Hello {name}!".format(name=new.user.first_name)) # Welcome message
#if bot is added to group, this handler will work
@bot.my_chat_member_handler()
def my_chat_m(message: types.ChatMemberUpdated):
old = message.old_chat_member
new = message.new_chat_member
if new.status == "member":
bot.send_message(message.chat.id,"Somebody added me to group") # Welcome message, if bot was added to group
bot.leave_chat(message.chat.id)
#content_Type_service is:
#'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'
# this handler deletes service messages
@bot.message_handler(content_types=util.content_type_service)
def delall(message: types.Message):
bot.delete_message(message.chat.id,message.message_id)
bot.infinity_polling(allowed_updates=util.update_types)

View File

@ -0,0 +1,23 @@
from telebot import TeleBot
from telebot.handler_backends import ContinueHandling
bot = TeleBot('TOKEN')
@bot.message_handler(commands=['start'])
def start(message):
bot.send_message(message.chat.id, 'Hello World!')
return ContinueHandling()
@bot.message_handler(commands=['start'])
def start2(message):
"""
This handler comes after the first one, but it will never be called.
But you can call it by returning ContinueHandling() in the first handler.
If you return ContinueHandling() in the first handler, the next
registered handler with appropriate filters will be called.
"""
bot.send_message(message.chat.id, 'Hello World2!')
bot.infinity_polling()

View File

@ -0,0 +1,33 @@
import telebot
from time import sleep, time
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton #Only for creating Inline Buttons, not necessary for creating Invite Links
Token = "api_token" #Your Bot Access Token
Group_ID = -1234567890 #Group ID for which invite link is to be created
bot = telebot.TeleBot(Token, parse_mode="HTML")
#/start command message
@bot.message_handler(commands=['start'])
def startmsg(msg):
bot.reply_to(msg, "Hey there, I'm a bot made by pyTelegramBotAPI!")
#Get notified of incoming members in group
@bot.message_handler(content_types=['new_chat_members'])
def newmember(msg):
#Create an invite link class that contains info about the created invite link using create_chat_invite_link() with parameters
invite = bot.create_chat_invite_link(Group_ID, member_limit=1, expire_date=int(time())+45) #Here, the link will auto-expire in 45 seconds
InviteLink = invite.invite_link #Get the actual invite link from 'invite' class
mrkplink = InlineKeyboardMarkup() #Created Inline Keyboard Markup
mrkplink.add(InlineKeyboardButton("Join our group 🚀", url=InviteLink)) #Added Invite Link to Inline Keyboard
bot.send_message(msg.chat.id, f"Hey there {msg.from_user.first_name}, Click the link below to join our Official Group.", reply_markup=mrkplink)
#This will send a message with the newly-created invite link as markup button.
#The member limit will be 1 and expiring time will be 45 sec.
bot.infinity_polling()

View File

@ -0,0 +1,12 @@
import telebot
from telebot import custom_filters
bot = telebot.TeleBot('TOKEN')
# Handler
@bot.message_handler(chat_types=['supergroup'], is_chat_admin=True)
def answer_for_admin(message):
bot.send_message(message.chat.id,"hello my admin")
# Register filter
bot.add_custom_filter(custom_filters.IsAdminFilter(bot))
bot.infinity_polling()

View File

@ -0,0 +1,125 @@
# -*- coding: utf-8 -*-
"""
This Example will show you usage of TextFilter
In this example you will see how to use TextFilter
with (message_handler, callback_query_handler, poll_handler)
"""
from telebot import TeleBot, types
from telebot.custom_filters import TextFilter, TextMatchFilter, IsReplyFilter
bot = TeleBot("")
@bot.message_handler(text=TextFilter(equals='hello'))
def hello_handler(message: types.Message):
bot.send_message(message.chat.id, message.text)
@bot.message_handler(text=TextFilter(equals='hello', ignore_case=True))
def hello_handler_ignore_case(message: types.Message):
bot.send_message(message.chat.id, message.text + ' ignore case')
@bot.message_handler(text=TextFilter(contains=['good', 'bad']))
def contains_handler(message: types.Message):
bot.send_message(message.chat.id, message.text)
@bot.message_handler(text=TextFilter(contains=['good', 'bad'], ignore_case=True))
def contains_handler_ignore_case(message: types.Message):
bot.send_message(message.chat.id, message.text + ' ignore case')
@bot.message_handler(text=TextFilter(starts_with='st')) # stArk, steve, stONE
def starts_with_handler(message: types.Message):
bot.send_message(message.chat.id, message.text)
@bot.message_handler(text=TextFilter(starts_with='st', ignore_case=True)) # STark, sTeve, stONE
def starts_with_handler_ignore_case(message: types.Message):
bot.send_message(message.chat.id, message.text + ' ignore case')
@bot.message_handler(text=TextFilter(ends_with='ay')) # wednesday, SUNday, WeekDay
def ends_with_handler(message: types.Message):
bot.send_message(message.chat.id, message.text)
@bot.message_handler(text=TextFilter(ends_with='ay', ignore_case=True)) # wednesdAY, sundAy, WeekdaY
def ends_with_handler_ignore_case(message: types.Message):
bot.send_message(message.chat.id, message.text + ' ignore case')
@bot.message_handler(text=TextFilter(equals='/callback'))
def send_callback(message: types.Message):
keyboard = types.InlineKeyboardMarkup(
keyboard=[
[types.InlineKeyboardButton(text='callback data', callback_data='example')],
[types.InlineKeyboardButton(text='ignore case callback data', callback_data='ExAmPLe')]
]
)
bot.send_message(message.chat.id, message.text, reply_markup=keyboard)
@bot.callback_query_handler(func=None, text=TextFilter(equals='example'))
def callback_query_handler(call: types.CallbackQuery):
bot.answer_callback_query(call.id, call.data, show_alert=True)
@bot.callback_query_handler(func=None, text=TextFilter(equals='example', ignore_case=True))
def callback_query_handler_ignore_case(call: types.CallbackQuery):
bot.answer_callback_query(call.id, call.data + " ignore case", show_alert=True)
@bot.message_handler(text=TextFilter(equals='/poll'))
def send_poll(message: types.Message):
bot.send_poll(message.chat.id, question='When do you prefer to work?', options=['Morning', 'Night'])
bot.send_poll(message.chat.id, question='WHEN DO you pRefeR to worK?', options=['Morning', 'Night'])
@bot.poll_handler(func=None, text=TextFilter(equals='When do you prefer to work?'))
def poll_question_handler(poll: types.Poll):
print(poll.question)
@bot.poll_handler(func=None, text=TextFilter(equals='When do you prefer to work?', ignore_case=True))
def poll_question_handler_ignore_case(poll: types.Poll):
print(poll.question + ' ignore case')
# either hi or contains one of (привет, salom)
@bot.message_handler(text=TextFilter(equals="hi", contains=('привет', 'salom'), ignore_case=True))
def multiple_patterns_handler(message: types.Message):
bot.send_message(message.chat.id, message.text)
# starts with one of (mi, mea) for ex. minor, milk, meal, meat
@bot.message_handler(text=TextFilter(starts_with=['mi', 'mea'], ignore_case=True))
def multiple_starts_with_handler(message: types.Message):
bot.send_message(message.chat.id, message.text)
# ends with one of (es, on) for ex. Jones, Davies, Johnson, Wilson
@bot.message_handler(text=TextFilter(ends_with=['es', 'on'], ignore_case=True))
def multiple_ends_with_handler(message: types.Message):
bot.send_message(message.chat.id, message.text)
# !ban /ban .ban !бан /бан .бан
@bot.message_handler(is_reply=True,
text=TextFilter(starts_with=('!', '/', '.'), ends_with=['ban', 'бан'], ignore_case=True))
def ban_command_handler(message: types.Message):
if len(message.text) == 4 and message.chat.type != 'private':
try:
bot.ban_chat_member(message.chat.id, message.reply_to_message.from_user.id)
bot.reply_to(message.reply_to_message, 'Banned.')
except Exception as err:
print(err.args)
return
if __name__ == '__main__':
bot.add_custom_filter(TextMatchFilter())
bot.add_custom_filter(IsReplyFilter())
bot.infinity_polling()

View File

@ -0,0 +1,42 @@
import telebot
bot = telebot.TeleBot('TOKEN')
# AdvancedCustomFilter is for list, string filter values
class MainFilter(telebot.custom_filters.AdvancedCustomFilter):
key='text'
@staticmethod
def check(message, text):
return message.text in text
# SimpleCustomFilter is for boolean values, such as is_admin=True
class IsAdmin(telebot.custom_filters.SimpleCustomFilter):
key='is_admin'
@staticmethod
def check(message: telebot.types.Message):
return bot.get_chat_member(message.chat.id,message.from_user.id).status in ['administrator','creator']
@bot.message_handler(is_admin=True, commands=['admin']) # Check if user is admin
def admin_rep(message):
bot.send_message(message.chat.id, "Hi admin")
@bot.message_handler(is_admin=False, commands=['admin']) # If user is not admin
def not_admin(message):
bot.send_message(message.chat.id, "You are not admin")
@bot.message_handler(text=['hi']) # Response to hi message
def welcome_hi(message):
bot.send_message(message.chat.id, 'You said hi')
@bot.message_handler(text=['bye']) # Response to bye message
def bye_user(message):
bot.send_message(message.chat.id, 'You said bye')
# Do not forget to register filters
bot.add_custom_filter(MainFilter())
bot.add_custom_filter(IsAdmin())
bot.infinity_polling(skip_pending=True) # Skip old updates

View File

@ -0,0 +1,19 @@
import telebot
from telebot import custom_filters
bot = telebot.TeleBot('token')
# Chat id can be private or supergroups.
@bot.message_handler(chat_id=[12345678], commands=['admin']) # chat_id checks id corresponds to your list or not.
def admin_rep(message):
bot.send_message(message.chat.id, "You are allowed to use this command.")
@bot.message_handler(commands=['admin'])
def not_admin(message):
bot.send_message(message.chat.id, "You are not allowed to use this command")
# Do not forget to register
bot.add_custom_filter(custom_filters.ChatFilter())
bot.infinity_polling()

View File

@ -0,0 +1,21 @@
import telebot
from telebot import custom_filters
bot = telebot.TeleBot('TOKEN')
# Check if message is a reply
@bot.message_handler(is_reply=True)
def start_filter(message):
bot.send_message(message.chat.id, "Looks like you replied to my message.")
# Check if message was forwarded
@bot.message_handler(is_forwarded=True)
def text_filter(message):
bot.send_message(message.chat.id, "I do not accept forwarded messages!")
# Do not forget to register filters
bot.add_custom_filter(custom_filters.IsReplyFilter())
bot.add_custom_filter(custom_filters.ForwardFilter())
bot.infinity_polling()

View File

@ -0,0 +1,21 @@
import telebot
from telebot import custom_filters
bot = telebot.TeleBot('TOKEN')
# Check if message starts with @admin tag
@bot.message_handler(text_startswith="@admin")
def start_filter(message):
bot.send_message(message.chat.id, "Looks like you are calling admin, wait...")
# Check if text is hi or hello
@bot.message_handler(text=['hi','hello'])
def text_filter(message):
bot.send_message(message.chat.id, "Hi, {name}!".format(name=message.from_user.first_name))
# Do not forget to register filters
bot.add_custom_filter(custom_filters.TextMatchFilter())
bot.add_custom_filter(custom_filters.TextStartsFilter())
bot.infinity_polling()

106
examples/custom_states.py Normal file
View File

@ -0,0 +1,106 @@
import telebot # telebot
from telebot import custom_filters
from telebot.handler_backends import State, StatesGroup #States
# States storage
from telebot.storage import StateMemoryStorage
# Starting from version 4.4.0+, we support storages.
# StateRedisStorage -> Redis-based storage.
# StatePickleStorage -> Pickle-based storage.
# For redis, you will need to install redis.
# Pass host, db, password, or anything else,
# if you need to change config for redis.
# Pickle requires path. Default path is in folder .state-saves.
# If you were using older version of pytba for pickle,
# you need to migrate from old pickle to new by using
# StatePickleStorage().convert_old_to_new()
# Now, you can pass storage to bot.
state_storage = StateMemoryStorage() # you can init here another storage
bot = telebot.TeleBot("TOKEN",
state_storage=state_storage)
# States group.
class MyStates(StatesGroup):
# Just name variables differently
name = State() # creating instances of State class is enough from now
surname = State()
age = State()
@bot.message_handler(commands=['start'])
def start_ex(message):
"""
Start command. Here we are starting state
"""
bot.set_state(message.from_user.id, MyStates.name, message.chat.id)
bot.send_message(message.chat.id, 'Hi, write me a name')
# Any state
@bot.message_handler(state="*", commands=['cancel'])
def any_state(message):
"""
Cancel state
"""
bot.send_message(message.chat.id, "Your state was cancelled.")
bot.delete_state(message.from_user.id, message.chat.id)
@bot.message_handler(state=MyStates.name)
def name_get(message):
"""
State 1. Will process when user's state is MyStates.name.
"""
bot.send_message(message.chat.id, 'Now write me a surname')
bot.set_state(message.from_user.id, MyStates.surname, message.chat.id)
with bot.retrieve_data(message.from_user.id, message.chat.id) as data:
data['name'] = message.text
@bot.message_handler(state=MyStates.surname)
def ask_age(message):
"""
State 2. Will process when user's state is MyStates.surname.
"""
bot.send_message(message.chat.id, "What is your age?")
bot.set_state(message.from_user.id, MyStates.age, message.chat.id)
with bot.retrieve_data(message.from_user.id, message.chat.id) as data:
data['surname'] = message.text
# result
@bot.message_handler(state=MyStates.age, is_digit=True)
def ready_for_answer(message):
"""
State 3. Will process when user's state is MyStates.age.
"""
with bot.retrieve_data(message.from_user.id, message.chat.id) as data:
msg = ("Ready, take a look:\n<b>"
f"Name: {data['name']}\n"
f"Surname: {data['surname']}\n"
f"Age: {message.text}</b>")
bot.send_message(message.chat.id, msg, parse_mode="html")
bot.delete_state(message.from_user.id, message.chat.id)
#incorrect number
@bot.message_handler(state=MyStates.age, is_digit=False)
def age_incorrect(message):
"""
Wrong response for MyStates.age
"""
bot.send_message(message.chat.id, 'Looks like you are submitting a string in the field age. Please enter a number')
# register filters
bot.add_custom_filter(custom_filters.StateFilter(bot))
bot.add_custom_filter(custom_filters.IsDigitFilter())
bot.infinity_polling(skip_pending=True)

View File

@ -74,4 +74,4 @@ def send_welcome(message):
bot.reply_to(message, reply)
bot.polling()
bot.infinity_polling()

View File

@ -130,4 +130,4 @@ def command_default(m):
bot.send_message(m.chat.id, "I don't understand \"" + m.text + "\"\nMaybe try the help page at /help")
bot.polling()
bot.infinity_polling()

View File

@ -0,0 +1,28 @@
#!/usr/bin/python
# This is a simple echo bot using the decorator mechanism.
# It echoes any incoming text messages.
import telebot
API_TOKEN = '<api_token>'
bot = telebot.TeleBot(API_TOKEN)
# Handle '/start' and '/help'
@bot.message_handler(commands=['help', 'start'])
def send_welcome(message):
bot.reply_to(message, """\
Hi there, I am EchoBot.
I am here to echo your kind words back to you. Just say anything nice and I'll say the exact same thing to you!\
""")
# Handle all other messages with content_type 'text' (content_types defaults to ['text'])
@bot.message_handler(func=lambda message: True)
def echo_message(message):
bot.reply_to(message, message.text)
# only for versions 4.7.0+
bot.infinity_polling(restart_on_change=True)

View File

@ -25,4 +25,4 @@ def echo_message(message):
bot.reply_to(message, message.text)
bot.polling()
bot.infinity_polling()

View File

@ -0,0 +1,53 @@
from telebot import TeleBot
from telebot import formatting
bot = TeleBot('TOKEN')
@bot.message_handler(commands=['start'])
def start_message(message):
bot.send_message(
message.chat.id,
# function which connects all strings
formatting.format_text(
formatting.mbold(message.from_user.first_name),
formatting.mitalic(message.from_user.first_name),
formatting.munderline(message.from_user.first_name),
formatting.mstrikethrough(message.from_user.first_name),
formatting.mcode(message.from_user.first_name),
separator=" " # separator separates all strings
),
parse_mode='MarkdownV2'
)
# just a bold text using markdownv2
bot.send_message(
message.chat.id,
formatting.mbold(message.from_user.first_name),
parse_mode='MarkdownV2'
)
# html
bot.send_message(
message.chat.id,
formatting.format_text(
formatting.hbold(message.from_user.first_name),
formatting.hitalic(message.from_user.first_name),
formatting.hunderline(message.from_user.first_name),
formatting.hstrikethrough(message.from_user.first_name),
formatting.hcode(message.from_user.first_name),
# hide_link is only for html
formatting.hide_link('https://telegra.ph/file/c158e3a6e2a26a160b253.jpg'),
separator=" "
),
parse_mode='HTML'
)
# just a bold text in html
bot.send_message(
message.chat.id,
formatting.hbold(message.from_user.first_name),
parse_mode='HTML'
)
bot.infinity_polling()

Some files were not shown because too many files have changed in this diff Show More