go-dette/states.go

35 lines
1.0 KiB
Go
Raw Normal View History

2023-01-20 01:44:57 +03:00
package main
2023-01-20 16:32:21 +03:00
import (
neco "git.nefrace.ru/nefrace/nechotron"
)
var MainState = neco.State{
2023-01-22 23:53:20 +03:00
Fn: func(u *neco.Update) error {
2023-06-13 02:22:44 +03:00
adminDispatcher := neco.NewDispatcher().
2023-06-08 01:44:38 +03:00
HandleCallback(neco.CallbackExact("delete"), handleDeleteCallback).
2023-06-13 02:22:44 +03:00
HandleCommand(commandSay, handleSay).
HandleFilter(isFile, handleUsersImport)
adminOnly := neco.NewDispatcher().
HandleFilter(neco.IsUserAdmin, adminDispatcher.Run)
2023-01-24 23:17:30 +03:00
mainCommands := neco.NewDispatcher().
2023-01-22 23:53:20 +03:00
HandleCommand(commandMe, handleMe).
2023-06-08 01:44:38 +03:00
HandleCommand(commandHelp, handleHelp)
2023-06-13 02:22:44 +03:00
2023-01-24 23:17:30 +03:00
replyDispatcher := neco.NewDispatcher().
HandleFilter(karmaTriggers, handleKarma)
replies := neco.NewDispatcher().
HandleFilter(neco.IsReply, replyDispatcher.Run)
2023-06-13 02:22:44 +03:00
docs := neco.NewDispatcher().
2023-06-08 01:44:38 +03:00
HandleFilter(docRequest, handleDocRequest).
HandleCallback(neco.CallbackPrefix("docs3"), handleDocRequest3)
2023-06-13 02:22:44 +03:00
2023-04-13 11:13:24 +03:00
triggers := neco.NewDispatcher().
HandleFilter(offtopTrigger, handleOfftop)
2023-06-13 02:22:44 +03:00
return neco.RunEach(u, mainCommands, replies, docs, adminOnly, triggers)
2023-01-20 16:32:21 +03:00
},
2023-01-20 01:44:57 +03:00
}