Skip to content

Commit 4247dc0

Browse files
committed
tiny changes upon PR review
1 parent b6ba66b commit 4247dc0

File tree

8 files changed

+15
-16
lines changed

8 files changed

+15
-16
lines changed

telegram/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
from .orderinfo import OrderInfo
5555
from .successfulpayment import SuccessfulPayment
5656
from .invoice import Invoice
57-
from .videonote import VideoNote
5857
from .message import Message
5958
from .inputmessagecontent import InputMessageContent
6059
from .callbackquery import CallbackQuery
@@ -93,6 +92,7 @@
9392
from .shippingquery import ShippingQuery
9493
from .webhookinfo import WebhookInfo
9594
from .gamehighscore import GameHighScore
95+
from .videonote import VideoNote
9696
from .update import Update
9797
from .bot import Bot
9898
from .constants import (MAX_MESSAGE_LENGTH, MAX_CAPTION_LENGTH, SUPPORTED_WEBHOOK_PORTS,

telegram/bot.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,7 @@ def send_invoice(self,
19181918
data['need_name'] = need_name
19191919
if need_phone_number is not None:
19201920
data['need_phone_number'] = need_phone_number
1921-
if need_email:
1921+
if need_email is not None:
19221922
data['need_email'] = need_email
19231923
if need_shipping_address is not None:
19241924
data['need_shipping_address'] = need_shipping_address
@@ -2009,8 +2009,7 @@ def answer_pre_checkout_query(self, pre_checkout_query_id, ok,
20092009
20102010
"""
20112011

2012-
if ((ok is not True and error_message is None) or
2013-
(ok is True and error_message is not None)):
2012+
if not (ok ^ (error_message is None)):
20142013
raise TelegramError(
20152014
'answerPreCheckoutQuery: If ok is True, there should '
20162015
'not be error_message; if ok is False, error_message '

telegram/ext/precheckoutqueryhandler.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ def __init__(self,
6262
pass_chat_data=pass_chat_data)
6363

6464
def check_update(self, update):
65-
if isinstance(update, Update) and update.pre_checkout_query:
66-
return True
65+
return isinstance(update, Update) and update.pre_checkout_query
6766

6867
def handle_update(self, update, dispatcher):
6968
optional_args = self.collect_optional_args(dispatcher, update)

telegram/ext/shippingqueryhandler.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ def __init__(self,
6262
pass_chat_data=pass_chat_data)
6363

6464
def check_update(self, update):
65-
if isinstance(update, Update) and update.shipping_query:
66-
return True
65+
return isinstance(update, Update) and update.shipping_query
6766

6867
def handle_update(self, update, dispatcher):
6968
optional_args = self.collect_optional_args(dispatcher, update)

telegram/message.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ class Message(TelegramObject):
106106
107107
left_chat_participant (:class:`telegram.User`): Use `left_chat_member`
108108
instead.
109+
109110
"""
110111

111112
def __init__(self,

telegram/precheckoutquery.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ class PreCheckoutQuery(TelegramObject):
3333
currency (str): Three-letter ISO 4217 currency code
3434
total_amount (int): Total price in the smallest units of the currency (integer)
3535
invoice_payload (str): Bot specified invoice payload
36-
37-
Keyword Args:
3836
shipping_option_id (Optional[str]): Identifier of the shipping option chosen by the user
3937
order_info (Optional[:class:`telegram.OrderInfo`]): Order info provided by the user
38+
bot (Optional[Bot]): The Bot to use for instance methods
4039
**kwargs (dict): Arbitrary keyword arguments.
4140
4241
"""

telegram/shippingquery.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class ShippingQuery(TelegramObject):
3232
from_user (:class:`telegram.User`): User who sent the query
3333
invoice_payload (str): Bot specified invoice payload
3434
shipping_address (:class:`telegram.ShippingQuery`): User specified shipping address
35+
bot (Optional[Bot]): The Bot to use for instance methods
3536
**kwargs (dict): Arbitrary keyword arguments.
3637
3738
"""

telegram/update.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@ class Update(TelegramObject):
3232
edited_message (:class:`telegram.Message`): New version of a message that is known to the
3333
bot and was edited
3434
inline_query (:class:`telegram.InlineQuery`): New incoming inline query.
35-
shipping_query (:class:`telegram.ShippingQuery`): New incoming shipping query.
36-
pre_checkout_query (:class:`telegram.PreCheckoutQuery`): New incoming pre-checkout query.
3735
chosen_inline_result (:class:`telegram.ChosenInlineResult`): The result of an inline query
3836
that was chosen by a user and sent to their chat partner.
3937
callback_query (:class:`telegram.CallbackQuery`): New incoming callback query.
4038
channel_post (Optional[:class:`telegram.Message`]): New incoming channel post of any kind -
4139
text, photo, sticker, etc.
4240
edited_channel_post (Optional[:class:`telegram.Message`]): New version of a channel post
4341
that is known to the bot and was edited.
42+
shipping_query (:class:`telegram.ShippingQuery`): New incoming shipping query.
43+
pre_checkout_query (:class:`telegram.PreCheckoutQuery`): New incoming pre-checkout query.
44+
4445
4546
Args:
4647
update_id (int):
@@ -49,10 +50,10 @@ class Update(TelegramObject):
4950
inline_query (Optional[:class:`telegram.InlineQuery`]):
5051
chosen_inline_result (Optional[:class:`telegram.ChosenInlineResult`])
5152
callback_query (Optional[:class:`telegram.CallbackQuery`]):
52-
shipping_query (Optional[:class:`telegram.ShippingQuery`]):
53-
pre_checkout_query (Optional[:class:`telegram.PreCheckoutQuery`]):
5453
channel_post (Optional[:class:`telegram.Message`]):
5554
edited_channel_post (Optional[:class:`telegram.Message`]):
55+
shipping_query (Optional[:class:`telegram.ShippingQuery`]):
56+
pre_checkout_query (Optional[:class:`telegram.PreCheckoutQuery`]):
5657
**kwargs: Arbitrary keyword arguments.
5758
5859
"""
@@ -64,10 +65,10 @@ def __init__(self,
6465
inline_query=None,
6566
chosen_inline_result=None,
6667
callback_query=None,
67-
shipping_query=None,
68-
pre_checkout_query=None,
6968
channel_post=None,
7069
edited_channel_post=None,
70+
shipping_query=None,
71+
pre_checkout_query=None,
7172
**kwargs):
7273
# Required
7374
self.update_id = int(update_id)

0 commit comments

Comments
 (0)