From 1bf00785731bcad431fa043be197895c185b9b85 Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 23 May 2017 16:21:45 +0800 Subject: [PATCH] add missing "need_email" in sendInvoice, fix pep8/flake --- telegram/bot.py | 8 +++++++- telegram/precheckoutquery.py | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/telegram/bot.py b/telegram/bot.py index 509d06456..60584bea4 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -1835,6 +1835,7 @@ class Bot(TelegramObject): photo_height=None, need_name=None, need_phone_number=None, + need_email=None need_shipping_address=None, is_flexible=None, disable_notification=False, @@ -1867,6 +1868,8 @@ class Bot(TelegramObject): the order need_phone_number (Optional[bool]): Pass True, if you require the user's phone number to complete the order + need_email (Optional[bool]): Pass True, if you require the user's email to + complete the order need_shipping_address (Optional[bool]): Pass True, if you require the user's shipping address to complete the order is_flexible (Optional[bool]): Pass True, if the final price depends on the shipping @@ -1915,6 +1918,8 @@ class Bot(TelegramObject): data['need_name'] = need_name if need_phone_number: data['need_phone_number'] = need_phone_number + if need_email: + data['need_email'] = need_email if need_shipping_address: data['need_shipping_address'] = need_shipping_address if is_flexible: @@ -2004,7 +2009,8 @@ class Bot(TelegramObject): """ - if (ok is not True and error_message is None) or (ok is True and error_message is not None): + if ((ok is not True and error_message is None) or + (ok is True and error_message is not None)): raise TelegramError( 'answerPreCheckoutQuery: If ok is True, there should ' 'not be error_message; if ok is False, error_message ' diff --git a/telegram/precheckoutquery.py b/telegram/precheckoutquery.py index 2cea2914a..75da849fa 100644 --- a/telegram/precheckoutquery.py +++ b/telegram/precheckoutquery.py @@ -94,5 +94,7 @@ class PreCheckoutQuery(TelegramObject): return data def answer(self, *args, **kwargs): - """Shortcut for ``bot.answerPreCheckoutQuery(update.pre_checkout_query.id, *args, **kwargs)``""" + """ + Shortcut for ``bot.answerPreCheckoutQuery(update.pre_checkout_query.id, *args, **kwargs)`` + """ return self.bot.answerPreCheckoutQuery(self.id, *args, **kwargs)