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

Updated documentation to another theme.

This commit is contained in:
coder2020official
2022-03-07 16:10:44 +05:00
parent c8fb83c97c
commit dd589e2490
7 changed files with 33 additions and 29 deletions

View File

@ -46,6 +46,8 @@ REPLY_MARKUP_TYPES = Union[
Module : telebot
"""
__version__ = '4.4.0'
class Handler:
"""
@ -916,8 +918,7 @@ class TeleBot:
Telegram documentation: https://core.telegram.org/bots/api#setchatstickerset
:param chat_id: Unique identifier for the target chat or username of the target supergroup
(in the format @supergroupusername)
:param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
:param sticker_set_name: Name of the sticker set to be set as the group sticker set
:return: API reply.
"""
@ -2913,17 +2914,19 @@ class TeleBot:
Example:
bot = TeleBot('TOKEN')
.. code-block:: python3
# Print post message text before entering to any post_channel handlers
@bot.middleware_handler(update_types=['channel_post', 'edited_channel_post'])
def print_channel_post_text(bot_instance, channel_post):
print(channel_post.text)
bot = TeleBot('TOKEN')
# Print update id before entering to any handlers
@bot.middleware_handler()
def print_channel_post_text(bot_instance, update):
print(update.update_id)
# Print post message text before entering to any post_channel handlers
@bot.middleware_handler(update_types=['channel_post', 'edited_channel_post'])
def print_channel_post_text(bot_instance, channel_post):
print(channel_post.text)
# Print update id before entering to any handlers
@bot.middleware_handler()
def print_channel_post_text(bot_instance, update):
print(update.update_id)
:param update_types: Optional list of update types that can be passed into the middleware handler.
"""
@ -2986,7 +2989,7 @@ class TeleBot:
All message handlers are tested in the order they were added.
Example:
.. code-block:: python
bot = TeleBot('TOKEN')

View File

@ -2344,17 +2344,14 @@ class AsyncTeleBot:
If user is restricted for more than 366 days or less than 30 seconds from the current time,
they are considered to be restricted forever
:param can_send_messages: Pass True, if the user can send text messages, contacts, locations and venues
:param can_send_media_messages Pass True, if the user can send audios, documents, photos, videos, video notes
and voice notes, implies can_send_messages
:param can_send_media_messages: Pass True, if the user can send audios, documents, photos, videos, video notes
and voice notes, implies can_send_messages
:param can_send_polls: Pass True, if the user is allowed to send polls, implies can_send_messages
:param can_send_other_messages: Pass True, if the user can send animations, games, stickers and
use inline bots, implies can_send_media_messages
:param can_add_web_page_previews: Pass True, if the user may add web page previews to their messages,
implies can_send_media_messages
:param can_change_info: Pass True, if the user is allowed to change the chat title, photo and other settings.
Ignored in public supergroups
:param can_invite_users: Pass True, if the user is allowed to invite new users to the chat,
implies can_invite_users
use inline bots, implies can_send_media_messages
:param can_add_web_page_previews: Pass True, if the user may add web page previews to their messages, implies can_send_media_messages
:param can_change_info: Pass True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups
:param can_invite_users: Pass True, if the user is allowed to invite new users to the chat, implies can_invite_users
:param can_pin_messages: Pass True, if the user is allowed to pin messages. Ignored in public supergroups
:return: True on success
"""

View File

@ -283,7 +283,7 @@ def split_string(text: str, chars_per_string: int) -> List[str]:
def smart_split(text: str, chars_per_string: int=MAX_MESSAGE_LENGTH) -> List[str]:
"""
r"""
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.