mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-28 07:20:17 +01:00
tiny changes upon PR review
This commit is contained in:
parent
b6ba66ba8e
commit
4247dc0e21
8 changed files with 15 additions and 16 deletions
|
@ -54,7 +54,6 @@ from .shippingaddress import ShippingAddress
|
|||
from .orderinfo import OrderInfo
|
||||
from .successfulpayment import SuccessfulPayment
|
||||
from .invoice import Invoice
|
||||
from .videonote import VideoNote
|
||||
from .message import Message
|
||||
from .inputmessagecontent import InputMessageContent
|
||||
from .callbackquery import CallbackQuery
|
||||
|
@ -93,6 +92,7 @@ from .precheckoutquery import PreCheckoutQuery
|
|||
from .shippingquery import ShippingQuery
|
||||
from .webhookinfo import WebhookInfo
|
||||
from .gamehighscore import GameHighScore
|
||||
from .videonote import VideoNote
|
||||
from .update import Update
|
||||
from .bot import Bot
|
||||
from .constants import (MAX_MESSAGE_LENGTH, MAX_CAPTION_LENGTH, SUPPORTED_WEBHOOK_PORTS,
|
||||
|
|
|
@ -1918,7 +1918,7 @@ class Bot(TelegramObject):
|
|||
data['need_name'] = need_name
|
||||
if need_phone_number is not None:
|
||||
data['need_phone_number'] = need_phone_number
|
||||
if need_email:
|
||||
if need_email is not None:
|
||||
data['need_email'] = need_email
|
||||
if need_shipping_address is not None:
|
||||
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
|
||||
(ok is True and error_message is not None)):
|
||||
if not (ok ^ (error_message is None)):
|
||||
raise TelegramError(
|
||||
'answerPreCheckoutQuery: If ok is True, there should '
|
||||
'not be error_message; if ok is False, error_message '
|
||||
|
|
|
@ -62,8 +62,7 @@ class PreCheckoutQueryHandler(Handler):
|
|||
pass_chat_data=pass_chat_data)
|
||||
|
||||
def check_update(self, update):
|
||||
if isinstance(update, Update) and update.pre_checkout_query:
|
||||
return True
|
||||
return isinstance(update, Update) and update.pre_checkout_query
|
||||
|
||||
def handle_update(self, update, dispatcher):
|
||||
optional_args = self.collect_optional_args(dispatcher, update)
|
||||
|
|
|
@ -62,8 +62,7 @@ class ShippingQueryHandler(Handler):
|
|||
pass_chat_data=pass_chat_data)
|
||||
|
||||
def check_update(self, update):
|
||||
if isinstance(update, Update) and update.shipping_query:
|
||||
return True
|
||||
return isinstance(update, Update) and update.shipping_query
|
||||
|
||||
def handle_update(self, update, dispatcher):
|
||||
optional_args = self.collect_optional_args(dispatcher, update)
|
||||
|
|
|
@ -106,6 +106,7 @@ class Message(TelegramObject):
|
|||
|
||||
left_chat_participant (:class:`telegram.User`): Use `left_chat_member`
|
||||
instead.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
|
|
|
@ -33,10 +33,9 @@ class PreCheckoutQuery(TelegramObject):
|
|||
currency (str): Three-letter ISO 4217 currency code
|
||||
total_amount (int): Total price in the smallest units of the currency (integer)
|
||||
invoice_payload (str): Bot specified invoice payload
|
||||
|
||||
Keyword Args:
|
||||
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
|
||||
bot (Optional[Bot]): The Bot to use for instance methods
|
||||
**kwargs (dict): Arbitrary keyword arguments.
|
||||
|
||||
"""
|
||||
|
|
|
@ -32,6 +32,7 @@ class ShippingQuery(TelegramObject):
|
|||
from_user (:class:`telegram.User`): User who sent the query
|
||||
invoice_payload (str): Bot specified invoice payload
|
||||
shipping_address (:class:`telegram.ShippingQuery`): User specified shipping address
|
||||
bot (Optional[Bot]): The Bot to use for instance methods
|
||||
**kwargs (dict): Arbitrary keyword arguments.
|
||||
|
||||
"""
|
||||
|
|
|
@ -32,8 +32,6 @@ class Update(TelegramObject):
|
|||
edited_message (:class:`telegram.Message`): New version of a message that is known to the
|
||||
bot and was edited
|
||||
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
|
||||
that was chosen by a user and sent to their chat partner.
|
||||
callback_query (:class:`telegram.CallbackQuery`): New incoming callback query.
|
||||
|
@ -41,6 +39,9 @@ class Update(TelegramObject):
|
|||
text, photo, sticker, etc.
|
||||
edited_channel_post (Optional[:class:`telegram.Message`]): New version of a channel post
|
||||
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:
|
||||
update_id (int):
|
||||
|
@ -49,10 +50,10 @@ class Update(TelegramObject):
|
|||
inline_query (Optional[:class:`telegram.InlineQuery`]):
|
||||
chosen_inline_result (Optional[:class:`telegram.ChosenInlineResult`])
|
||||
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`]):
|
||||
edited_channel_post (Optional[:class:`telegram.Message`]):
|
||||
shipping_query (Optional[:class:`telegram.ShippingQuery`]):
|
||||
pre_checkout_query (Optional[:class:`telegram.PreCheckoutQuery`]):
|
||||
**kwargs: Arbitrary keyword arguments.
|
||||
|
||||
"""
|
||||
|
@ -64,10 +65,10 @@ class Update(TelegramObject):
|
|||
inline_query=None,
|
||||
chosen_inline_result=None,
|
||||
callback_query=None,
|
||||
shipping_query=None,
|
||||
pre_checkout_query=None,
|
||||
channel_post=None,
|
||||
edited_channel_post=None,
|
||||
shipping_query=None,
|
||||
pre_checkout_query=None,
|
||||
**kwargs):
|
||||
# Required
|
||||
self.update_id = int(update_id)
|
||||
|
|
Loading…
Reference in a new issue