// Fantasy World Zookeeper Bot
// Copyright (c) 2018 Vladimir "fat0troll" Hodakov
package router
import (
"github.com/rs/zerolog"
"gitlab.com/toby3d/telegram"
"lab.wtfteam.pro/fat0troll/fw_zookeeper/context"
"regexp"
)
var (
c *context.Context
log zerolog.Logger
// Router is a struct which handles router functions
router struct {
privateCommands map[string]func(update *telegram.Update)
groupCommands map[string]func(update *telegram.Update)
privateRegulars map[*regexp.Regexp]func(update *telegram.Update)
groupRegulars map[*regexp.Regexp]func(update *telegram.Update)
inlineQueries map[*regexp.Regexp]func(update *telegram.Update)
}
// New initializes package
func New(cc *context.Context) {
c = cc
log = c.Logger.With().Str("domain", "router").Int("version", 1).Logger()
router.privateCommands = make(map[string]func(update *telegram.Update))
router.groupCommands = make(map[string]func(update *telegram.Update))
router.privateRegulars = make(map[*regexp.Regexp]func(update *telegram.Update))
router.groupRegulars = make(map[*regexp.Regexp]func(update *telegram.Update))
router.inlineQueries = make(map[*regexp.Regexp]func(update *telegram.Update))
log.Info().Msg("Initialized requests router")