23 lines
646 B
Go
23 lines
646 B
Go
package main
|
|
|
|
import (
|
|
neco "git.nefrace.ru/nefrace/nechotron"
|
|
)
|
|
|
|
var MainState = neco.State{
|
|
Fn: func(u *neco.Update) error {
|
|
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)
|
|
return neco.ChainRun(u, mainCommands, replies, docs)
|
|
},
|
|
}
|