diff --git a/mods/main.go b/mods/main.go index 643f8d5..e394ac4 100644 --- a/mods/main.go +++ b/mods/main.go @@ -99,12 +99,18 @@ func initmods() { } func dispatch(broker *tg.Broker, update tg.APIUpdate) { - for _, mod := range mods { - if mod.OnInline != nil { - go mod.OnInline(broker, *update.Inline) + if update.Inline != nil { + for _, mod := range mods { + if mod.OnInline != nil { + go mod.OnInline(broker, *update.Inline) + } } - if mod.OnMessage != nil { - go mod.OnMessage(broker, *update.Message) + } + if update.Message != nil { + for _, mod := range mods { + if mod.OnMessage != nil { + go mod.OnMessage(broker, *update.Message) + } } } }