def github_help(self, chat_id): msg = "Модуль для работы с сервисом GitHub.\n\n- Оповещения о новых Push-событиях\n- Оповещения о создании Pull-реквестов\n- Оповещения о создании Issues" repositories = Github_repositories.select().where(Github_repositories.chat_id == chat_id) if not len(repositories): msg += "\n\nВ данный момент модуль не активирован.\n\nДля настройки модуля, используйте команду /github_start" else: msg += "\n\nПодключенные репозитории.\n\n" for repository in repositories: msg += "%s\n" % repository.repository_name msg += "\nДля отключения репозитория используйте команду /github_stop\n" \ "Подключить еще один репозиторий можно с помощью команды /github_start\n\n" \ "Меню модуля: /github_help" return msg
def github_stop(self, chat_id): repositories = Github_repositories.select().where(Github_repositories.chat_id == chat_id) if not len(repositories): send_to_chat("У вас не подключено ни одного репозитория.", chat_id) else: buttons = [ { 'text': repository.repository_name, 'callback_data': "/github_delete%s" % str(repository.repository_id) } for repository in repositories ] print(buttons) send_object_to_chat("Выберите репозиторий, который хотите отключить.\n", json.dumps({ 'inline_keyboard': [ buttons ] }), chat_id)