Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing docstrings #2126

Merged
merged 8 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions telebot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,9 @@ def close(self) -> bool:

def set_message_reaction(self, chat_id: Union[int, str], message_id: int, reaction: Optional[List[types.ReactionType]]=None, is_big: Optional[bool]=None) -> bool:
"""
Use this method to set a reaction to a message in a chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
Use this method to change the chosen reactions on a message.
Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same
available reactions as messages in the channel. Returns True on success.

Telegram documentation: https://core.telegram.org/bots/api#setmessagereaction

Expand Down Expand Up @@ -1841,9 +1843,7 @@ def delete_message(self, chat_id: Union[int, str], message_id: int,

def delete_messages(self, chat_id: Union[int, str], message_ids: List[int]):
"""
Use this method to delete multiple messages in a chat.
The number of messages to be deleted must not exceed 100.
If the chat is a private chat, the user must be an administrator of the chat for this to work and must have the appropriate admin rights.
Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped.
Returns True on success.

Telegram documentation: https://core.telegram.org/bots/api#deletemessages
Expand All @@ -1863,7 +1863,11 @@ def delete_messages(self, chat_id: Union[int, str], message_ids: List[int]):
def forward_messages(self, chat_id: Union[str, int], from_chat_id: Union[str, int], message_ids: List[int], disable_notification: Optional[bool]=None,
message_thread_id: Optional[int]=None, protect_content: Optional[bool]=None) -> List[types.MessageID]:
"""
Use this method to forward messages of any kind.
Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped.
Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages.
On success, an array of MessageId of the sent messages is returned.

Telegram documentation: https://core.telegram.org/bots/api#forwardmessages

:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
:type chat_id: :obj:`int` or :obj:`str`
Expand Down Expand Up @@ -1901,7 +1905,14 @@ def copy_messages(self, chat_id: Union[str, int], from_chat_id: Union[str, int],
disable_notification: Optional[bool] = None, message_thread_id: Optional[int] = None,
protect_content: Optional[bool] = None, remove_caption: Optional[bool] = None) -> List[types.MessageID]:
"""
Use this method to copy messages of any kind.
Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped.
Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied.
A quiz poll can be copied only if the value of the field correct_option_id is known to the bot.
The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message.
Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned.

Telegram documentation: https://core.telegram.org/bots/api#copymessages


:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
:type chat_id: :obj:`int` or :obj:`str`
Expand Down
24 changes: 17 additions & 7 deletions telebot/async_telebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2422,7 +2422,9 @@ async def get_webhook_info(self, timeout: Optional[int]=None) -> types.WebhookIn

async def set_message_reaction(self, chat_id: Union[int, str], message_id: int, reaction: Optional[List[types.ReactionType]]=None, is_big: Optional[bool]=None) -> bool:
"""
Use this method to set a reaction to a message in a chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
Use this method to change the chosen reactions on a message.
Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same
available reactions as messages in the channel. Returns True on success.

Telegram documentation: https://core.telegram.org/bots/api#setmessagereaction

Expand Down Expand Up @@ -2911,10 +2913,8 @@ async def delete_message(self, chat_id: Union[int, str], message_id: int,

async def delete_messages(self, chat_id: Union[int, str], message_ids: List[int]):
"""
Use this method to delete multiple messages in a chat.
The number of messages to be deleted must not exceed 100.
If the chat is a private chat, the user must be an administrator of the chat for this to work and must have the appropriate admin rights.
Returns True on success.
Use this method to delete multiple messages simultaneously.
If some of the specified messages can't be found, they are skipped. Returns True on success.

Telegram documentation: https://core.telegram.org/bots/api#deletemessages

Expand All @@ -2932,7 +2932,11 @@ async def delete_messages(self, chat_id: Union[int, str], message_ids: List[int]
async def forward_messages(self, chat_id: Union[str, int], from_chat_id: Union[str, int], message_ids: List[int], disable_notification: Optional[bool]=None,
message_thread_id: Optional[int]=None, protect_content: Optional[bool]=None) -> List[types.MessageID]:
"""
Use this method to forward messages of any kind.
Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded,
they are skipped. Service messages and messages with protected content can't be forwarded.
Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned.

Telegram documentation: https://core.telegram.org/bots/api#forwardmessages

:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
:type chat_id: :obj:`int` or :obj:`str`
Expand Down Expand Up @@ -2965,7 +2969,13 @@ async def copy_messages(self, chat_id: Union[str, int], from_chat_id: Union[str,
disable_notification: Optional[bool] = None, message_thread_id: Optional[int] = None,
protect_content: Optional[bool] = None, remove_caption: Optional[bool] = None) -> List[types.MessageID]:
"""
Use this method to copy messages of any kind.
Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped.
Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied
only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but
the copied messages don't have a link to the original message. Album grouping is kept for copied messages.
On success, an array of MessageId of the sent messages is returned.

Telegram documentation: https://core.telegram.org/bots/api#copymessages

:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
:type chat_id: :obj:`int` or :obj:`str`
Expand Down
Loading