def stat_start_menu(): kb = [[ Button("{} Статистика по вечерам".format(em("")), callback_data="") ], [Button("{} Статистика по играм".format(em("")), callback_data="")], [Button("{} Поменять город".format(em("")), callback_data="")]] return Markup(kb)
def start_user(): return Markup([[ Button("{0} Открыть статистику".format(em(":open_file_folder:")), callback_data="UserOpenStatistic") ], [ Button("{0} Запросить доступ".format( em(":question:")), callback_data="GetPermissions") ]])
def statistic_reply(cls): kb = [[ Button("{} Игры".format(em(":memo:")), callback_data="OpenGameStat") ], [ Button("{} Вечера".format(em(":last_quarter_moon:")), callback_data="OpenEveningStat") ]] return Markup(kb)
def contagem(num: int): cabecalho(46, "Contagem Regressiva!") print( em(':partying_face::partying_face: Festa de Fim de Ano :party_popper::party_popper:\n\n' )) for k in range(10, 0, -1): if (k == 10): print(em(f' -{k} - '.center(30, em(':raising_hands:')))) else: print(em(f' - {k} - '.center(30, em(':raising_hands:')))) sleep(1)
def regular_members(self): members = [] for member in self._session.db.get_regular_members( self._session.host.id): if member.id not in self._session.evening.members.keys(): members.append(member) if len(members) == 0: return KBF.button(em(":no_good:"), "close") return KBF.players(members, "_add", em(":heavy_plus_sign:")) + KBF.button( em(":x:"), "close")
def main(): return Markup([[ Button("{} Начать вечер".format(em(":hourglass:")), callback_data='start_evening') ], [ Button("{} Меню рейтинга".format(em(":bar_chart:")), callback_data='statistic_menu') ], [ Button("{} Меню игроков".format(em(":paperclip:")), callback_data='players_menu') ]])
def _choose_member_callback(self, data): member = data.split('.')[1] self._session.evening.add_member(member) self._session.bot.send_message( self._session.t_id, text="Игрок добавлен. \n Введите следующего или нажмите '{}' вверху." .format(em(":+1:")))
def _choose_member(self, request_result): self._session.bot.send_message( self._session.t_id, text= "Под ваш запрос подходит несколько игроков. Ввыберите подходящее", reply_markup=KBF.choose("choose_member", [ em(":bust_in_silhouette:") + str(member.id) + ":" + member.name for member in request_result ]))
def get_member_statistic_format(self, t_id): result = "" emoji = { Statistic.Date: em(":date:"), Statistic.Location: em(":round_pushpin:"), Statistic.Role: '🎭', Statistic.Card: em(":black_joker:"), Statistic.Result: em(":dart:") } for game in self.get_member_statistic(t_id): for stat in Statistic: if stat == Statistic.Date: game[stat] = "{}.{}.{}".format(game[stat].day, game[stat].month, game[stat].year) result += emoji[stat] + ": " + game[stat] + "\n" result += '\n' return result
def players(cls, members, postfix="", emoji=None): kb = [] if emoji is None: emoji = em(":x:") id_postfix = "" if isinstance(postfix, tuple) and len(postfix) > 1: id_postfix = postfix[0] postfix = postfix[1] if isinstance(emoji, list) and len(emoji) < len(members): emoji = em(":x:") if isinstance(members, dict): members = members.values() for member in members: kb.append([ Button(member.name, callback_data=str(member.id) + id_postfix), Button((emoji if not isinstance(emoji, list) else em(emoji.pop())), callback_data=str(member.id) + postfix) ]) return Markup(kb)
def fireworks(): system('clear') cabecalho(46, "Contagem Regressiva!") print(em(':balloon::balloon::balloon:')) sleep(0.5) print(em(':sparkles::sparkles::sparkles::sparkles:')) sleep(0.5) print(em(':fireworks::fireworks::fireworks::fireworks::fireworks:')) sleep(0.5) print( em(':eight-pointed_star: :eight-pointed_star: :eight-pointed_star: :eight-pointed_star: :eight-pointed_star: :eight-pointed_star:' )) sleep(0.5) print(em(':fireworks::fireworks::fireworks::fireworks::fireworks:')) sleep(0.5) print(em(':sparkles::sparkles::sparkles::sparkles:')) sleep(0.5) print(em(':balloon::balloon::balloon:')) sleep(1) print('FELIZ ANO NOVO!!!') sleep(2)
def process_callback(self, bot, update): data = get_query_text(update) if data == "end_evening_adding_approve": if self._session.evening.is_ready(): self._session.bot.delete_message(self._session.t_id, self._message.message_id) members = [ "{} {} \n".format(em(":bust_in_silhouette:"), member.name) for member in self._session.evening.members.values() ] self._session.send_message("Игроки: \n{}".format( "".join(members))) self._next = CalculationOfPlayers return True else: self._update_players_message() self._session.send_message("Не хватает участников") elif data.isdigit(): # ID for delete from evening self._remove_member_callback(data) elif len(data) > 4 and data[:-4].isdigit(): # ID to add to evening self._add_member_callback(data, update) elif data == "open_regular": self._open_regular_callback() elif data == "close": self._session.bot.delete_message( self._session.t_id, update.effective_message.message_id) elif data.find("choose_member.") != -1: self._choose_member_callback(data)
def _open_regular_callback(self): self._session.send_message(em(':necktie: Ваши постоянные игроки'), reply_markup=self.regular_members) self._update_players_message()
def approve(cls, param): return Markup([[Button(em(":ok:"), callback_data=param + "_approve")]])