Skip to content

Patrolavia/botgoram

Repository files navigation

Botgoram - State-based telegram bot framework, in Go

Botgoram is state-based telegram bot framework written in go. It is inspired by tucnak/telebot. Botgoram helps when writing large, complicated, interative bots. If you only need a small, simple, command-based bot, tucnak/telebot or telegram api implementation in botgoram would be your best friend.

GoDoc Go Report Card Build Status

State based

We think the work flow for bot is like a Finite State Machine: given current state, transit to next state acording to the input. We write code to choose right state, and define what to do when entering/ leaving a state.

Synopsis

See example code on godoc.org.

But how can I convert my business logic to a state machine

It depends. Draw a flowchart, especially a data flowchart, and treat each unit as a state might be a reasonable start. The state pattern, Automata-based programming on wikipedia might also give you some thoughts.

It looks so complicate!

Yes, the code will be much longer. But it will also eliminates a number of control structures and function calls. And program can be faster if you apply certain optimization on your state map.

License

Any version of MIT, GPL or LGPL. See LICENSE.txt for details.

About

State-based telegram bot framework, in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages