1
0
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:
Badiboy
2020-08-04 12:29:56 +03:00
parent 67fdb2f52e
commit a5fd407eb6
2 changed files with 8 additions and 4 deletions

View File

@ -11,8 +11,11 @@ import six
from telebot import util
DISABLE_KEYLEN_ERROR = False
logger = logging.getLogger('TeleBot')
class JsonSerializable(object):
"""
Subclasses of this class are guaranteed to be able to be converted to JSON format.
@ -813,7 +816,8 @@ class ReplyKeyboardMarkup(JsonSerializable):
def __init__(self, resize_keyboard=None, one_time_keyboard=None, selective=None, row_width=3):
if row_width > self.max_row_keys:
# Todo: Will be replaced with Exception in future releases
logger.error('Telegram does not support reply keyboard row width over %d.' % self.max_row_keys)
if not DISABLE_KEYLEN_ERROR:
logger.error('Telegram does not support reply keyboard row width over %d.' % self.max_row_keys)
row_width = self.max_row_keys
self.resize_keyboard = resize_keyboard
@ -839,7 +843,8 @@ class ReplyKeyboardMarkup(JsonSerializable):
if row_width > self.max_row_keys:
# Todo: Will be replaced with Exception in future releases
logger.error('Telegram does not support reply keyboard row width over %d.' % self.max_row_keys)
if not DISABLE_KEYLEN_ERROR:
logger.error('Telegram does not support reply keyboard row width over %d.' % self.max_row_keys)
row_width = self.max_row_keys
for row in util.chunks(args, row_width):