Skip to content

Commit 1bf0078

Browse files
committed
add missing "need_email" in sendInvoice, fix pep8/flake
1 parent 1210e4e commit 1bf0078

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

telegram/bot.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,7 @@ def send_invoice(self,
18351835
photo_height=None,
18361836
need_name=None,
18371837
need_phone_number=None,
1838+
need_email=None
18381839
need_shipping_address=None,
18391840
is_flexible=None,
18401841
disable_notification=False,
@@ -1867,6 +1868,8 @@ def send_invoice(self,
18671868
the order
18681869
need_phone_number (Optional[bool]): Pass True, if you require the user's phone number
18691870
to complete the order
1871+
need_email (Optional[bool]): Pass True, if you require the user's email to
1872+
complete the order
18701873
need_shipping_address (Optional[bool]): Pass True, if you require the user's shipping
18711874
address to complete the order
18721875
is_flexible (Optional[bool]): Pass True, if the final price depends on the shipping
@@ -1915,6 +1918,8 @@ def send_invoice(self,
19151918
data['need_name'] = need_name
19161919
if need_phone_number:
19171920
data['need_phone_number'] = need_phone_number
1921+
if need_email:
1922+
data['need_email'] = need_email
19181923
if need_shipping_address:
19191924
data['need_shipping_address'] = need_shipping_address
19201925
if is_flexible:
@@ -2004,7 +2009,8 @@ def answer_pre_checkout_query(self, pre_checkout_query_id, ok,
20042009
20052010
"""
20062011

2007-
if (ok is not True and error_message is None) or (ok is True and error_message is not None):
2012+
if ((ok is not True and error_message is None) or
2013+
(ok is True and error_message is not None)):
20082014
raise TelegramError(
20092015
'answerPreCheckoutQuery: If ok is True, there should '
20102016
'not be error_message; if ok is False, error_message '

telegram/precheckoutquery.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,7 @@ def to_dict(self):
9494
return data
9595

9696
def answer(self, *args, **kwargs):
97-
"""Shortcut for ``bot.answerPreCheckoutQuery(update.pre_checkout_query.id, *args, **kwargs)``"""
97+
"""
98+
Shortcut for ``bot.answerPreCheckoutQuery(update.pre_checkout_query.id, *args, **kwargs)``
99+
"""
98100
return self.bot.answerPreCheckoutQuery(self.id, *args, **kwargs)

0 commit comments

Comments
 (0)