Skip to content

Commit

Permalink
Working PROTOTYPE
Browse files Browse the repository at this point in the history
  • Loading branch information
torrua committed Dec 11, 2024
1 parent 851d40d commit 3c81b79
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions app/bot/telegram/keyboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,8 @@ def keyboard_show_hide(title: str, word_id: int, action_mark: str):

def combine_and_close(func):
def wrapper(self, *args, **kwargs):
# Call the original function to get the kb_combo list
kb_combo = func(self, *args, **kwargs)

# Append kb_close() to the list
kb_combo.append(kb_close())

# Combine the keyboard buttons
return Keyboa.combine(tuple(kb_combo))

return wrapper
Expand Down Expand Up @@ -248,12 +243,6 @@ def get_kb_afx_show(self):

return kb_combo

def get_default_keyboard(self):
if self.word.type.parentable:
return self.get_default_kb_for_parentable()
else:
return self.get_default_kb_for_predy()

@combine_and_close
def get_default_kb_for_predy(self):
kb_combo = []
Expand Down Expand Up @@ -281,3 +270,9 @@ def get_default_kb_for_parentable(self):
title_parent, self.word.id, Action.kb_pnt_show
)
return [kb_hide_parent]

def get_default_keyboard(self):
if self.word.type.parentable:
return self.get_default_kb_for_parentable()
else:
return self.get_default_kb_for_predy()

0 comments on commit 3c81b79

Please sign in to comment.