Examples

Directory examples contains code of all v2 examples. There are different kinds of bots:

All these examples can be run on their own or as a part of the bigger Megabot. See Running Examples section to learn how to run the Megabot.

Running Examples

To run a bot combining all examples, register some bot at BotFather, then do:

CL-USER> (ql:quickload :cl-telegram-bot2-examples)

CL-USER> (setf (uiop:getenv "TELEGRAM_TOKEN")
               "520*****:AAH*****")

CL-USER> (cl-telegram-bot2-examples:start)

Calc Example

Example in the calc.lisp file consist of 3 types of the state.

In it's first state it greets the user and then switches to the next state where it awaits while user will provide a number. Then it switches to the next state where waits for another number and finally to the state where user should choose one of the arithmetic operations:

If we'll use /debug command to draw the diagram of the state transitions, then it will show a picture like this: