2015-07-09 03:33:13 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
|
2015-07-12 15:39:11 +02:00
|
|
|
from .replymarkup import ReplyMarkup
|
2015-07-09 03:33:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
class ReplyKeyboardMarkup(ReplyMarkup):
|
|
|
|
def __init__(self,
|
|
|
|
keyboard,
|
|
|
|
resize_keyboard=None,
|
|
|
|
one_time_keyboard=None,
|
|
|
|
selective=None):
|
|
|
|
self.keyboard = keyboard
|
|
|
|
self.resize_keyboard = resize_keyboard
|
|
|
|
self.one_time_keyboard = one_time_keyboard
|
|
|
|
self.selective = selective
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def de_json(data):
|
|
|
|
return ReplyKeyboardMarkup(keyboard=data.get('keyboard', None),
|
2015-07-09 04:38:07 +02:00
|
|
|
resize_keyboard=data.get(
|
|
|
|
'resize_keyboard', None
|
|
|
|
),
|
|
|
|
one_time_keyboard=data.get(
|
|
|
|
'one_time_keyboard', None
|
|
|
|
),
|
2015-07-09 03:33:13 +02:00
|
|
|
selective=data.get('selective', None))
|
|
|
|
|
2015-07-20 04:25:44 +02:00
|
|
|
def to_dict(self):
|
2015-07-20 04:06:04 +02:00
|
|
|
data = {'keyboard': self.keyboard}
|
2015-07-09 03:33:13 +02:00
|
|
|
if self.resize_keyboard:
|
2015-07-20 04:06:04 +02:00
|
|
|
data['resize_keyboard'] = self.resize_keyboard
|
2015-07-09 03:33:13 +02:00
|
|
|
if self.one_time_keyboard:
|
2015-07-20 04:06:04 +02:00
|
|
|
data['one_time_keyboard'] = self.one_time_keyboard
|
2015-07-09 03:33:13 +02:00
|
|
|
if self.selective:
|
2015-07-20 04:06:04 +02:00
|
|
|
data['selective'] = self.selective
|
|
|
|
return data
|