go-dette/states.go

37 lines
1.1 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).
2023-06-15 17:03:57 +03:00
HandleCommand(commandFeed, handleRegisterFeed).
HandleCommand(commandFeedUnsub, handleDeleteFeed).
2023-06-13 02:22:44 +03:00
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-20 02:05:39 +03:00
HandleCommand(commandHelp, handleHelp).
HandleCommand(commandTop, handleTop)
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).
2023-06-15 17:03:57 +03:00
HandleCallback(neco.CallbackPrefix("docs"), handleDocCallback)
2023-06-13 02:22:44 +03:00
2023-09-14 01:46:42 +03:00
// triggers := neco.NewDispatcher()
2023-06-13 02:22:44 +03:00
2023-09-14 01:46:42 +03:00
return neco.RunEach(u, mainCommands, replies, docs, adminOnly)
2023-01-20 16:32:21 +03:00
},
2023-01-20 01:44:57 +03:00
}