first
This commit is contained in:
30
Keyboard.py
Normal file
30
Keyboard.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
|
||||
|
||||
|
||||
class Keyboard:
|
||||
|
||||
def __init__(self):
|
||||
self.keyboard = []
|
||||
self.options = []
|
||||
|
||||
def get_keyboard(self):
|
||||
return self.keyboard
|
||||
|
||||
def add_to_keyboard(self, data: InlineKeyboardButton | list):
|
||||
self.keyboard.append(data)
|
||||
|
||||
def clear_keyboard(self):
|
||||
self.keyboard = []
|
||||
|
||||
def create_keyboard(self):
|
||||
return InlineKeyboardMarkup(self.get_keyboard())
|
||||
|
||||
def add_option(self, key, value):
|
||||
self.options.append({key: value})
|
||||
|
||||
def get_option(self, key: str):
|
||||
for option in self.options:
|
||||
if key in option:
|
||||
return option[key]
|
||||
|
||||
return None
|
Reference in New Issue
Block a user