Методология создания экспертной системы для Telegram-Бота
Технология разработки экспертных систем. Реализация ЭС для мобильных приложений. Описание библиотеки Fysom, используемой для реализации данных, в виде конечного автомата. Работа коллбэков в Fysom. Интерфейс и тестирование Telegram бота "Робот-Юрист".
Рубрика | Программирование, компьютеры и кибернетика |
Вид | дипломная работа |
Язык | русский |
Дата добавления | 29.03.2022 |
Размер файла | 4,3 M |
Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже
Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.
{'name': 'tradename3_to_tradename3_yes', 'src': 'tradename3', 'dst': 'tradename3_yes'},
{'name': 'selected_third', 'src': 'show_sections', 'dst': 'third1'},
{'name': 'third1_to_no', 'src': 'third1', 'dst': 'third1_no'},
{'name': 'third1_to_third2', 'src': 'third1', 'dst': 'third2'},
{'name': 'third2_to_no', 'src': 'third2', 'dst': 'third2_no'},
{'name': 'third2_to_third3', 'src': 'third2', 'dst': 'third3'},
{'name': 'third3_to_no', 'src': 'third3', 'dst': 'third3_no'},
{'name': 'third3_to_third4', 'src': 'third3', 'dst': 'third4'},
{'name': 'third4_to_third5', 'src': 'third4', 'dst': 'third5'},
{'name': 'third5_to_third6', 'src': 'third5', 'dst': 'third6'},
{'name': 'third6_to_third7', 'src': 'third6', 'dst': 'third7'},
{'name': 'third7_to_third8', 'src': 'third7', 'dst': 'third8'},
{'name': 'third8_to_third9', 'src': 'third8', 'dst': 'third9'},
{'name': 'third9_to_third10', 'src': 'third9', 'dst': 'third10'},
{'name': 'third10_to_third11', 'src': 'third10', 'dst': 'third11'},
{'name': 'third11_to_third12', 'src': 'third11', 'dst': 'third12'},
{'name': 'third12_to_third13', 'src': 'third12', 'dst': 'third13'},
{'name': 'third13_to_third14', 'src': 'third13', 'dst': 'third14'},
{'name': 'third14_to_third15', 'src': 'third14', 'dst': 'third15'},
{'name': 'third15_to_third16', 'src': 'third15', 'dst': 'third16'},
{'name': 'third16_to_third17', 'src': 'third16', 'dst': 'third17'},
{'name': 'third_4_16_to_no', 'src': src_third_4_16_no, 'dst': 'third_4_16_no'},
{'name': 'selected_fourth', 'src': 'show_sections', 'dst': 'fourth1'},
{'name': 'fourth1_to_no', 'src': 'fourth1', 'dst': 'fourth1_no'},
{'name': 'fourth1_to_fourth2', 'src': 'fourth1', 'dst': 'fourth2'},
{'name': 'fourth2_to_no', 'src': 'fourth2', 'dst': 'fourth1_no'},
{'name': 'fourth2_to_fourth3', 'src': 'fourth2', 'dst': 'fourth3'},
{'name': 'fourth3_to_no', 'src': 'fourth3', 'dst': 'fourth3_no'},
{'name': 'fourth3_to_fourth4', 'src': 'fourth3', 'dst': 'fourth4'},
{'name': 'fourth4_to_fourth5', 'src': 'fourth4', 'dst': 'fourth5'},
{'name': 'fourth5_to_fourth6', 'src': 'fourth5', 'dst': 'fourth6'},
{'name': 'fourth6_to_fourth7', 'src': 'fourth6', 'dst': 'fourth7'},
{'name': 'fourth7_to_fourth8', 'src': 'fourth7', 'dst': 'fourth8'},
{'name': 'fourth8_to_fourth9', 'src': 'fourth8', 'dst': 'fourth9'},
{'name': 'fourth9_to_fourth10', 'src': 'fourth9', 'dst': 'fourth10'},
{'name': 'fourth10_to_fourth11', 'src': 'fourth10', 'dst': 'fourth11'},
{'name': 'fourth11_to_fourth12', 'src': 'fourth11', 'dst': 'fourth12'},
{'name': 'fourth12_to_fourth13', 'src': 'fourth12', 'dst': 'fourth13'},
{'name': 'fourth13_to_fourth14', 'src': 'fourth13', 'dst': 'fourth14'},
{'name': 'fourth14_to_fourth15', 'src': 'fourth14', 'dst': 'fourth15'},
{'name': 'fourth15_to_fourth16', 'src': 'fourth15', 'dst': 'fourth16'},
{'name': 'fourth16_to_fourth17', 'src': 'fourth16', 'dst': 'fourth17'},
{'name': 'fourth17_to_fourth18', 'src': 'fourth17', 'dst': 'fourth18'},
{'name': 'fourth18_to_fourth19', 'src': 'fourth18', 'dst': 'fourth19'},
{'name': 'fourth19_to_fourth20', 'src': 'fourth19', 'dst': 'fourth20'},
{'name': 'fourth20_to_fourth21', 'src': 'fourth20', 'dst': 'fourth21'},
{'name': 'fourth_4_20_to_no', 'src': src_fourth_4_20_no, 'dst': 'fourth_4_20_no'},
{'name': 'selected_fifth', 'src': 'show_sections', 'dst': 'fifth1'},
{'name': 'fifth1_to_no', 'src': 'fifth1', 'dst': 'fifth1_no'},
{'name': 'fifth1_to_fifth2', 'src': 'fifth1', 'dst': 'fifth2'},
{'name': 'fifth2_to_no', 'src': 'fifth2', 'dst': 'fifth2_no'},
{'name': 'fifth2_to_fifth3', 'src': 'fifth2', 'dst': 'fifth3'},
{'name': 'fifth3_to_no', 'src': 'fifth3', 'dst': 'fifth2_no'},
{'name': 'fifth3_to_fifth4', 'src': 'fifth3', 'dst': 'fifth4'},
{'name': 'fifth4_to_no', 'src': 'fifth4', 'dst': 'fifth4_no'},
{'name': 'fifth4_to_fifth5', 'src': 'fifth4', 'dst': 'fifth5'},
{'name': 'fifth5_to_fifth6', 'src': 'fifth5', 'dst': 'fifth6'},
{'name': 'fifth6_to_fifth7', 'src': 'fifth6', 'dst': 'fifth7'},
{'name': 'fifth7_to_fifth8', 'src': 'fifth7', 'dst': 'fifth8'},
{'name': 'fifth8_to_fifth9', 'src': 'fifth8', 'dst': 'fifth9'},
{'name': 'fifth9_to_fifth10', 'src': 'fifth9', 'dst': 'fifth10'},
{'name': 'fifth10_to_fifth11', 'src': 'fifth10', 'dst': 'fifth11'},
{'name': 'fifth11_to_fifth12', 'src': 'fifth11', 'dst': 'fifth12'},
{'name': 'fifth12_to_fifth13', 'src': 'fifth12', 'dst': 'fifth13'},
{'name': 'fifth13_to_fifth14', 'src': 'fifth13', 'dst': 'fifth14'},
{'name': 'fifth14_to_fifth15', 'src': 'fifth14', 'dst': 'fifth15'},
{'name': 'fifth15_to_fifth16', 'src': 'fifth15', 'dst': 'fifth16'},
{'name': 'fifth16_to_fifth17', 'src': 'fifth16', 'dst': 'fifth17'},
{'name': 'fifth_5_16_to_no', 'src': src_fifth_5_16_no, 'dst': 'fifth_5_16_no'},
{'name': 'selected_sixth', 'src': 'show_sections', 'dst': 'sixth1'},
{'name': 'sixth1_to_sixth2', 'src': 'sixth1', 'dst': 'sixth2'},
{'name': 'sixth1_to_sixth3', 'src': 'sixth1', 'dst': 'sixth3'},
{'name': 'sixth2_to_yes', 'src': 'sixth2', 'dst': 'sixth2_yes'},
{'name': 'sixth2_to_no', 'src': 'sixth2', 'dst': 'sixth2_no'},
{'name': 'sixth3_to_yes', 'src': 'sixth3', 'dst': 'sixth2'},
{'name': 'sixth3_to_no', 'src': 'sixth3', 'dst': 'sixth3_no'},
],
'callbacks': { #Коллбеки.Указываем какой метод будет отвечать за обработку какого события
'onwaiting_start': onwaiting_start,
'onshow_sections': onshow_sections,
'onfirst1': onfirst1, 'onfirst1_no': onfirst1_no,
'onfirst2': onfirst2, 'onfirst2_yes': onfirst2_yes, 'onfirst2_no': onfirst2_no,
'onfirst3': onfirst3, 'onfirst3_yes': onfirst3_yes,
'onfirst4': onfirst4, 'onfirst4_yes': onfirst4_yes,
'onfirst5': onfirst5, 'onfirst5_yes': onfirst5_yes,
'onfirst6': onfirst6, 'onfirst6_yes': onfirst6_yes, 'onfirst6_no': onfirst6_no,
'onsecond1': onsecond1, 'onsecond2': onsecond2, 'onsecond3': onsecond3, 'onsecond4': onsecond4,
'onsecond5': onsecond5, 'onsecond6': onsecond6, 'onsecond7': onsecond7, 'onsecond8': onsecond8,
'onsecond9': onsecond9, 'onsecond10': onsecond10, 'onsecond10_no': onsecond10_no,
'onpartnership': onpartnership,
'onpartnership1': onpartnership1,
'onpartnership2': onpartnership2,
'onpartnership3': onpartnership3,
'onpartnership4': onpartnership4,
'onpartnership5': onpartnership5,
'onpartnership6': onpartnership6,
'onpartnership7': onpartnership7,
'onpartnership8': onpartnership8,
'onpartnership9': onpartnership9,
'onpartnership9_no': onpartnership9_no,
'ontradename': ontradename,
'ontradename1': ontradename1,
'ontradename1_no': ontradename1_no,
'ontradename2': ontradename2,
'ontradename2_no': ontradename2_no,
'ontradename3': ontradename3,
'ontradename3_no': ontradename3_no,
'ontradename3_yes': ontradename3_yes,
'onthird1': onthird1, 'onthird1_no': onthird1_no,
'onthird2': onthird2, 'onthird2_no': onthird2_no,
'onthird3': onthird3, 'onthird3_no': onthird3_no,
'onthird4': onthird4, 'onthird_4_16_no': onthird_4_16_no,
'onthird5': onthird5,
'onthird6': onthird6,
'onthird7': onthird7,
'onthird8': onthird8,
'onthird9': onthird9,
'onthird10': onthird10,
'onthird11': onthird11,
'onthird12': onthird12,
'onthird13': onthird13,
'onthird14': onthird14,
'onthird15': onthird15,
'onthird16': onthird16,
'onthird17': onthird17,
'onfourth1': onfourth1, 'onfourth1_no': onfourth1_no,
'onfourth2': onfourth2, 'onfourth3_no': onfourth3_no,
'onfourth3': onfourth3, 'onfourth_4_20_no': onfourth_4_20_no,
'onfourth4': onfourth4,
'onfourth5': onfourth5,
'onfourth6': onfourth6,
'onfourth7': onfourth7,
'onfourth8': onfourth8,
'onfourth9': onfourth9,
'onfourth10': onfourth10,
'onfourth11': onfourth11,
'onfourth12': onfourth12,
'onfourth13': onfourth13,
'onfourth14': onfourth14,
'onfourth15': onfourth15,
'onfourth16': onfourth16,
'onfourth17': onfourth17,
'onfourth18': onfourth18,
'onfourth19': onfourth19,
'onfourth20': onfourth20,
'onfourth21': onfourth21,
'onfifth1': onfifth1, 'onfifth1_no': onfifth1_no,
'onfifth2': onfifth2, 'onfifth2_no': onfifth2_no,
'onfifth3': onfifth3, 'onfifth4_no': onfifth4_no,
'onfifth4': onfifth4, 'onfifth_5_16_no': onfifth_5_16_no,
'onfifth5': onfifth5,
'onfifth6': onfifth6,
'onfifth7': onfifth7,
'onfifth8': onfifth8,
'onfifth9': onfifth9,
'onfifth10': onfifth10,
'onfifth11': onfifth11,
'onfifth12': onfifth12,
'onfifth13': onfifth13,
'onfifth14': onfifth14,
'onfifth15': onfifth15,
'onfifth16': onfifth16,
'onfifth17': onfifth17,
'onsixth1': onsixth1,
'onsixth2': onsixth2, 'onsixth2_yes': onsixth2_yes, 'onsixth2_no': onsixth2_no,
'onsixth3': onsixth3, 'onsixth3_no': onsixth3_no,
}})
return fsm
#Метод для перехода на следующее состояние после набора команды "/start"
def change_state(state):
if state == 'waiting_start':
fsm.gotstart()
#Описываем работу обработчика события "onwaiting_start"
def onwaiting_start(e):
@bot.message_handler(commands=["start"]) #атрибут отвечающие за реагирование на набор команды "/start"
def start(message):
bot.send_message(chat_id=message.chat.id,
text=response_storage.welcome_message) #берем текст сообщения из
# банка всех текстов(response_storage.py)
global chat_id
chat_id = message.chat.id
fsm.current = 'waiting_start' #указываем, что текущее состояние - "waiting_start"
change_state(fsm.current)
#Описываем работу обработчика события "onshow_sections"
def onshow_sections(e):
keyboard = utils.select_keyboard("section-number")
bot.send_message(chat_id=chat_id,
text=response_storage.first_response,
reply_markup=keyboard)
#Дальше пошло описание действий при попадании на каждое конкретное состояние.
def onfirst1(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 1, 'question'),
reply_markup=keyboard)
def onfirst1_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 1, 'answer'))
if fsm.current in finals: #если текущее состояние является финальным, то
fsm.go_to_start() #переходим снова в начало к выбору ветки
return
def onfirst2(e):
keyboard = utils.select_keyboard("yes-no-maybe")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 2, 'question'),
reply_markup=keyboard)
def onfirst2_yes(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 2, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfirst2_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 3, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfirst3(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 3, 'question'),
reply_markup=keyboard)
def onfirst3_yes(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 3, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfirst4(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 4, 'question'),
reply_markup=keyboard)
def onfirst4_yes(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 3, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfirst5(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 5, 'question'),
reply_markup=keyboard)
def onfirst5_yes(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 3, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfirst6(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 6, 'question'),
reply_markup=keyboard)
def onfirst6_yes(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 3, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfirst6_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 4, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onsecond1(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 1, 'question'),
reply_markup=keyboard)
def onsecond2(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 2, 'question'),
reply_markup=keyboard)
def onsecond3(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 3, 'question'),
reply_markup=keyboard)
def onsecond4(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 4, 'question'),
reply_markup=keyboard)
def onsecond5(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 5, 'question'),
reply_markup=keyboard)
def onsecond6(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 6, 'question'),
reply_markup=keyboard)
def onsecond7(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 7, 'question'),
reply_markup=keyboard)
def onsecond8(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 8, 'question'),
reply_markup=keyboard)
def onsecond9(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 9, 'question'),
reply_markup=keyboard)
def onsecond10(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 10, 'question'),
reply_markup=keyboard)
def onsecond10_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 1, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onpartnership(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 11, 'question'),
reply_markup=keyboard)
def onpartnership1(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 12, 'question'),
reply_markup=keyboard)
def onpartnership2(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 13, 'question'),
reply_markup=keyboard)
def onpartnership3(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 14, 'question'),
reply_markup=keyboard)
def onpartnership4(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 15, 'question'),
reply_markup=keyboard)
def onpartnership5(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 16, 'question'),
reply_markup=keyboard)
def onpartnership6(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 17, 'question'),
reply_markup=keyboard)
def onpartnership7(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 18, 'question'),
reply_markup=keyboard)
def onpartnership8(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 19, 'question'),
reply_markup=keyboard)
def onpartnership9(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 20, 'question'),
reply_markup=keyboard)
def onpartnership9_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 2, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def ontradename(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 21, 'question'),
reply_markup=keyboard)
def ontradename1(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 22, 'question'),
reply_markup=keyboard)
def ontradename1_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 3, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def ontradename2(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 23, 'question'),
reply_markup=keyboard)
def ontradename2_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 3, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def ontradename3(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 24, 'question'),
reply_markup=keyboard)
def ontradename3_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 4, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def ontradename3_yes(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(section_number, 5, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onthird1(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 1, 'question'),
reply_markup=keyboard)
def onthird1_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 1, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onthird2(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 2, 'question'),
reply_markup=keyboard)
def onthird2_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 2, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onthird3(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 3, 'question'),
reply_markup=keyboard)
def onthird3_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 3, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onthird4(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 4, 'question'),
reply_markup=keyboard)
def onthird5(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 5, 'question'),
reply_markup=keyboard)
def onthird6(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 6, 'question'),
reply_markup=keyboard)
def onthird7(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 7, 'question'),
reply_markup=keyboard)
def onthird8(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 8, 'question'),
reply_markup=keyboard)
def onthird9(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 9, 'question'),
reply_markup=keyboard)
def onthird10(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 10, 'question'),
reply_markup=keyboard)
def onthird11(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 11, 'question'),
reply_markup=keyboard)
def onthird12(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 12, 'question'),
reply_markup=keyboard)
def onthird13(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 13, 'question'),
reply_markup=keyboard)
def onthird14(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 14, 'question'),
reply_markup=keyboard)
def onthird15(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 15, 'question'),
reply_markup=keyboard)
def onthird16(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 16, 'question'),
reply_markup=keyboard)
def onthird17(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 4, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onthird_4_16_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(3, 5, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfourth1(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 1, 'question'),
reply_markup=keyboard)
def onfourth1_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 1, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfourth2(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 2, 'question'),
reply_markup=keyboard)
def onfourth2_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 1, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfourth3(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 3, 'question'),
reply_markup=keyboard)
def onfourth3_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 2, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfourth4(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 4, 'question'),
reply_markup=keyboard)
def onfourth5(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 5, 'question'),
reply_markup=keyboard)
def onfourth6(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 6, 'question'),
reply_markup=keyboard)
def onfourth7(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 7, 'question'),
reply_markup=keyboard)
def onfourth8(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 8, 'question'),
reply_markup=keyboard)
def onfourth9(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 9, 'question'),
reply_markup=keyboard)
def onfourth10(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 10, 'question'),
reply_markup=keyboard)
def onfourth11(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 11, 'question'),
reply_markup=keyboard)
def onfourth12(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 12, 'question'),
reply_markup=keyboard)
def onfourth13(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 13, 'question'),
reply_markup=keyboard)
def onfourth14(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 14, 'question'),
reply_markup=keyboard)
def onfourth15(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 15, 'question'),
reply_markup=keyboard)
def onfourth16(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 16, 'question'),
reply_markup=keyboard)
def onfourth17(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 17, 'question'),
reply_markup=keyboard)
def onfourth18(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 18, 'question'),
reply_markup=keyboard)
def onfourth19(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 19, 'question'),
reply_markup=keyboard)
def onfourth20(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 20, 'question'),
reply_markup=keyboard)
def onfourth21(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 3, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfourth_4_20_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(4, 4, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfifth1(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 1, 'question'),
reply_markup=keyboard)
def onfifth1_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 1, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfifth2(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 2, 'question'),
reply_markup=keyboard)
def onfifth2_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 2, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfifth3(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 3, 'question'),
reply_markup=keyboard)
def onfifth4(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 4, 'question'),
reply_markup=keyboard)
def onfifth4_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 3, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfifth5(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 5, 'question'),
reply_markup=keyboard)
def onfifth6(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 6, 'question'),
reply_markup=keyboard)
def onfifth7(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 7, 'question'),
reply_markup=keyboard)
def onfifth8(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 8, 'question'),
reply_markup=keyboard)
def onfifth9(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 9, 'question'),
reply_markup=keyboard)
def onfifth10(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 10, 'question'),
reply_markup=keyboard)
def onfifth11(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 11, 'question'),
reply_markup=keyboard)
def onfifth12(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 12, 'question'),
reply_markup=keyboard)
def onfifth13(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 13, 'question'),
reply_markup=keyboard)
def onfifth14(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 14, 'question'),
reply_markup=keyboard)
def onfifth15(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 15, 'question'),
reply_markup=keyboard)
def onfifth16(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 16, 'question'),
reply_markup=keyboard)
def onfifth17(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 4, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onfifth_5_16_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(5, 5, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onsixth1(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(6, 1, 'question'),
reply_markup=keyboard)
def onsixth2(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(6, 2, 'question'),
reply_markup=keyboard)
def onsixth2_yes(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(6, 1, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onsixth2_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(6, 2, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
def onsixth3(e):
keyboard = utils.select_keyboard("yes-no")
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(6, 3, 'question'),
reply_markup=keyboard)
def onsixth3_no(e):
bot.send_message(chat_id=chat_id,
text=response_storage.select_message(6, 3, 'answer'))
if fsm.current in finals:
fsm.go_to_start()
return
#Создаем объект бота
bot = telebot.TeleBot(config.token) #передаем в параметр уникальный токен нашего бота
fsm = create_fsm()
#Обработчик всех нажатий на кнопки
@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
data = call.data #получаем значение, соответствующее кнопки(нажал кнопку 5 - получил в call.data значение 5).
#Далее, в соответствии с текущим состоянием(fsm.current) и значением, полученным после нажатия на кнопку,
# указываем в какое состояние необходимо перейти
if fsm.current == 'show_sections':
global section_number
section_number = int(data)
if section_number == 1:
fsm.selected_first()
return
if section_number == 2:
fsm.selected_second()
return
if section_number == 3:
fsm.selected_third()
return
if section_number == 4:
fsm.selected_fourth()
return
if section_number == 5:
fsm.selected_fifth()
return
if section_number == 6:
fsm.selected_sixth()
return
if fsm.current == 'first1':
if data == '1':
fsm.first1_to_first2()
return
if data == '2':
fsm.first1_to_no()
return
if fsm.current == 'first2':
if data == '1':
fsm.first2_to_yes()
return
if data == '2':
fsm.first2_to_no()
return
if data == '3':
fsm.first2_to_first3()
return
if fsm.current == 'first3':
if data == '1':
fsm.first3_to_yes()
return
if data == '2':
fsm.first3_to_first4()
return
if fsm.current == 'first4':
if data == '1':
fsm.first4_to_yes()
return
if data == '2':
fsm.first4_to_first5()
return
if fsm.current == 'first5':
if data == '1':
fsm.first5_to_yes()
return
if data == '2':
fsm.first5_to_first6()
return
if fsm.current == 'first6':
if data == '1':
fsm.first6_to_yes()
return
if data == '2':
fsm.first6_to_no()
return
if fsm.current == 'second1':
if data == '1':
fsm.second_to_partnership()
return
if data == '2':
fsm.second1_to_second2()
return
if fsm.current == 'second2':
if data == '1':
fsm.second_to_partnership()
return
if data == '2':
fsm.second2_to_second3()
return
if fsm.current == 'second3':
if data == '1':
fsm.second_to_partnership()
return
if data == '2':
fsm.second3_to_second4()
return
if fsm.current == 'second4':
if data == '1':
fsm.second_to_partnership()
return
if data == '2':
fsm.second4_to_second5()
return
if fsm.current == 'second5':
if data == '1':
fsm.second_to_partnership()
return
if data == '2':
fsm.second5_to_second6()
return
if fsm.current == 'second6':
if data == '1':
fsm.second_to_partnership()
return
if data == '2':
fsm.second6_to_second7()
return
if fsm.current == 'second7':
if data == '1':
fsm.second_to_partnership()
return
if data == '2':
fsm.second7_to_second8()
return
if fsm.current == 'second8':
if data == '1':
fsm.second_to_partnership()
return
if data == '2':
fsm.second8_to_second9()
return
if fsm.current == 'second9':
if data == '1':
fsm.second_to_partnership()
return
if data == '2':
fsm.second9_to_second10()
return
if fsm.current == 'second10':
if data == '1':
fsm.second_to_partnership()
return
if data == '2':
fsm.second10_to_no()
return
if fsm.current == 'partnership':
if data == '1':
fsm.partnership_to_tradename()
return
if data == '2':
fsm.partnership_to_partnership1()
return
if fsm.current == 'partnership1':
if data == '1':
fsm.partnership_to_tradename()
return
if data == '2':
fsm.partnership1_to_partnership2()
return
if fsm.current == 'partnership2':
if data == '1':
fsm.partnership_to_tradename()
return
if data == '2':
fsm.partnership2_to_partnership3()
return
if fsm.current == 'partnership3':
if data == '1':
fsm.partnership_to_tradename()
return
if data == '2':
fsm.partnership3_to_partnership4()
return
if fsm.current == 'partnership4':
if data == '1':
fsm.partnership_to_tradename()
return
if data == '2':
fsm.partnership4_to_partnership5()
return
if fsm.current == 'partnership5':
if data == '1':
fsm.partnership_to_tradename()
return
if data == '2':
fsm.partnership5_to_partnership6()
return
if fsm.current == 'partnership6':
if data == '1':
fsm.partnership_to_tradename()
return
if data == '2':
fsm.partnership6_to_partnership7()
return
if fsm.current == 'partnership7':
if data == '1':
fsm.partnership_to_tradename()
return
if data == '2':
fsm.partnership7_to_partnership8()
return
if fsm.current == 'partnership8':
if data == '1':
fsm.partnership_to_tradename()
return
if data == '2':
fsm.partnership8_to_partnership9()
return
if fsm.current == 'partnership9':
if data == '1':
fsm.partnership_to_tradename()
return
if data == '2':
fsm.partnership9_to_no()
return
if fsm.current == 'tradename':
if data == '1':
fsm.tradename_to_tradename2()
return
if data == '2':
fsm.tradename_to_tradename1()
return
if fsm.current == 'tradename1':
if data == '1':
fsm.tradename1_to_tradename2()
return
if data == '2':
fsm.tradename1_to_tradename1_no()
return
if fsm.current == 'tradename2':
if data == '1':
fsm.tradename2_to_tradename3()
return
if data == '2':
fsm.tradename2_to_tradename2_no()
return
if fsm.current == 'tradename3':
if data == '1':
fsm.tradename3_to_tradename3_yes()
return
if data == '2':
fsm.tradename3_to_tradename3_no()
return
if fsm.current == 'third1':
if data == '1':
fsm.third1_to_third2()
return
if data == '2':
fsm.third1_to_no()
return
if fsm.current == 'third2':
if data == '1':
fsm.third2_to_third3()
return
if data == '2':
fsm.third2_to_no()
return
if fsm.current == 'third3':
if data == '1':
fsm.third3_to_third4()
return
if data == '2':
fsm.third3_to_no()
return
if fsm.current == 'third4':
if data == '1':
fsm.third4_to_third5()
return
if data == '2':
fsm.third_4_16_to_no()
return
if fsm.current == 'third5':
if data == '1':
fsm.third5_to_third6()
return
if data == '2':
fsm.third_4_16_to_no()
return
if fsm.current == 'third6':
if data == '1':
fsm.third6_to_third7()
return
if data == '2':
fsm.third_4_16_to_no()
return
if fsm.current == 'third7':
if data == '1':
fsm.third7_to_third8()
return
if data == '2':
fsm.third_4_16_to_no()
return
if fsm.current == 'third8':
if data == '1':
fsm.third8_to_third9()
return
if data == '2':
fsm.third_4_16_to_no()
return
if fsm.current == 'third9':
if data == '1':
fsm.third9_to_third10()
return
if data == '2':
fsm.third_4_16_to_no()
return
if fsm.current == 'third10':
if data == '1':
fsm.third10_to_third11()
return
if data == '2':
fsm.third_4_16_to_no()
return
if fsm.current == 'third11':
if data == '1':
fsm.third11_to_third12()
return
if data == '2':
fsm.third_4_16_to_no()
return
if fsm.current == 'third12':
if data == '1':
fsm.third12_to_third13()
return
if data == '2':
fsm.third_4_16_to_no()
return
if fsm.current == 'third13':
if data == '1':
fsm.third13_to_third14()
return
if data == '2':
fsm.third_4_16_to_no()
return
if fsm.current == 'third14':
if data == '1':
fsm.third14_to_third15()
return
if data == '2':
fsm.third_4_16_to_no()
return
if fsm.current == 'third15':
if data == '1':
fsm.third15_to_third16()
return
if data == '2':
fsm.third_4_16_to_no()
return
if fsm.current == 'third16':
if data == '1':
fsm.third16_to_third17()
return
if data == '2':
fsm.third_4_16_to_no()
return
if fsm.current == 'fourth1':
if data == '1':
fsm.fourth1_to_fourth2()
return
if data == '2':
fsm.fourth1_to_no()
return
if fsm.current == 'fourth2':
if data == '1':
fsm.fourth2_to_fourth3()
return
if data == '2':
fsm.fourth2_to_no()
return
if fsm.current == 'fourth3':
if data == '1':
fsm.fourth3_to_fourth4()
return
if data == '2':
fsm.fourth3_to_no()
return
if fsm.current == 'fourth4':
if data == '1':
fsm.fourth4_to_fourth5()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth5':
if data == '1':
fsm.fourth5_to_fourth6()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth6':
if data == '1':
fsm.fourth6_to_fourth7()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth7':
if data == '1':
fsm.fourth7_to_fourth8()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth8':
if data == '1':
fsm.fourth8_to_fourth9()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth9':
if data == '1':
fsm.fourth9_to_fourth10()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth10':
if data == '1':
fsm.fourth10_to_fourth11()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth11':
if data == '1':
fsm.fourth11_to_fourth12()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth12':
if data == '1':
fsm.fourth12_to_fourth13()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth13':
if data == '1':
fsm.fourth13_to_fourth14()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth14':
if data == '1':
fsm.fourth14_to_fourth15()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth15':
if data == '1':
fsm.fourth15_to_fourth16()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth16':
if data == '1':
fsm.fourth16_to_fourth17()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth17':
if data == '1':
fsm.fourth17_to_fourth18()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth18':
if data == '1':
fsm.fourth18_to_fourth19()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth19':
if data == '1':
fsm.fourth19_to_fourth20()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fourth20':
if data == '1':
fsm.fourth20_to_fourth21()
return
if data == '2':
fsm.fourth_4_20_to_no()
return
if fsm.current == 'fifth1':
if data == '1':
fsm.fifth1_to_fifth2()
return
if data == '2':
fsm.fifth1_to_no()
return
if fsm.current == 'fifth2':
if data == '1':
fsm.fifth2_to_fifth3()
return
if data == '2':
fsm.fifth2_to_no()
return
if fsm.current == 'fifth3':
if data == '1':
fsm.fifth3_to_fifth4()
return
if data == '2':
fsm.fifth3_to_no()
return
if fsm.current == 'fifth4':
if data == '1':
fsm.fifth4_to_fifth5()
return
if data == '2':
fsm.fifth4_to_no()
return
if fsm.current == 'fifth5':
if data == '1':
fsm.fifth5_to_fifth6()
return
if data == '2':
fsm.fifth_5_16_to_no()
return
if fsm.current == 'fifth6':
if data == '1':
fsm.fifth6_to_fifth7()
return
if data == '2':
fsm.fifth_5_16_to_no()
return
if fsm.current == 'fifth7':
if data == '1':
fsm.fifth7_to_fifth8()
return
if data == '2':
fsm.fifth_5_16_to_no()
return
if fsm.current == 'fifth8':
if data == '1':
fsm.fifth8_to_fifth9()
return
if data == '2':
fsm.fifth_5_16_to_no()
return
if fsm.current == 'fifth9':
if data == '1':
fsm.fifth9_to_fifth10()
return
if data == '2':
fsm.fifth_5_16_to_no()
return
if fsm.current == 'fifth10':
if data == '1':
fsm.fifth10_to_fifth11()
return
if data == '2':
fsm.fifth_5_16_to_no()
return
if fsm.current == 'fifth11':
if data == '1':
fsm.fifth11_to_fifth12()
return
if data == '2':
fsm.fifth_5_16_to_no()
return
if fsm.current == 'fifth12':
if data == '1':
fsm.fifth12_to_fifth13()
return
if data == '2':
fsm.fifth_5_16_to_no()
return
if fsm.current == 'fifth13':
if data == '1':
fsm.fifth13_to_fifth14()
return
if data == '2':
fsm.fifth_5_16_to_no()
return
if fsm.current == 'fifth14':
if data == '1':
fsm.fifth14_to_fifth15()
return
if data == '2':
fsm.fifth_5_16_to_no()
return
if fsm.current == 'fifth15':
if data == '1':
fsm.fifth15_to_fifth16()
return
if data == '2':
fsm.fifth_5_16_to_no()
return
if fsm.current == 'fifth16':
if data == '1':
fsm.fifth16_to_fifth17()
return
if data == '2':
fsm.fifth_5_16_to_no()
return
if fsm.current == 'sixth1':
if data == '1':
fsm.sixth1_to_sixth2()
return
if data == '2':
fsm.sixth1_to_sixth3()
return
if fsm.current == 'sixth2':
if data == '1':
fsm.sixth2_to_yes()
return
if data == '2':
fsm.sixth2_to_no()
return
if fsm.current == 'sixth3':
if data == '1':
fsm.sixth3_to_yes()
return
if data == '2':
fsm.sixth3_to_no()
return
if __name__ == '__main__':
#В бесконечном цикле держмим бот в запущенном состоянии, обрабатывая возможные ошибки.
while True:
try:
bot.polling(none_stop=True, timeout=1000)
except Exception as ex:
print(ex)
time.sleep(10)
Размещено на Allbest.ru
Подобные документы
Недоліки та переваги при використанні телеграм ботів. Оцінка очікуваного ефекту від впровадження системи автоматизації. Стек технологій який використовувався при розробці чат-бота. Реалізація системи обліку клієнтів та замовлень онлайн магазину.
дипломная работа [7,2 M], добавлен 27.05.2023Компьютерные сети, основанные на равноправии участников. Этапы работы пиринговых сетей. Настройка сервера PtokaX. Возможности бота HUBBABOT, лингвистический фильтр и система ограничений. Папки и файлы бота, его команды. Расшифровка системных настроек.
лабораторная работа [547,6 K], добавлен 08.12.2011Структура экспертных систем, их классификация и характеристики. Выбор среды разработки программирования. Этапы создания экспертных систем. Алгоритм формирования базы знаний с прямой цепочкой рассуждений. Особенности интерфейса модулей "Expert" и "Klient".
курсовая работа [1,1 M], добавлен 18.08.2009Изучение методов построения конечного автомата, распознающего заданный язык, и принципы его программной реализации. Проектирование комбинационной и принципиальной схем распознающего конечного автомата с использованием библиотеки интегральных микросхем.
дипломная работа [1,8 M], добавлен 18.08.2013Технология экспертных систем на основе искусственного интеллекта: разработка и внедрение компьютерных программ, способных имитировать, воспроизводить области деятельности человека, требующих мышления, определенного мастерства и накопленного опыта.
курсовая работа [264,8 K], добавлен 22.12.2008Этапы разработки экспертных систем. Требования к организации-разработчику. Правильный выбор подходящей проблемы, работа с экспертом. Разработка прототипной системы. Развитие прототипа до промышленной экспертной системы. Особенности оценки системы.
презентация [169,1 K], добавлен 14.08.2013Основные этапы при создании экспертных систем: идентификация, концептуализация, формализация, выполнение, отладка и тестирование, опытная эксплуатация и внедрение. Соответствия между этапами проекта RAD и стадиями технологии быстрого прототипирования.
лекция [38,8 K], добавлен 07.11.2013Проектирование системы управления базами данных. Особенности реализации в MS SQL. Разработка пользовательского интерфейса. Тестирование и отладка приложения. Руководство пользователя и системного администратора. Анализ и методы разработки приложений.
курсовая работа [867,9 K], добавлен 16.07.2013Особенности разработки модуля взаимодействия и приложений для мобильных устройств на базе Windows Mobile. Основные компоненты системы. Выбор протокола XMPP. Создание базы данных, тестирование и отладка системы. Программа, моделирующая аварийные ситуации.
курсовая работа [1,2 M], добавлен 05.11.2012Методика и основные этапы разработки web-библиотеки, требования к ней, содержание, структура и элементы. Идейное описание системы, направления ее проектирования. Порядок написания кода и тестирование систем, ее важнейшие функции и сферы использования.
курсовая работа [1,2 M], добавлен 08.02.2013