From 018d77f1c44e0d08025ce5240b1ed5c3c2887b0d Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Thu, 22 Jul 2021 07:01:43 +0430 Subject: want to switch to grpc for the telegram bot. obviously take the telegram bot out of hived. added a robots.txt hadnler --- hived.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'hived.go') diff --git a/hived.go b/hived.go index b4a7956..759c403 100644 --- a/hived.go +++ b/hived.go @@ -21,7 +21,7 @@ import ( "github.com/Knetic/govaluate" "github.com/go-redis/redis/v8" - "github.com/go-telegram-bot-api/telegram-bot-api" + tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api" "github.com/gorilla/mux" "github.com/rs/zerolog" "github.com/rs/zerolog/log" @@ -591,6 +591,13 @@ func healthHandler(w http.ResponseWriter, r *http.Request) { }{IsHivedOk: IsHivedOk, HivedError: HivedError, IsRedisOk: IsRedisOk, RedisError: RedisError}) } +func robotsHandler(w http.ResponseWriter, r *http.Request) { + json.NewEncoder(w).Encode(struct { + UserAgents string `json:"User-Agents"` + Disallow string `json:"Disallow"` + }{"*", "/"}) +} + func startServer(gracefulWait time.Duration) { r := mux.NewRouter() srv := &http.Server{ @@ -604,6 +611,7 @@ func startServer(gracefulWait time.Duration) { r.HandleFunc("/pair", pairHandler) r.HandleFunc("/alert", alertHandler) r.HandleFunc("/ex", exHandler) + r.HandleFunc("/robots.txt", robotsHandler) go func() { if err := srv.ListenAndServe(); err != nil { -- cgit v1.2.3