go-dette/states.go

28 lines
923 B
Go

package main
import (
neco "git.nefrace.ru/nefrace/nechotron"
)
var MainState = neco.State{
Fn: func(u *neco.Update) error {
adminOnly := neco.NewDispatcher().
HandleCallback(neco.CallbackExact("delete"), handleDeleteCallback).
HandleCommand(commandSay, handleSay)
mainCommands := neco.NewDispatcher().
HandleCommand(commandMe, handleMe).
HandleCommand(commandHelp, handleHelp)
replyDispatcher := neco.NewDispatcher().
HandleCommand(commandWarn, handleWarn).
HandleFilter(karmaTriggers, handleKarma)
replies := neco.NewDispatcher().
HandleFilter(neco.IsReply, replyDispatcher.Run)
docs := neco.NewDispatcher().
HandleFilter(docRequest, handleDocRequest).
HandleCallback(neco.CallbackPrefix("docs3"), handleDocRequest3)
triggers := neco.NewDispatcher().
HandleFilter(offtopTrigger, handleOfftop)
return neco.ChainRun(u, mainCommands, replies, docs, adminOnly, triggers)
},
}