Exemplo n.º 1
0
def process_answer(user, text, data):
    if data == 'flights':
        bot.send_message(user, config.main_menu)
    if data == 'main':
        bot.send_message(user, text='Основное меню', reply_markup=markups.main_menu())
    if data == 'today':
        user_data[user] = 'today'
        bot.send_message(user, text='.' + text + '.' + ' Сегодня', reply_markup=markups.arr_dep())
    if data == 'tomorrow':
        user_data[user] = 'tomorrow'
        bot.send_message(user, text='.' + text + '.' + ' Завтра', reply_markup=markups.arr_dep())
    if data == 'arrival':
        user_orient[user] = 'arrival'
        end_answer(user)
    if data == 'departure':
        user_orient[user] = 'departure'
        end_answer(user)
    if data.find('subscribe') != -1:
        flight_id = data.replace('subscribe ', '')
        is_subscribe = sql_queries.check_subscribe(user, flight_id)
        if not is_subscribe:
            sql_queries.add_subscribe(user, flight_id)
            bot.send_message(user, text='Успешная подписка', reply_markup=markups.suc_subscribe())
        else:
            bot.send_message(user, text='Вы уже подписаны на этот рейс', reply_markup=markups.suc_subscribe())
    if data == 'del_sub':
        sql_queries.del_sub(user)
        bot.send_message(user, text='Подписки удалены', reply_markup=markups.main_menu())
Exemplo n.º 2
0
def handle_quit(message):
    dia = Dialogue(user_id=message.from_user.id)
    user2 = dia.get_interlocutor(user_id=message.from_user.id)
    base.inc_user_dia((message.from_user.id))
    base.delete_dialogue((message.from_user.id))
    bot.send_message(message.chat.id,
                     base.get_text((1))[-1],
                     reply_markup=markups.main_menu())
    bot.send_message(user2.user_id,
                     base.get_text((1))[-1],
                     reply_markup=markups.main_menu())
Exemplo n.º 3
0
def handle_help(message):
    if base.check(message.from_user.id):
        bot.send_message(message.chat.id, base.get_text((10))[-1][0])
    else:
        bot.send_message(message.chat.id,
                         base.get_text((1))[-1][0],
                         reply_markup=markups.main_menu())
Exemplo n.º 4
0
def get_3_answer(message):
    db.execute(
        "UPDATE users_table SET interests = '{0}' WHERE user_id = '{1}'".
        format(message.text, message.from_user.id))
    print(base.get_text(8))
    bot.send_message(message.chat.id,
                     base.get_text((8))[-1],
                     reply_markup=markups.main_menu())
Exemplo n.º 5
0
def smk_back(update, context):
    chat_id = update.callback_query.from_user.id
    message_id = update.callback_query.message.message_id
    first_name = update.callback_query.from_user.first_name
    context.bot.send_chat_action(chat_id=chat_id, action=CHATACTION_TYPING)
    time.sleep(0.5)
    context.bot.send_message(chat_id=chat_id,
                             reply_markup=mrk.main_menu(),
                             text='Что вы хотите узнать ?')
    context.bot.delete_message(chat_id=chat_id, message_id=message_id)
Exemplo n.º 6
0
def back_to_main(call):
	user_id = call.message.chat.id
	name = dbase.get_user_name(user_id)
	msg = salutation(name)
	if dbase.check_user_pmtable(user_id):
		bot.delete_message(call.message.chat.id, call.message.message_id)
		bot.send_message(user_id, text=msg,
						 reply_markup=markup.main_menu())
	elif dbase.check_user_devtable(user_id):
		bot.delete_message(call.message.chat.id, call.message.message_id)
		bot.send_message(user_id, text=msg,
						 reply_markup=markup.main_menu_dev())
Exemplo n.º 7
0
def text_msg(update, context):
    chat_id = update.message.chat_id
    first_name = update.message.chat.first_name
    text = update.message.text.lower()
    if text == '🇷🇺русский':
        context.bot.send_message(chat_id,
                                 '.',
                                 reply_markup=mrk.ReplyKeyboardRemove())
        context.bot.delete_message(chat_id, update.message.message_id + 1)
        context.bot.send_message(chat_id=chat_id,
                                 reply_markup=mrk.main_menu(),
                                 text='No онгличанс!')
    else:
        context.bot.send_message(chat_id=chat_id, text='1')
Exemplo n.º 8
0
def start(message):
	# dbase.delete_duplicate_from_schedule()
	dbase.del_unuse_rows()
	result = dbase.check_user_exist_pir(message.chat.id)
	if result is True:
		name = dbase.get_user_name(message.chat.id)
		msg = salutation(name)
		if dbase.check_user_pmtable(message.chat.id):
			dict_flag_role_pm[message.chat.id] = True
			bot.send_message(message.chat.id, text=msg,
							 reply_markup=markup.main_menu())
		elif dbase.check_user_devtable(message.chat.id):
			dict_flag_role_pm[message.chat.id] = False
			bot.send_message(message.chat.id, text=msg,
							 reply_markup=markup.main_menu_dev())
		else:
			bot.send_message(message.chat.id, name + ", ваша роль в компании пока не определена!",
							 reply_markup=markup.myrolle())

	else:
		txt = "Здраствуйте!\nПрежде, чем мы начнем, авторизуйтесь.\n"
		bot.send_message(message.chat.id, text=txt,
						 reply_markup=markup.reg_button())
Exemplo n.º 9
0
def send_welcome(message):
    bot.send_message(message.from_user.id, text=u'\u2139\ufe0f' + 'Основное меню', reply_markup=markups.main_menu())
Exemplo n.º 10
0
def handle_yes(call):
    bot.send_message(call.message.chat.id,
                     base.get_text((9))[-1][0],
                     reply_markup=markups.main_menu())