Y
Y
Yureck6662020-08-11 00:17:45
C++ / C#
Yureck666, 2020-08-11 00:17:45

What is the easiest way to implement the Telegram Bot's branched dialog?

The task is to write a bot in c # that asks the questions presented in the script and continues to issue questions in accordance with it. That is, when answering in one way, he conducts a dialogue in one way, in another - in another way. This is how the dialogue branches out at every turn.

I wanted to make a system in which all scripts are stored in some format, and the program itself decides which question to ask next, comparing the answers. Thus, it will not be necessary to prescribe each stage of the dialogue in the code.

The question is how to implement a branching dialog storage system. So that the program can easily read it and do everything in the appropriate sequence.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DVamp1r3, 2020-08-11
@DVamp1r3

Describe a question as an object, and a sequence of questions through a linked list , e.g.

R
Roman Kitaev, 2020-08-11
@deliro

https://refactoring.guru/ru/design-patterns/state

Y
yuopi, 2020-08-11
@yuopi

State machine:
https://habr.com/en/post/160105/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question