mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Bugfix and DISABLE_KEYLEN_ERROR
Bugfix and DISABLE_KEYLEN_ERROR to supress keyboard length errors.
This commit is contained in:
parent
67fdb2f52e
commit
a5fd407eb6
@ -11,7 +11,6 @@ from requests.exceptions import HTTPError, ConnectionError, Timeout
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from requests.packages.urllib3 import fields
|
from requests.packages.urllib3 import fields
|
||||||
|
|
||||||
format_header_param = fields.format_header_param
|
format_header_param = fields.format_header_param
|
||||||
except ImportError:
|
except ImportError:
|
||||||
format_header_param = None
|
format_header_param = None
|
||||||
@ -130,7 +129,7 @@ def _check_result(method_name, result):
|
|||||||
raise ApiInvalidJSONException(method_name, result)
|
raise ApiInvalidJSONException(method_name, result)
|
||||||
|
|
||||||
if not result_json['ok']:
|
if not result_json['ok']:
|
||||||
raise ApiTelegramException(msg, method_name, result, result_json)
|
raise ApiTelegramException(method_name, result, result_json)
|
||||||
|
|
||||||
return result_json
|
return result_json
|
||||||
|
|
||||||
|
@ -11,8 +11,11 @@ import six
|
|||||||
|
|
||||||
from telebot import util
|
from telebot import util
|
||||||
|
|
||||||
|
DISABLE_KEYLEN_ERROR = False
|
||||||
|
|
||||||
logger = logging.getLogger('TeleBot')
|
logger = logging.getLogger('TeleBot')
|
||||||
|
|
||||||
|
|
||||||
class JsonSerializable(object):
|
class JsonSerializable(object):
|
||||||
"""
|
"""
|
||||||
Subclasses of this class are guaranteed to be able to be converted to JSON format.
|
Subclasses of this class are guaranteed to be able to be converted to JSON format.
|
||||||
@ -813,6 +816,7 @@ class ReplyKeyboardMarkup(JsonSerializable):
|
|||||||
def __init__(self, resize_keyboard=None, one_time_keyboard=None, selective=None, row_width=3):
|
def __init__(self, resize_keyboard=None, one_time_keyboard=None, selective=None, row_width=3):
|
||||||
if row_width > self.max_row_keys:
|
if row_width > self.max_row_keys:
|
||||||
# Todo: Will be replaced with Exception in future releases
|
# Todo: Will be replaced with Exception in future releases
|
||||||
|
if not DISABLE_KEYLEN_ERROR:
|
||||||
logger.error('Telegram does not support reply keyboard row width over %d.' % self.max_row_keys)
|
logger.error('Telegram does not support reply keyboard row width over %d.' % self.max_row_keys)
|
||||||
row_width = self.max_row_keys
|
row_width = self.max_row_keys
|
||||||
|
|
||||||
@ -839,6 +843,7 @@ class ReplyKeyboardMarkup(JsonSerializable):
|
|||||||
|
|
||||||
if row_width > self.max_row_keys:
|
if row_width > self.max_row_keys:
|
||||||
# Todo: Will be replaced with Exception in future releases
|
# Todo: Will be replaced with Exception in future releases
|
||||||
|
if not DISABLE_KEYLEN_ERROR:
|
||||||
logger.error('Telegram does not support reply keyboard row width over %d.' % self.max_row_keys)
|
logger.error('Telegram does not support reply keyboard row width over %d.' % self.max_row_keys)
|
||||||
row_width = self.max_row_keys
|
row_width = self.max_row_keys
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user