示例#1
0
func ExampleUsage() {
	bot, err := margelet.NewMargelet("<your awesome bot name>", "<redis addr>", "<redis password>", 0, "your bot token", false)

	if err != nil {
		panic(err)
	}

	bot.Run()
}
示例#2
0
文件: main.go 项目: zhulik/cat_bot
func main() {
	token := kingpin.Flag("token", "Telegram Bot token").Required().Short('t').String()
	kingpin.Parse()

	margelet, err := margelet.NewMargelet("emergency_kittens", "127.0.0.1:6379", "", 3, *token, false)

	if err != nil {
		panic(err)
	}

	margelet.AddCommandHandler("/cat", CatHandler{})
	margelet.AddSessionHandler("/start", ConfigSessionHandler{})

	go randomCatSender(margelet)

	margelet.Run()
}