示例#1
0
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)
示例#2
0
def startuper_proto(update, context):
    lang = language(update)
    answer = update.message.text
    check = prototype_check(answer)
    if check:
        UM.currentUsers[update.effective_chat.id].add_prototype(answer)
        update.message.reply_text(text=c.text['startup_blank_q']['why_we'][lang], reply_markup=ReplyKeyboardRemove())
        return STARTUPER_WHY
    else:
        update.message.reply_text(text=c.text['errors']['proto'][lang], reply_markup=ReplyKeyboardRemove())
        return STARTUPER_PROTO
示例#3
0
def startuper_email(update, context):
    lang = language(update)
    answer = update.message.text
    check = email_check(answer)
    if check:
        UM.currentUsers[update.effective_chat.id].add_email(answer)
        update.message.reply_text(text=c.text['startup_blank_q']['idea'][lang], reply_markup=ReplyKeyboardRemove())
        return STARTUPER_IDEA
    else:
        update.message.reply_text(text=c.text['errors']['email'][lang], reply_markup=ReplyKeyboardRemove())
        return STARTUPER_EMAIL
示例#4
0
def partner_name(update, context):
    lang = language(update)
    answer = update.message.text
    check = name_check(answer)
    if check:
        UM.create_user(Partner(update.effective_chat.id, answer.title(), 'partner', update, context))
        update.message.reply_text(text=c.text['partner_q']['organization_name'][lang], reply_markup=ReplyKeyboardRemove())
        return PARTNER_ORG_NAME
    else:
        update.message.reply_text(text=c.text['errors']['name'][lang], reply_markup=ReplyKeyboardRemove())
        return PARTNER_NAME
示例#5
0
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)
示例#6
0
def startuper_name(update, context): # not finished
    lang = language(update)
    answer = update.message.text
    check = name_check(answer)
    if check:
        UM.create_user(Startuper(update.effective_chat.id, answer.title(), 'startuper', update, context))
        update.message.reply_text(text=c.text['startup_blank_q']['email'][lang], reply_markup=ReplyKeyboardRemove())
        return STARTUPER_EMAIL
    else:
        update.message.reply_text(text=c.text['errors']['name'][lang], reply_markup=ReplyKeyboardRemove())
        return STARTUPER_NAME
示例#7
0
def partner_org_name(update, context):
    lang = language(update)
    answer = update.message.text
    check = name_organisation_check(answer)
    if check:
        UM.currentUsers[update.effective_chat.id].add_organization_name(answer)
        update.message.reply_text(text=c.text['partner_q']['organization_position'][lang], reply_markup=ReplyKeyboardRemove())
        return PARTNER_ORG_POS
    else:
        update.message.reply_text(text=c.text['errors']['organization_name'][lang], reply_markup=ReplyKeyboardRemove())
        return PARTNER_ORG_NAME
示例#8
0
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)
示例#9
0
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)
示例#10
0
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)
示例#11
0
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)
示例#12
0
def mentor_expertise(update, context):
    lang = language(update)
    answer = update.message.text
    check = expertise_check(answer)
    if check:
        UM.currentUsers[update.effective_chat.id].add_expertise(answer)
        update.message.reply_text(text=c.text['mentor_q']['experience'][lang],
                                  reply_markup=ReplyKeyboardRemove())
        return MENTOR_EXPERIENCE
    else:
        update.message.reply_text(text=c.text['errors']['expertise'][lang],
                                  reply_markup=ReplyKeyboardRemove())
        return MENTOR_EXPERTISE
示例#13
0
def admin(update, context):
    lang = language(update)
    if update.message.chat.username in ('khmellevskyi', 'V_vargan'):
        reply_keyboard = [[
            c.text['options_admin']['push'][lang],
            c.text['options_admin']['stats'][lang]
        ], [c.text['to_main_menu'][lang]]]
        markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True)
        update.message.reply_text(text=c.text['hi_boss'][lang],
                                  reply_markup=markup)
        return ADMIN_HANDLER
    else:
        context.bot.send_message(chat_id=update.effective_chat.id,
                                 text=c.text['sorry_not_boss'][lang])
示例#14
0
def start(update, context):
    """Welcome greating and proposing to choose the language"""
    lang = language(update)
    DB.add_user(update.effective_chat.id)
    if update.effective_chat.id in UM.currentUsers:
        del UM.currentUsers[update.effective_chat.id]
    if lang == 1 or lang == 0:
        markup = ReplyKeyboardMarkup([[c.text['to_main_menu'][lang]]],
                                     resize_keyboard=True,
                                     one_time_keyboard=True)
        update.message.reply_text(text=c.text['welcome_back'][lang],
                                  reply_markup=markup)
        return MAIN_MENU
    else:
        return LANG
示例#15
0
def partner_email(update, context):
    lang = language(update)
    answer = update.message.text
    check = email_check(answer)
    if check:
        UM.currentUsers[update.effective_chat.id].add_email(answer)
        reply_keyboard = [[c.text['final_option'][lang], c.text['to_main_menu'][lang]]]
        markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True, one_time_keyboard=True)
        update.message.reply_text(text=c.text['partner_q']['final_q'][lang].
                                  format(name=UM.currentUsers[update.effective_chat.id].get_name()),
                                  reply_markup=markup)
        return PARTNER_FINAL_Q
    else:
        update.message.reply_text(text=c.text['errors']['email'][lang], reply_markup=ReplyKeyboardRemove())
        return PARTNER_EMAIL
示例#16
0
def mentor_name(update, context):
    lang = language(update)
    answer = update.message.text
    check = name_check(answer)
    if check:
        UM.create_user(
            Mentor(update.effective_chat.id, answer.title(), 'mentor', update,
                   context))
        update.message.reply_text(text=c.text['mentor_q']['expertise'][lang],
                                  reply_markup=ReplyKeyboardRemove())
        return MENTOR_EXPERTISE
    else:
        update.message.reply_text(text=c.text['errors']['name'][lang],
                                  reply_markup=ReplyKeyboardRemove())
        return MENTOR_NAME
示例#17
0
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)
示例#18
0
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)
示例#19
0
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)
示例#20
0
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)
示例#21
0
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)
示例#22
0
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)
示例#23
0
def startuper_why_we(update, context):
    lang = language(update)
    answer = update.message.text
    check = wdynp_check(answer)
    if check:
        UM.currentUsers[update.effective_chat.id].add_why_we(answer)
        reply_keyboard = [[c.text['final_option'][lang], c.text['to_main_menu'][lang]]]
        markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True)
        update.message.reply_text(text=c.text['startup_blank_q']['final_q'][lang].
                                  format(name=UM.currentUsers[update.effective_chat.id].get_name()),
                                  reply_markup=markup)
        
        return STARTUPER_FINAL_Q
    else:
        update.message.reply_text(text=c.text['errors']['why_we'][lang], 
                                        reply_markup=ReplyKeyboardRemove())
        return STARTUPER_WHY
示例#24
0
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)
示例#25
0
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)
示例#26
0
def push_text(update, context):
    global push_text_notification
    lang = language(update)
    push_text_notification = update.message.text
    reply_keyboard = [[
        c.text['options_admin']['all'][lang],
        c.text['options_admin']['startup'][lang]
    ],
                      [
                          c.text['options_admin']['mentor'][lang],
                          c.text['options_admin']['partner'][lang]
                      ]]
    markup = ReplyKeyboardMarkup(reply_keyboard,
                                 resize_keyboard=True,
                                 one_time_keyboard=True)
    update.message.reply_text(text=c.text['push_who_q'][lang],
                              reply_markup=markup)
    return PUSH_WHO
示例#27
0
def main_menu(update, context):
    lang = language(update)
    answer = update.message.text
    if (answer == c.text['back'][lang]
            or answer == c.text['to_main_menu'][lang]
            or answer == c.text['first_menu']['first_option'][lang]
            or answer == c.text['en'] or answer == c.text['ua']
            or answer == c.text['final_option'][lang]
            or answer == c.text['no'][lang] or answer == '/admin'):
        reply_keyboard = [[
            c.text['main_menu']['first_option'][lang],
            c.text['main_menu']['second_option'][lang]
        ],
                          [
                              c.text['main_menu']['third_option'][lang],
                              c.text['main_menu']['fourth_option'][lang]
                          ], [c.text['main_menu']['fifth_option'][lang]]]
        markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True)
        update.message.reply_text(text=c.text['help_ask'][lang],
                                  reply_markup=markup)
        return MAIN_MENU_HANDLER
    else:
        return unknown_command(update, context)
示例#28
0
def partner(update, context):
    lang = language(update)
    reply_keyboard = [[c.text['partner_opt'][lang], c.text['to_main_menu'][lang]]]
    markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True, one_time_keyboard=True)
    update.message.reply_text(text=c.text['partner'][lang], reply_markup=markup)
    return PARTNER_HANDLER
示例#29
0
 def notificate_user(update, context):
     lang = language(update)
     context.bot.send_message(chat_id=update.effective_chat.id,
                              text=c.text['timeout'][lang])
示例#30
0
def startup(update, context):
    lang = language(update)
    reply_keyboard = [[c.text['lets_go'][lang], c.text['back'][lang]]]
    markup = ReplyKeyboardMarkup(reply_keyboard, resize_keyboard=True)#, one_time_keyboard=True)
    update.message.reply_text(text=c.text['bb_startup'][lang], reply_markup=markup)
    return TECH_OR_MM # goes to tech_q