diff --git a/api/hook/index.go b/api/hook/index.go index 43030bb..eefd9dc 100644 --- a/api/hook/index.go +++ b/api/hook/index.go @@ -2,7 +2,6 @@ package hook import ( "encoding/json" - "fmt" "net/http" "zeril-bot/utils/bot" "zeril-bot/utils/structs" @@ -16,12 +15,18 @@ func Handler(w http.ResponseWriter, r *http.Request) { panic(err) } - fmt.Println("Handler") - fmt.Println(data) + res := make(map[string]string) + + if data.Message.Text == "" { + res["status"] = "OK" + res["message"] = "Ignore hook with chat content not found" + Response(w, res, http.StatusOK) + return + } + telegram := telegram.New(&http.Client{}, telegram.BASE_URL) bot := bot.NewBot(telegram, data) - res := make(map[string]string) err = bot.ResolveHook() diff --git a/utils/bot/bot.go b/utils/bot/bot.go index 8edfa7a..8b48cf6 100644 --- a/utils/bot/bot.go +++ b/utils/bot/bot.go @@ -2,7 +2,6 @@ package bot import ( "errors" - "fmt" "log" "strings" "time" @@ -89,9 +88,6 @@ func (b Bot) resolveCommand() error { data := b.getTelegramData() - fmt.Println("resolveCommand") - fmt.Println(data) - switch data.Command { case "/start", "/start@zerill_bot": err = b.sendStartMessage(data)