Пример #1
0
def get_group(message):
    group_id = Group.get_id_by_group(message.text)

    if group_id is False:
        bot.clear_step_handler_by_chat_id(message.from_user.id)
        bot.send_message(chat_id=message.from_user.id,
                         text='Вибери свою групу:')

        bot.register_next_step_handler_by_chat_id(message.from_user.id,
                                                  get_group)
    else:
        student = Student()
        student.id = message.from_user.id
        student.username = message.from_user.username
        student.group_id = group_id

        message = bot.send_message(chat_id=message.from_user.id,
                                   text='Введи ПІБ українською мовою')
        bot.register_next_step_handler(message, get_name, student)
Пример #2
0
def add_another_fac(message):
    Student.add_student(
        Student(id=message.from_user.id,
                username=message.from_user.username,
                group_id=Group.get_id_by_group('other')))