Docs update - #728
Conversation
WebhookInfo User UserProfilePhotos WebhookInfo Update User UserProfilePhotos WebhookInfo ReplyKeyboardRemove ReplyKeyboardRemove small typo ReplyKeyboardMarkup MessageEntity Message KeyboardButton ForceReply Errors Constants ChosenInlineResult ChatMember ChatAction MessageEntity.rst Chat CallbackQuery Base
InlineKeyboardButton InlineKeyboardMarkup InlineQuery InlineQueryResult InlineQueryResultArticle InlineQueryResultAudio InlineQueryResultArticle InlineQueryResultAudio InlineQueryResultCachedAudio InlineQueryResultCachedDocument InlineQueryResultCachedGif InlineQueryResultCachedMpeg4Gif InlineQueryResultCachedPhoto InlineQueryResultCachedSticker InlineQueryResultCachedVideo InlineQueryResultCachedVoice InlineQueryResultContact InlineQueryResultDocument InlineQueryResultGame InlineQueryResultGif InlineQueryResultLocation InlineQueryResultMpeg4Gif InlineQueryResultPhoto InlineQueryResultVenue InlineQueryResultVideo InlineQueryResultVoice InputContactMessageContent InputLocationMessageContent InputMessageContent InputTextMessageContent InputVenueMessageContent
CommandHandler InlineQueryHandler MessageHandler
Updated all new docs in new style
|
In #726 I added a note on where to find the max message length in |
|
@rahiel Because Max message length is now in the docstring for every text message method |
|
Regarding the questions @bomjacob asked:
|
|
|
I wasn't know with the typing stuff. Now I've seen it I aggree on 7 and 8. Will make try how it looks. |
All classes and methods now use the google style guide for docstrings.
jsmnbom
left a comment
There was a problem hiding this comment.
Okay that should be my last comments as far as docstring and code goes (haven't looked at rst files since you said those weren't done yet.
I know it looks like a butt-ton of comments, but most of them are fairly trivial :)
| chat_id (:obj:`int` | :obj:`float`): Unique identifier for the target chat or username | ||
| of the target channel (in the format @channelusername). | ||
| text (:obj:`str`): Text of the message to be sent. Max 4096 characters. Also found as | ||
| ``telegram.constants.MAX_MESSAGE_LENGTH``. |
There was a problem hiding this comment.
:const:`telegram.constants.MAX_MESSAGE_LENGTH`
(also found elsewhere, search for "4096")
| @channelusername). | ||
| message_id (int): Unique message identifier. | ||
| timeout (Optional[int|float]): If this value is specified, use it as the read timeout | ||
| chat_id (:obj:`int` | :obj:`float`): Unique identifier for the target chat or username |
There was a problem hiding this comment.
I think you mean :obj:`int` | :obj:`str`
(also applies elsewhere)
| """As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute | ||
| long. Use this method to send video messages | ||
| """ | ||
| As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. |
There was a problem hiding this comment.
The first line should describe what the method does. Either flip around the lines or in this case simply remove it.
| action(:class:`telegram.ChatAction` | :obj:`str`): Type of action to broadcast. Choose | ||
| one, depending on what the user is about to receive: | ||
|
|
||
| * typing for text messages |
There was a problem hiding this comment.
The constants are preferred here I'd say
There was a problem hiding this comment.
The method doesn't care, so I put it this way.
There was a problem hiding this comment.
I would very very much like to encourage our users to use the constants though
There was a problem hiding this comment.
Changed doc to remove the list from this method and point to ChatAction
| if isinstance(other, self.__class__): | ||
| return self._id_attrs == other._id_attrs | ||
| return super(TelegramObject, self).__eq__(other) | ||
| return super(TelegramObject, self).__eq__(other) # pylint: disable=E1101 |
There was a problem hiding this comment.
Could you maybe use the new named pylint names instead of the id?
# pylint: disable=no-member
There was a problem hiding this comment.
Out of scope of this PR? You added the comment though... I'm not asking you to go back and find all our pylint lines, I'm just thinking that we should start slowly switching over so we make it easier for ourselves in the future.
There was a problem hiding this comment.
you're right (forgot I put this in)
| def __init__(self, | ||
| id, | ||
| first_name, | ||
| type=None, |
There was a problem hiding this comment.
This means that we break backwards compat doesn't it?
There was a problem hiding this comment.
users are created by tg which does not send type. So I guess not
There was a problem hiding this comment.
It does not break tests and users have no type, so I see no problem in just removing it. It's still captured with **kwargs if needed.
| Handler class to handle updates of custom types. | ||
|
|
||
| Attributes: | ||
| type (:obj:`class`): The ``type`` of updates this handler should process. |
There was a problem hiding this comment.
Shouldn't that be of type type?
There was a problem hiding this comment.
It's a bit of a weird handler. You use it like:
import InlineQuery
add_handler(TypeHandler(InlineQuery))
There was a problem hiding this comment.
Exactly you pass it a class which has the type type
>>> class Test:
... pass
...
>>> type(Test)
<class 'type'>
>>>
| Args: | ||
| latitude (:obj:`float`): Latitude of the location in degrees. | ||
| longitude (:obj:`float`): Longitude of the location in degrees. | ||
| title (:obj:`str`); Name of the venue. |
There was a problem hiding this comment.
Semi colon?
(also applies elsewhere (a search for ; is fairly quick)
| selective (:obj:`bool`, optional): Use this parameter if you want to force reply from | ||
| specific users only. Targets: | ||
|
|
||
| 1) users that are @mentioned in the text of the Message object; |
| shipping_query (:class:`telegram.ShippingQuery`): New incoming shipping query. | ||
| pre_checkout_query (:class:`telegram.PreCheckoutQuery`): New incoming pre-checkout query. | ||
| Note: | ||
| At most one of the optional parameters can be present in any given update. |
There was a problem hiding this comment.
- "With the exception of update_id which is always present."
There was a problem hiding this comment.
that's why it's "at most one of the optional parameters..."
|
|
||
| Args: | ||
| callback (:obj:`callable): A function that takes ``bot, update`` as positional arguments. | ||
| callback (:obj:`callable'): A function that takes ``bot, update`` as positional arguments. |
|
|
||
| Note: | ||
| You must use exactly one of the optional fields. | ||
| You must use exactly one of the optional fields. Mind that :attr:`callback_game` is not |
There was a problem hiding this comment.
This isn't true though. callback_game the attribute is implemented, but it just accepts a games short name I think, otherwise there would be no way to launch games from custom keyboards.
restored old order of kwargs in regexhandler added deprecation warning
Parameter to StickerSet was flasely named on TG's docs as is_masks. It's fixed now.
Conflicts: CHANGES.rst telegram/base.py telegram/bot.py telegram/callbackquery.py telegram/chat.py telegram/chatmember.py telegram/choseninlineresult.py telegram/files/audio.py telegram/files/chatphoto.py telegram/files/contact.py telegram/files/document.py telegram/files/file.py telegram/files/location.py telegram/files/photosize.py telegram/files/sticker.py telegram/files/video.py telegram/files/videonote.py telegram/files/voice.py telegram/forcereply.py telegram/games/animation.py telegram/games/game.py telegram/games/gamehighscore.py telegram/inline/inlinekeyboardbutton.py telegram/inline/inlinekeyboardmarkup.py telegram/inline/inlinequery.py telegram/message.py telegram/messageentity.py telegram/payment/invoice.py telegram/payment/labeledprice.py telegram/payment/orderinfo.py telegram/payment/precheckoutquery.py telegram/payment/shippingaddress.py telegram/payment/shippingoption.py telegram/payment/shippingquery.py telegram/payment/successfulpayment.py telegram/replykeyboardmarkup.py telegram/replykeyboardremove.py telegram/replymarkup.py telegram/update.py telegram/user.py telegram/userprofilephotos.py telegram/webhookinfo.py
So here it is. All new and unified docs.
There might be some small spelling errors (if you find them please notify me).
It's a moloch of a pull request but I already included latest master (and updated the docstrings for new methods).