Skip to content

Commit a75dffd

Browse files
* Document ExtBot.insert_callbakc_data * fix duplicate object descriptions Fixed by removing `:undoc-members:` in the affected classes. Closes sphinx-doc/sphinx#9294 * fix incorrect shortcut docstrings in user.py * fix object type in forcereply.py * fix discuss bot link in loginurl.py * document that message is None for (my)_chat_member in `effective_message` * numerous persistence rendering fixes * move docstring from property setter to property * Revert "fix object type in forcereply.py" This reverts commit 012663e. * Document comparison of jobs * Update min python version to 3.6.8 * remove old note from chat.py + some return msg fixes * fix colon placement Co-authored-by: Harshil <[email protected]> Co-authored-by: Harshil <[email protected]>
1 parent fce2993 commit a75dffd

15 files changed

Lines changed: 60 additions & 64 deletions

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Introduction
9393

9494
This library provides a pure Python interface for the
9595
`Telegram Bot API <https://core.telegram.org/bots/api>`_.
96-
It's compatible with Python versions 3.6.2+. PTB might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.
96+
It's compatible with Python versions 3.6.8+. PTB might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.
9797

9898
In addition to the pure API implementation, this library features a number of high-level classes to
9999
make the development of bots easy and straightforward. These classes are contained in the

README_RAW.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Introduction
9191

9292
This library provides a pure Python, lightweight interface for the
9393
`Telegram Bot API <https://core.telegram.org/bots/api>`_.
94-
It's compatible with Python versions 3.6.2+. PTB-Raw might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.
94+
It's compatible with Python versions 3.6.8+. PTB-Raw might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.
9595

9696
``python-telegram-bot-raw`` is part of the `python-telegram-bot <https://python-telegram-bot.org>`_ ecosystem and provides the pure API functionality extracted from PTB. It therefore does *not* have independent release schedules, changelogs or documentation. Please consult the PTB resources.
9797

docs/source/telegram.ext.extbot.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ telegram.ext.ExtBot
55

66
.. autoclass:: telegram.ext.ExtBot
77
:show-inheritance:
8+
9+
.. autofunction:: telegram.ext.ExtBot.insert_callback_data

docs/source/telegram.ext.handler.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ telegram.ext.Handler
55

66
.. autoclass:: telegram.ext.Handler
77
:members:
8-
:undoc-members:
98
:show-inheritance:

docs/source/telegram.update.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ telegram.Update
55

66
.. autoclass:: telegram.Update
77
:members:
8-
:undoc-members:
98
:show-inheritance:

docs/source/telegram.user.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ telegram.User
55

66
.. autoclass:: telegram.User
77
:members:
8-
:undoc-members:
98
:show-inheritance:

telegram/chat.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def leave(self, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict =
284284
For the documentation of the arguments, please see :meth:`telegram.Bot.leave_chat`.
285285
286286
Returns:
287-
:obj:`bool` If the action was sent successfully.
287+
:obj:`bool`: On success, :obj:`True` is returned.
288288
289289
"""
290290
return self.bot.leave_chat(
@@ -375,13 +375,7 @@ def kick_member(
375375
:meth:`telegram.Bot.kick_chat_member`.
376376
377377
Returns:
378-
:obj:`bool`: If the action was sent successfully.
379-
380-
Note:
381-
This method will only work if the `All Members Are Admins` setting is off in the
382-
target group. Otherwise members may only be removed by the group's creator or by the
383-
member that added them.
384-
378+
:obj:`bool`: On success, :obj:`True` is returned.
385379
"""
386380
return self.bot.kick_chat_member(
387381
chat_id=self.id,
@@ -406,7 +400,7 @@ def unban_member(
406400
For the documentation of the arguments, please see :meth:`telegram.Bot.unban_chat_member`.
407401
408402
Returns:
409-
:obj:`bool`: If the action was sent successfully.
403+
:obj:`bool`: On success, :obj:`True` is returned.
410404
411405
"""
412406
return self.bot.unban_chat_member(
@@ -444,7 +438,7 @@ def promote_member(
444438
.. versionadded:: 13.2
445439
446440
Returns:
447-
:obj:`bool`: If the action was sent successfully.
441+
:obj:`bool`: On success, :obj:`True` is returned.
448442
449443
"""
450444
return self.bot.promote_chat_member(
@@ -483,7 +477,7 @@ def restrict_member(
483477
.. versionadded:: 13.2
484478
485479
Returns:
486-
:obj:`bool`: If the action was sent successfully.
480+
:obj:`bool`: On success, :obj:`True` is returned.
487481
488482
"""
489483
return self.bot.restrict_chat_member(
@@ -509,7 +503,7 @@ def set_permissions(
509503
:meth:`telegram.Bot.set_chat_permissions`.
510504
511505
Returns:
512-
:obj:`bool`: If the action was sent successfully.
506+
:obj:`bool`: On success, :obj:`True` is returned.
513507
514508
"""
515509
return self.bot.set_chat_permissions(
@@ -534,7 +528,7 @@ def set_administrator_custom_title(
534528
:meth:`telegram.Bot.set_chat_administrator_custom_title`.
535529
536530
Returns:
537-
:obj:`bool`: If the action was sent successfully.
531+
:obj:`bool`: On success, :obj:`True` is returned.
538532
539533
"""
540534
return self.bot.set_chat_administrator_custom_title(
@@ -678,7 +672,7 @@ def send_media_group(
678672
For the documentation of the arguments, please see :meth:`telegram.Bot.send_media_group`.
679673
680674
Returns:
681-
List[:class:`telegram.Message`:] On success, instance representing the message posted.
675+
List[:class:`telegram.Message`]: On success, instance representing the message posted.
682676
683677
"""
684678
return self.bot.send_media_group(

telegram/ext/basepersistence.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,8 @@ def get_callback_data(self) -> Optional[CDCData]:
446446
.. versionadded:: 13.6
447447
448448
Returns:
449-
Optional[:class:`telegram.ext.utils.types.CDCData`]: The restored meta data or
450-
:obj:`None`, if no data was stored.
449+
Optional[:class:`telegram.ext.utils.types.CDCData`]: The restored meta data or
450+
:obj:`None`, if no data was stored.
451451
"""
452452
raise NotImplementedError
453453

@@ -469,8 +469,8 @@ def get_conversations(self, name: str) -> ConversationDict:
469469
def update_conversation(
470470
self, name: str, key: Tuple[int, ...], new_state: Optional[object]
471471
) -> None:
472-
"""Will be called when a :attr:`telegram.ext.ConversationHandler.update_state`
473-
is called. This allows the storage of the new state in the persistence.
472+
"""Will be called when a :class:`telegram.ext.ConversationHandler` changes states.
473+
This allows the storage of the new state in the persistence.
474474
475475
Args:
476476
name (:obj:`str`): The handler's name.
@@ -486,7 +486,7 @@ def update_user_data(self, user_id: int, data: UD) -> None:
486486
Args:
487487
user_id (:obj:`int`): The user the data might have been changed for.
488488
data (:class:`telegram.ext.utils.types.UD`): The
489-
:attr:`telegram.ext.dispatcher.user_data` ``[user_id]``.
489+
:attr:`telegram.ext.Dispatcher.user_data` ``[user_id]``.
490490
"""
491491

492492
@abstractmethod
@@ -497,7 +497,7 @@ def update_chat_data(self, chat_id: int, data: CD) -> None:
497497
Args:
498498
chat_id (:obj:`int`): The chat the data might have been changed for.
499499
data (:class:`telegram.ext.utils.types.CD`): The
500-
:attr:`telegram.ext.dispatcher.chat_data` ``[chat_id]``.
500+
:attr:`telegram.ext.Dispatcher.chat_data` ``[chat_id]``.
501501
"""
502502

503503
@abstractmethod
@@ -507,7 +507,7 @@ def update_bot_data(self, data: BD) -> None:
507507
508508
Args:
509509
data (:class:`telegram.ext.utils.types.BD`): The
510-
:attr:`telegram.ext.dispatcher.bot_data`.
510+
:attr:`telegram.ext.Dispatcher.bot_data`.
511511
"""
512512

513513
def refresh_user_data(self, user_id: int, user_data: UD) -> None:
@@ -552,8 +552,8 @@ def update_callback_data(self, data: CDCData) -> None:
552552
.. versionadded:: 13.6
553553
554554
Args:
555-
data (:class:`telegram.ext.utils.types.CDCData`:): The relevant data to restore
556-
:attr:`telegram.ext.dispatcher.bot.callback_data_cache`.
555+
data (:class:`telegram.ext.utils.types.CDCData`): The relevant data to restore
556+
:class:`telegram.ext.CallbackDataCache`.
557557
"""
558558
raise NotImplementedError
559559

telegram/ext/conversationhandler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,11 @@ def fallbacks(self, value: object) -> NoReturn:
350350

351351
@property
352352
def allow_reentry(self) -> bool:
353+
""":obj:`bool`: Determines if a user can restart a conversation with an entry point."""
353354
return self._allow_reentry
354355

355356
@allow_reentry.setter
356357
def allow_reentry(self, value: object) -> NoReturn:
357-
""":obj:`bool`: Determines if a user can restart a conversation with an entry point."""
358358
raise ValueError('You can not assign a new value to allow_reentry after initialization.')
359359

360360
@property

telegram/ext/dictpersistence.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def get_callback_data(self) -> Optional[CDCData]:
294294
295295
Returns:
296296
Optional[:class:`telegram.ext.utils.types.CDCData`]: The restored meta data or
297-
:obj:`None`, if no data was stored.
297+
:obj:`None`, if no data was stored.
298298
"""
299299
if self.callback_data is None:
300300
self._callback_data = None
@@ -334,7 +334,7 @@ def update_user_data(self, user_id: int, data: Dict) -> None:
334334
335335
Args:
336336
user_id (:obj:`int`): The user the data might have been changed for.
337-
data (:obj:`dict`): The :attr:`telegram.ext.dispatcher.user_data` ``[user_id]``.
337+
data (:obj:`dict`): The :attr:`telegram.ext.Dispatcher.user_data` ``[user_id]``.
338338
"""
339339
if self._user_data is None:
340340
self._user_data = defaultdict(dict)
@@ -348,7 +348,7 @@ def update_chat_data(self, chat_id: int, data: Dict) -> None:
348348
349349
Args:
350350
chat_id (:obj:`int`): The chat the data might have been changed for.
351-
data (:obj:`dict`): The :attr:`telegram.ext.dispatcher.chat_data` ``[chat_id]``.
351+
data (:obj:`dict`): The :attr:`telegram.ext.Dispatcher.chat_data` ``[chat_id]``.
352352
"""
353353
if self._chat_data is None:
354354
self._chat_data = defaultdict(dict)
@@ -361,7 +361,7 @@ def update_bot_data(self, data: Dict) -> None:
361361
"""Will update the bot_data (if changed).
362362
363363
Args:
364-
data (:obj:`dict`): The :attr:`telegram.ext.dispatcher.bot_data`.
364+
data (:obj:`dict`): The :attr:`telegram.ext.Dispatcher.bot_data`.
365365
"""
366366
if self._bot_data == data:
367367
return
@@ -374,8 +374,8 @@ def update_callback_data(self, data: CDCData) -> None:
374374
.. versionadded:: 13.6
375375
376376
Args:
377-
data (:class:`telegram.ext.utils.types.CDCData`:): The relevant data to restore
378-
:attr:`telegram.ext.dispatcher.bot.callback_data_cache`.
377+
data (:class:`telegram.ext.utils.types.CDCData`): The relevant data to restore
378+
:class:`telegram.ext.CallbackDataCache`.
379379
"""
380380
if self._callback_data == data:
381381
return

0 commit comments

Comments
 (0)