Add support for inline requests
This commit is contained in:
parent
fee485fe6d
commit
11a0947e7b
1 changed files with 6 additions and 2 deletions
|
@ -15,6 +15,7 @@ type Mod struct {
|
|||
Description string
|
||||
OnInit func()
|
||||
OnMessage func(*tg.Broker, tg.APIMessage)
|
||||
OnInline func(*tg.Broker, tg.APIInlineQuery)
|
||||
Help func(*tg.Broker, tg.APIMessage)
|
||||
}
|
||||
|
||||
|
@ -97,10 +98,13 @@ func initmods() {
|
|||
log.Println("Active modules: " + strings.Join(enabledmods, ", "))
|
||||
}
|
||||
|
||||
func dispatch(broker *tg.Broker, update tg.APIMessage) {
|
||||
func dispatch(broker *tg.Broker, update tg.APIUpdate) {
|
||||
for _, mod := range mods {
|
||||
if mod.OnInline != nil {
|
||||
go mod.OnInline(broker, *update.Inline)
|
||||
}
|
||||
if mod.OnMessage != nil {
|
||||
go mod.OnMessage(broker, update)
|
||||
go mod.OnMessage(broker, *update.Message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue