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