def tech_yes_no( update, context ): # takes the answer from tech_q(about tech question) and (if answer for tech_q is yes) lang = language( update ) # returns the answer for prototype question(yes or no) or (if answer for tech_q is no) answer = update.message.text # returns the answer for education question if answer == c.text['yes'][lang] or answer == c.text['try_again'][lang]: reply_keyboard = [[c.text['yes'][lang], c.text['no'][lang]]] markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True, one_time_keyboard=True) update.message.reply_text(text=c.text['startup_q']['prototype'][lang], reply_markup=markup) return PROTOTYPE_YES_NO elif answer == c.text['no'][lang]: reply_keyboard = [[c.text['yes'][lang], c.text['no'][lang]]] markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True, one_time_keyboard=True) update.message.reply_text(text=c.text['startup_q']['edu'][lang], reply_markup=markup) return EDU_YES_NO else: return unknown_command(update, context)
def fantastic_yes_no( update, context ): # if the answer to fantastic question is no, it means that the project is not lang = language(update) # related to the space at all answer = update.message.text if answer == c.text['yes'][lang]: reply_keyboard = [[c.text['yes'][lang], c.text['no'][lang]]] markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True, one_time_keyboard=True) update.message.reply_text(text=c.text['startup_q']['prototype'][lang], reply_markup=markup) return PROTOTYPE_YES_NO elif answer == c.text['no'][lang]: reply_keyboard = [[ c.text['to_main_menu'][lang], c.text['try_again'][lang] ]] markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True, one_time_keyboard=True) update.message.reply_text(text=c.text['startup_ans']['fourth'][lang], reply_markup=markup) return TRY_AGAIN_OR_MM else: return unknown_command(update, context)
def try_again_or_mm(update, context): # try again(go to question about tech) or move to main menu lang = language(update) answer = update.message.text if answer == c.text['try_again'][lang]: return tech_yes_no(update, context) elif answer == c.text['to_main_menu'][lang]: return main_menu(update, context) else: return unknown_command(update, context)
def about_yangel_handler(update, context): lang = language(update) answer = update.message.text if answer == c.text['first_menu']['first_option'][lang]: return main_menu(update, context) elif answer == c.text['first_menu']['second_option'][lang]: update.message.reply_text(text='http://yangelspace.tech') else: return unknown_command(update, context)
def about_yangel_handler(update, context): lang = language(update) answer = update.message.text if answer == c.text['first_menu']['first_option'][lang]: return main_menu(update, context) elif answer == c.text['first_menu']['second_option'][lang]: context.bot.send_message(text='http://www.nkau.gov.ua', chat_id=update.effective_chat.id) else: return unknown_command(update, context)
def q_round_yes_no(update, context): lang = language(update) answer = update.message.text if answer == c.text['yes'][lang]: context.bot.send_message(chat_id=update.effective_chat.id, text=c.text['startup_ans']['fifth'][lang]) update.message.reply_text(text=c.text['startup_blank_q']['name'][lang], reply_markup=ReplyKeyboardRemove()) return STARTUPER_NAME ##################################### fill the blank elif answer == c.text['to_main_menu'][lang]: return main_menu(update, context) else: return unknown_command(update, context)
def partner_handler(update, context): lang = language(update) answer = update.message.text if answer == c.text['partner_opt'][lang]: context.bot.send_message(chat_id=update.effective_chat.id, text=c.text['partner_q']['answer'][lang]) update.message.reply_text(text=c.text['partner_q']['name'][lang], reply_markup=ReplyKeyboardRemove()) return PARTNER_NAME elif answer == c.text['to_main_menu'][lang]: return main_menu(update, context) else: return unknown_command(update, context)
def startuper_final_q(update, context): lang = language(update) answer = update.message.text chat_id = update.effective_chat.id save_user(chat_id) if answer == c.text['final_option'][lang]: context.bot.send_message(text=c.text['final_answer'][lang], chat_id=update.effective_chat.id) return main_menu(update, context) elif answer == c.text['to_main_menu'][lang]: return main_menu(update, context) else: return unknown_command(update, context)
def tech_q(update, context): #takes the answer from the prev question, if answer is 'let's go' - makes two buttons: yes lang = language(update) # or no, and sends the next question, then returns the answer of this question answer = update.message.text if answer == c.text['lets_go'][lang]: context.bot.send_message(chat_id=update.effective_chat.id, text=c.text['startup_ans']['first'][lang]) reply_keyboard = [[c.text['yes'][lang], c.text['no'][lang]]] markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True)#, one_time_keyboard=True) update.message.reply_text(text=c.text['startup_q']['tech'][lang], reply_markup=markup) return TECH_YES_NO elif answer == c.text['back'][lang]: return main_menu(update, context) else: return unknown_command(update, context)
def admin_handler(update, context): lang = language(update) answer = update.message.text if answer == c.text['options_admin']['push'][lang]: update.message.reply_text(text=c.text['push_text_q'][lang], reply_markup=ReplyKeyboardRemove()) return PUSH_TEXT elif answer == c.text['options_admin']['stats'][lang]: return stats_handler(update, context) elif answer == c.text['to_main_menu'][lang]: return main_menu(update, context) else: return unknown_command(update, context)
def edu_yes_no(update, context): lang = language(update) answer = update.message.text if answer == c.text['yes'][lang]: reply_keyboard = [[c.text['yes'][lang], c.text['no'][lang]]] markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True)#, one_time_keyboard=True) update.message.reply_text(text=c.text['startup_q']['prototype'][lang], reply_markup=markup) return PROTOTYPE_YES_NO elif answer == c.text['no'][lang]: reply_keyboard = [[c.text['yes'][lang], c.text['no'][lang]]] markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True)#, one_time_keyboard=True) update.message.reply_text(text=c.text['startup_q']['fantastic'][lang], reply_markup=markup) return FANTASTIC_YES_NO else: return unknown_command(update, context)
def proto_yes_no(update, context): lang = language(update) answer = update.message.text if answer == c.text['yes'][lang]: reply_keyboard = [[c.text['yes'][lang], c.text['no'][lang]]] markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True)#, one_time_keyboard=True) update.message.reply_text(text=c.text['startup_q']['team'][lang], reply_markup=markup) return TEAM_YES_NO elif answer == c.text['no'][lang]: reply_keyboard = [[c.text['to_main_menu'][lang], c.text['try_again'][lang]]] markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True)#, one_time_keyboard=True) update.message.reply_text(text=c.text['startup_ans']['second'][lang], reply_markup=markup) return TRY_AGAIN_OR_MM else: return unknown_command(update, context)
def team_yes_no(update, context): lang = language(update) answer = update.message.text if answer == c.text['yes'][lang]: reply_keyboard = [[c.text['yes'][lang], c.text['to_main_menu'][lang]]] markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True) update.message.reply_text(text=c.text['startup_q']['q_round'][lang], reply_markup=markup) return Q_ROUND_YES_NO elif answer == c.text['no'][lang]: reply_keyboard = [[c.text['to_main_menu'][lang], c.text['try_again'][lang]]] markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True) update.message.reply_text(text=c.text['startup_ans']['third'][lang], reply_markup=markup) return TRY_AGAIN_OR_MM # try again(go to question about tech) or move to main menu else: return unknown_command(update, context)
def main_menu_handler(update, context): lang = language(update) answer = update.message.text if answer == c.text['main_menu']['first_option'][lang]: return about_yangel(update, context) elif answer == c.text['main_menu']['second_option'][lang]: return startup(update, context) elif answer == c.text['main_menu']['third_option'][lang]: return mentor(update, context) elif answer == c.text['main_menu']['fourth_option'][lang]: return partner(update, context) elif answer == c.text['main_menu']['fifth_option'][lang]: update.message.reply_text(text=random_fact()) else: return unknown_command(update, context)
def push_who(update, context): lang = language(update) answer = update.message.text if answer == c.text['options_admin']['all'][lang]: users_ids = DB.get_users() return push_handler(update, context, users_ids) elif answer == c.text['options_admin']['startup'][lang]: users_ids = DB.get_users('STARTUP') return push_handler(update, context, users_ids) elif answer == c.text['options_admin']['mentor'][lang]: users_ids = DB.get_users('MENTOR') return push_handler(update, context, users_ids) elif answer == c.text['options_admin']['partner'][lang]: users_ids = DB.get_users('PARTNER') return push_handler(update, context, users_ids) else: return unknown_command(update, context)
def admin_handler(update, context): lang = language(update) answer = update.message.text if answer == c.text['options_admin']['push'][lang]: update.message.reply_text(text=c.text['push_text_q'][lang], reply_markup=ReplyKeyboardRemove()) return PUSH_TEXT elif answer == c.text['options_admin']['stats'][lang]: return stats_handler(update, context) elif answer == c.text['options_admin']['update'][lang]: facts = updateFact() msg = c.text['options_admin']['update_text'][lang] update.message.reply_text(msg.format(facts=facts), disable_web_page_preview=True) elif answer == c.text['to_main_menu'][lang]: return main_menu(update, context) else: return unknown_command(update, context)