diff --git a/.gitignore b/.gitignore index 7219663..2586c71 100644 --- a/.gitignore +++ b/.gitignore @@ -67,5 +67,3 @@ testMain.py # documentation _build/ -_static/ -_templates/ diff --git a/docs/source/logo.png b/docs/source/_static/logo.png similarity index 100% rename from docs/source/logo.png rename to docs/source/_static/logo.png diff --git a/docs/source/_static/logo2.png b/docs/source/_static/logo2.png new file mode 100644 index 0000000..df0e0d7 Binary files /dev/null and b/docs/source/_static/logo2.png differ diff --git a/docs/source/conf.py b/docs/source/conf.py index 8a9f739..9f558c6 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -16,13 +16,14 @@ # -- Project information ----------------------------------------------------- +import telebot project = 'pyTelegramBotAPI' copyright = '2022, coder2020official' author = 'coder2020official' # The full version, including alpha/beta/rc tags -release = '1.0' +release = telebot.__version__ # -- General configuration --------------------------------------------------- @@ -36,6 +37,7 @@ extensions = [ 'sphinx.ext.autodoc', "sphinx.ext.autosummary", "sphinx.ext.napoleon", + "sphinx_copybutton", ] @@ -53,14 +55,18 @@ exclude_patterns = [] # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'sphinx_rtd_theme' +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_logo = 'logo.png' html_theme_options = { - 'logo_only': True, - 'display_version': False, + "light_css_variables": { + "color-brand-primary": "#7C4DFF", + "color-brand-content": "#7C4DFF", + }, + "light_logo": "logo.png", + "dark_logo": "logo2.png", } diff --git a/telebot/__init__.py b/telebot/__init__.py index cf1be1f..afa4e09 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -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') diff --git a/telebot/async_telebot.py b/telebot/async_telebot.py index f654083..2ab6f4a 100644 --- a/telebot/async_telebot.py +++ b/telebot/async_telebot.py @@ -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 """ diff --git a/telebot/util.py b/telebot/util.py index f7e9e4a..14ed360 100644 --- a/telebot/util.py +++ b/telebot/util.py @@ -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.