Documentation ¶
Index ¶
Constants ¶
View Source
const ( // RouteAccept handle the message RouteAccept = 1 << iota // RouteStop stop handling more messages after this one RouteStop )
View Source
const RouteNothing = 0
RouteNothing do nothing in handling
Variables ¶
This section is empty.
Functions ¶
func NewStorage ¶
func NewStorage(conf *ConfService) (*goejdb.Ejdb, error)
NewStorage creates a new storage
Types ¶
type ConfService ¶
type ConfService struct {
// contains filtered or unexported fields
}
ConfService is the configuration service
func LoadConf ¶
func LoadConf(fileName string) (*ConfService, error)
LoadConf loads the configuration from a file
func (*ConfService) Get ¶
func (service *ConfService) Get(in interface{}) error
Get a configuraiton area It unmashals the structure you give from the loaded configuration.
type Context ¶
type Context struct { Storage *goejdb.Ejdb Conf *ConfService API telegram.API }
Context is the global bot context
func CreateContext ¶
CreateContext for the bot from a configuration file
type Handler ¶
type Handler interface { Check(messages *MessageContext) int Handle(messages *MessageContext) }
Handler pairs a check and a handle function
type MessageContext ¶
type MessageContext struct { Params map[string]string Message *telegram.AnswerBack }
MessageContext for each received message
type Routes ¶
type Routes struct { Bot Context // contains filtered or unexported fields }
Routes stores handlers for messages
func (*Routes) AddHandler ¶
AddHandler for incoming messages
type StorageConfiguration ¶
type StorageConfiguration struct {
DBName string `yaml:"dbName"`
}
StorageConfiguration configuration
Click to show internal directories.
Click to hide internal directories.