def get_settings_text(user_id, lang_code): user = get_person(user_id) text = strings.get(get_language(lang_code)).get("settings").format(num_of_words=user["word_count"], prefixes=strings.get(get_language(lang_code)).get("yes") if user["prefixes"] else strings.get(get_language(lang_code)).get("no"), separators=strings.get(get_language(lang_code)).get("yes") if user["separators"] else strings.get(get_language(lang_code)).get("no")) return text
def get_settings_text(user_id, lang_code): user = get_person(user_id) text = strings.get(get_language(lang_code)).get("settings").format( num_of_words=user["word_count"], prefixes=strings.get(get_language(lang_code)).get("yes") if user["prefixes"] else strings.get(get_language(lang_code)).get("no"), separators=strings.get(get_language(lang_code)).get("yes") if user["separators"] else strings.get(get_language(lang_code)).get("no")) return text
def make_regenerate_keyboard(lang_code): keyboard = types.InlineKeyboardMarkup() btn = types.InlineKeyboardButton(text=strings.get( get_language(lang_code)).get("regenerate"), callback_data="regenerate") keyboard.add(btn) return keyboard
def make_settings_keyboard_for_user(user_id, lang_code): """ Prepare keyboard for user based on his settings :param user_id: User ID in Telegram :return: Inline Keyboard object """ user = dbworker.get_person(user_id) kb = types.InlineKeyboardMarkup() wrds_lst = [] if user["word_count"] >= (config.length_min + 1): wrds_lst.append(types.InlineKeyboardButton(text=strings.get(get_language(lang_code)).get("minusword"), callback_data="minus_word")) if user["word_count"] <= (config.length_max - 1): wrds_lst.append(types.InlineKeyboardButton(text=strings.get(get_language(lang_code)).get("plusword"), callback_data="plus_word")) kb.add(*wrds_lst) if user["prefixes"]: kb.add(types.InlineKeyboardButton(text=strings.get(get_language(lang_code)).get("minuspref"), callback_data="disable_prefixes")) else: kb.add(types.InlineKeyboardButton(text=strings.get(get_language(lang_code)).get("pluspref"), callback_data="enable_prefixes")) if user["separators"]: kb.add(types.InlineKeyboardButton(text=strings.get(get_language(lang_code)).get("minussep"), callback_data="disable_separators")) else: kb.add(types.InlineKeyboardButton(text=strings.get(get_language(lang_code)).get("plussep"), callback_data="enable_separators")) return kb
def make_settings_keyboard_for_user(user_id, lang_code): """ Prepare keyboard for user based on his settings :param user_id: User ID in Telegram :return: Inline Keyboard object """ user = dbworker.get_person(user_id) kb = types.InlineKeyboardMarkup() wrds_lst = [] if user["word_count"] >= (config.length_min + 1): wrds_lst.append( types.InlineKeyboardButton(text=strings.get( get_language(lang_code)).get("minusword"), callback_data="minus_word")) if user["word_count"] <= (config.length_max - 1): wrds_lst.append( types.InlineKeyboardButton(text=strings.get( get_language(lang_code)).get("plusword"), callback_data="plus_word")) kb.add(*wrds_lst) if user["prefixes"]: kb.add( types.InlineKeyboardButton(text=strings.get( get_language(lang_code)).get("minuspref"), callback_data="disable_prefixes")) else: kb.add( types.InlineKeyboardButton(text=strings.get( get_language(lang_code)).get("pluspref"), callback_data="enable_prefixes")) if user["separators"]: kb.add( types.InlineKeyboardButton(text=strings.get( get_language(lang_code)).get("minussep"), callback_data="disable_separators")) else: kb.add( types.InlineKeyboardButton(text=strings.get( get_language(lang_code)).get("plussep"), callback_data="enable_separators")) return kb
def cmd_help(message): bot.send_message(message.chat.id, strings.get(get_language(message.from_user.language_code)).get("help"), parse_mode="HTML") if config.botan_id: botan.track(config.botan_api_key, message.chat.id, message, 'Help') return
def make_regenerate_keyboard(lang_code): keyboard = types.InlineKeyboardMarkup() btn = types.InlineKeyboardButton(text=strings.get(get_language(lang_code)).get("regenerate"), callback_data="regenerate") keyboard.add(btn) return keyboard
async def cmd_help(message: types.Message): await message.answer( strings.get(get_language(message.from_user.language_code)).get("help"))
def cmd_help(message): bot.send_message(message.chat.id, strings.get(get_language( message.from_user.language_code)).get("help"), parse_mode="HTML")