tiny changes upon PR review

This commit is contained in:
Jeff 2017-06-08 09:47:19 +08:00
parent b6ba66ba8e
commit 4247dc0e21
8 changed files with 15 additions and 16 deletions

View file

@ -54,7 +54,6 @@ from .shippingaddress import ShippingAddress
from .orderinfo import OrderInfo from .orderinfo import OrderInfo
from .successfulpayment import SuccessfulPayment from .successfulpayment import SuccessfulPayment
from .invoice import Invoice from .invoice import Invoice
from .videonote import VideoNote
from .message import Message from .message import Message
from .inputmessagecontent import InputMessageContent from .inputmessagecontent import InputMessageContent
from .callbackquery import CallbackQuery from .callbackquery import CallbackQuery
@ -93,6 +92,7 @@ from .precheckoutquery import PreCheckoutQuery
from .shippingquery import ShippingQuery from .shippingquery import ShippingQuery
from .webhookinfo import WebhookInfo from .webhookinfo import WebhookInfo
from .gamehighscore import GameHighScore from .gamehighscore import GameHighScore
from .videonote import VideoNote
from .update import Update from .update import Update
from .bot import Bot from .bot import Bot
from .constants import (MAX_MESSAGE_LENGTH, MAX_CAPTION_LENGTH, SUPPORTED_WEBHOOK_PORTS, from .constants import (MAX_MESSAGE_LENGTH, MAX_CAPTION_LENGTH, SUPPORTED_WEBHOOK_PORTS,

View file

@ -1918,7 +1918,7 @@ class Bot(TelegramObject):
data['need_name'] = need_name data['need_name'] = need_name
if need_phone_number is not None: if need_phone_number is not None:
data['need_phone_number'] = need_phone_number data['need_phone_number'] = need_phone_number
if need_email: if need_email is not None:
data['need_email'] = need_email data['need_email'] = need_email
if need_shipping_address is not None: if need_shipping_address is not None:
data['need_shipping_address'] = need_shipping_address data['need_shipping_address'] = need_shipping_address
@ -2009,8 +2009,7 @@ class Bot(TelegramObject):
""" """
if ((ok is not True and error_message is None) or if not (ok ^ (error_message is None)):
(ok is True and error_message is not None)):
raise TelegramError( raise TelegramError(
'answerPreCheckoutQuery: If ok is True, there should ' 'answerPreCheckoutQuery: If ok is True, there should '
'not be error_message; if ok is False, error_message ' 'not be error_message; if ok is False, error_message '

View file

@ -62,8 +62,7 @@ class PreCheckoutQueryHandler(Handler):
pass_chat_data=pass_chat_data) pass_chat_data=pass_chat_data)
def check_update(self, update): def check_update(self, update):
if isinstance(update, Update) and update.pre_checkout_query: return isinstance(update, Update) and update.pre_checkout_query
return True
def handle_update(self, update, dispatcher): def handle_update(self, update, dispatcher):
optional_args = self.collect_optional_args(dispatcher, update) optional_args = self.collect_optional_args(dispatcher, update)

View file

@ -62,8 +62,7 @@ class ShippingQueryHandler(Handler):
pass_chat_data=pass_chat_data) pass_chat_data=pass_chat_data)
def check_update(self, update): def check_update(self, update):
if isinstance(update, Update) and update.shipping_query: return isinstance(update, Update) and update.shipping_query
return True
def handle_update(self, update, dispatcher): def handle_update(self, update, dispatcher):
optional_args = self.collect_optional_args(dispatcher, update) optional_args = self.collect_optional_args(dispatcher, update)

View file

@ -106,6 +106,7 @@ class Message(TelegramObject):
left_chat_participant (:class:`telegram.User`): Use `left_chat_member` left_chat_participant (:class:`telegram.User`): Use `left_chat_member`
instead. instead.
""" """
def __init__(self, def __init__(self,

View file

@ -33,10 +33,9 @@ class PreCheckoutQuery(TelegramObject):
currency (str): Three-letter ISO 4217 currency code currency (str): Three-letter ISO 4217 currency code
total_amount (int): Total price in the smallest units of the currency (integer) total_amount (int): Total price in the smallest units of the currency (integer)
invoice_payload (str): Bot specified invoice payload invoice_payload (str): Bot specified invoice payload
Keyword Args:
shipping_option_id (Optional[str]): Identifier of the shipping option chosen by the user shipping_option_id (Optional[str]): Identifier of the shipping option chosen by the user
order_info (Optional[:class:`telegram.OrderInfo`]): Order info provided by the user order_info (Optional[:class:`telegram.OrderInfo`]): Order info provided by the user
bot (Optional[Bot]): The Bot to use for instance methods
**kwargs (dict): Arbitrary keyword arguments. **kwargs (dict): Arbitrary keyword arguments.
""" """

View file

@ -32,6 +32,7 @@ class ShippingQuery(TelegramObject):
from_user (:class:`telegram.User`): User who sent the query from_user (:class:`telegram.User`): User who sent the query
invoice_payload (str): Bot specified invoice payload invoice_payload (str): Bot specified invoice payload
shipping_address (:class:`telegram.ShippingQuery`): User specified shipping address shipping_address (:class:`telegram.ShippingQuery`): User specified shipping address
bot (Optional[Bot]): The Bot to use for instance methods
**kwargs (dict): Arbitrary keyword arguments. **kwargs (dict): Arbitrary keyword arguments.
""" """

View file

@ -32,8 +32,6 @@ class Update(TelegramObject):
edited_message (:class:`telegram.Message`): New version of a message that is known to the edited_message (:class:`telegram.Message`): New version of a message that is known to the
bot and was edited bot and was edited
inline_query (:class:`telegram.InlineQuery`): New incoming inline query. inline_query (:class:`telegram.InlineQuery`): New incoming inline query.
shipping_query (:class:`telegram.ShippingQuery`): New incoming shipping query.
pre_checkout_query (:class:`telegram.PreCheckoutQuery`): New incoming pre-checkout query.
chosen_inline_result (:class:`telegram.ChosenInlineResult`): The result of an inline query chosen_inline_result (:class:`telegram.ChosenInlineResult`): The result of an inline query
that was chosen by a user and sent to their chat partner. that was chosen by a user and sent to their chat partner.
callback_query (:class:`telegram.CallbackQuery`): New incoming callback query. callback_query (:class:`telegram.CallbackQuery`): New incoming callback query.
@ -41,6 +39,9 @@ class Update(TelegramObject):
text, photo, sticker, etc. text, photo, sticker, etc.
edited_channel_post (Optional[:class:`telegram.Message`]): New version of a channel post edited_channel_post (Optional[:class:`telegram.Message`]): New version of a channel post
that is known to the bot and was edited. that is known to the bot and was edited.
shipping_query (:class:`telegram.ShippingQuery`): New incoming shipping query.
pre_checkout_query (:class:`telegram.PreCheckoutQuery`): New incoming pre-checkout query.
Args: Args:
update_id (int): update_id (int):
@ -49,10 +50,10 @@ class Update(TelegramObject):
inline_query (Optional[:class:`telegram.InlineQuery`]): inline_query (Optional[:class:`telegram.InlineQuery`]):
chosen_inline_result (Optional[:class:`telegram.ChosenInlineResult`]) chosen_inline_result (Optional[:class:`telegram.ChosenInlineResult`])
callback_query (Optional[:class:`telegram.CallbackQuery`]): callback_query (Optional[:class:`telegram.CallbackQuery`]):
shipping_query (Optional[:class:`telegram.ShippingQuery`]):
pre_checkout_query (Optional[:class:`telegram.PreCheckoutQuery`]):
channel_post (Optional[:class:`telegram.Message`]): channel_post (Optional[:class:`telegram.Message`]):
edited_channel_post (Optional[:class:`telegram.Message`]): edited_channel_post (Optional[:class:`telegram.Message`]):
shipping_query (Optional[:class:`telegram.ShippingQuery`]):
pre_checkout_query (Optional[:class:`telegram.PreCheckoutQuery`]):
**kwargs: Arbitrary keyword arguments. **kwargs: Arbitrary keyword arguments.
""" """
@ -64,10 +65,10 @@ class Update(TelegramObject):
inline_query=None, inline_query=None,
chosen_inline_result=None, chosen_inline_result=None,
callback_query=None, callback_query=None,
shipping_query=None,
pre_checkout_query=None,
channel_post=None, channel_post=None,
edited_channel_post=None, edited_channel_post=None,
shipping_query=None,
pre_checkout_query=None,
**kwargs): **kwargs):
# Required # Required
self.update_id = int(update_id) self.update_id = int(update_id)