bot.py
def message_handler(call):
    """If the bot state for a message/call sender is QUESTION2.

       if call.data is 'done', switch to the SURVEY1 state, send the assigned answer
       and the 'Create Survey' markup.

       elif call.data is 'next', insert a new row into the questions table,
       switch to the QUESTION1 state. send the assigned answer.

       elif call.data is 'delete', delete the latest question,
       switch to the QUESTION1 state. send the assigned answer. """
    bot.answer_callback_query(call.id)

    markup = telebot.types.InlineKeyboardMarkup()

    if call.data == 'done':
        state.save_state(call, state.states['SURVEY1'])
        ans = answers['NAME_CREATE']
        markup.add(telebot.types.InlineKeyboardButton('Create Survey', callback_data='create survey'))
        bot.send_message(call.message.chat.id, ans, parse_mode='HTML', reply_markup=markup)
    elif call.data == 'next':
        survey.survey_next(call)
        state.save_state(call, state.states['QUESTION1'])
        ans = answers['NEXT_Q']
        bot.send_message(call.message.chat.id, ans, parse_mode='HTML')
    elif call.data == 'delete':
        qa.question_null(call)
        state.save_state(call, state.states['QUESTION1'])
        ans = answers['DELETED1']
        bot.send_message(call.message.chat.id, ans, parse_mode='HTML')
If the bot state for a message/call sender is QUESTION2.

       if call.data is 'done', switch to the SURVEY1 state, send the assigned answer
       and the 'Create Survey' markup.

       elif call.data is 'next', insert a new row into the questions table,
       switch to the QUESTION1 state. send the assigned answer.

       elif call.data is 'delete', delete the latest question,
       switch to the QUESTION1 state. send the assigned answer. 
If the bot state for a message/call sender is QUESTION2.
if call.data is 'done', switch to the SURVEY1 state, send the assigned answer
and the 'Create Survey' markup.

elif call.data is 'next', insert a new row into the questions table,
switch to the QUESTION1 state. send the assigned answer.

elif call.data is 'delete', delete the latest question,
switch to the QUESTION1 state. send the assigned answer.
If the bot state for a message / call sender is QUESTION2 . if call . data is ' done ' switch to the SURVEY1 state send the assigned answer and the ' Create Survey ' markup . elif call . data is ' next ' insert a new row into the questions table switch to the QUESTION1 state . send the assigned answer . elif call . data is ' delete ' delete the latest question switch to the QUESTION1 state . send the assigned answer .
def message_handler(call):
    bot.answer_callback_query(call.id)
    markup = telebot.types.InlineKeyboardMarkup()
    if call.data == 'done':
        state.save_state(call, state.states['SURVEY1'])
        ans = answers['NAME_CREATE']
        markup.add(telebot.types.InlineKeyboardButton('Create Survey', callback_data='create survey'))
        bot.send_message(call.message.chat.id, ans, parse_mode='HTML', reply_markup=markup)
    elif call.data == 'next':
        survey.survey_next(call)
        state.save_state(call, state.states['QUESTION1'])
        ans = answers['NEXT_Q']
        bot.send_message(call.message.chat.id, ans, parse_mode='HTML')
    elif call.data == 'delete':
        qa.question_null(call)
        state.save_state(call, state.states['QUESTION1'])
        ans = answers['DELETED1']
        bot.send_message(call.message.chat.id, ans, parse_mode='HTML')
def message_handler ( call ) : bot . answer_callback_query ( call . id ) markup = telebot . types . InlineKeyboardMarkup ( ) if call . data == 'done' : state . save_state ( call , state . states [ 'SURVEY1' ] ) ans = answers [ 'NAME_CREATE' ] markup . add ( telebot . types . InlineKeyboardButton ( 'Create Survey' , callback_data = 'create survey' ) ) bot . send_message ( call . message . chat . id , ans , parse_mode = 'HTML' , reply_markup = markup ) elif call . data == 'next' : survey . survey_next ( call ) state . save_state ( call , state . states [ 'QUESTION1' ] ) ans = answers [ 'NEXT_Q' ] bot . send_message ( call . message . chat . id , ans , parse_mode = 'HTML' ) elif call . data == 'delete' : qa . question_null ( call ) state . save_state ( call , state . states [ 'QUESTION1' ] ) ans = answers [ 'DELETED1' ] bot . send_message ( call . message . chat . id , ans , parse_mode = 'HTML' )
If the bot state for a message/call sender is QUESTION2.
If the bot state for a message / call sender is QUESTION2 .
"""If the bot state for a message/call sender is QUESTION2.

       if call.data is 'done', switch to the SURVEY1 state, send the assigned answer
       and the 'Create Survey' markup.

       elif call.data is 'next', insert a new row into the questions table,
       switch to the QUESTION1 state. send the assigned answer.

       elif call.data is 'delete', delete the latest question,
       switch to the QUESTION1 state. send the assigned answer. """
call