Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.
/ go-telegram-flow Public archive

Go Telegram Flow is a set of tools that may assist bot developers

License

Notifications You must be signed in to change notification settings

bazuker/go-telegram-flow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Report Card

go-telegram-flow [Deprecated]

Flow is a small framework for Telegram that is based on this telegram bot package and this locale package

go get -u github.com/kisulken/go-telegram-flow

With this library you can create dynamic menus & logical chains in Telegram just by defining the flow! Wow!

To see the full example check _examples directory

    // menu
	flow, err := menu.NewMenuFlow("flow1", b, "_examples/menu/lang", defaultLocale)
	if err != nil {
		panic(err)
	} 
	flow.GetRoot().
		Add("greetings", userPressGreeting).
		AddWith("order", userPress,
			flow.NewNode("pizza", userPress).
				Add("margarita", userOrderPizza).
				Add("pepperoni", userOrderPizza).
				Add("back", userPressBack), // traditional way of making back buttons
			flow.NewNode("sushi", userPress).
				Add("temaki", userOrderSushi).
				Add("nigiri", userOrderSushi).
				Add("sasazushi", userOrderSushi).
				Add("back", userPressBack),
			flow.NewBackNode("back"), // a short hand for making back buttons
		).
		Add("invoice", userPressInvoice).
		Add("language", userPressLanguage).GetFlow().Build("en").Build("ru")
    // chain
	flow, err = chain.NewChainFlow("flow1", b)
	if err != nil {
		panic(err)
	}

	flow.DefaultHandler(defaultResponse).GetRoot().
		Then("name", stageName, tb.OnText).
		Then("phone", stagePhone, tb.OnContact).
		Then("share_location", stageShareLocation, tb.OnText).
		Then("location", stageLocation, tb.OnLocation)

About

Go Telegram Flow is a set of tools that may assist bot developers

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages