From 11a0947e7b9cb9f5b3222a4edb4c0d3c31175283 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Wed, 31 Oct 2018 16:14:12 +0100 Subject: [PATCH] Add support for inline requests --- mods/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mods/main.go b/mods/main.go index 9cce2c3..643f8d5 100644 --- a/mods/main.go +++ b/mods/main.go @@ -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) } } }