From 454aaf8460724cec94502515542c6a70fe5d2366 Mon Sep 17 00:00:00 2001 From: Balakrishnan Balasubramanian Date: Fri, 23 Dec 2022 23:50:09 -0500 Subject: [PATCH] do some rename --- main.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index dabbd10..1e097ab 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,7 @@ import ( "strings" ) -var api_token = "421791796:AAE4wPbcqfLP1GNeGR3RTBiyX16fCj3HPAM" +var apiToken = "421791796:AAE4wPbcqfLP1GNeGR3RTBiyX16fCj3HPAM" func main() { fmt.Println("vim-go") @@ -52,8 +52,8 @@ func main() { if update.Message != nil { go sendButtonAndDelete(update.Message.Chat.ID, update.Message.ID, update.Message.Text) } else if update.CallbackQuery != nil { - answer_url := fmt.Sprintf("https://api.telegram.org/bot%s/answerCallbackQuery?callback_query_id=%stext=ok", api_token, update.CallbackQuery.ID) - resp, err := http.Get(answer_url) + answerUrl := fmt.Sprintf("https://api.telegram.org/bot%s/answerCallbackQuery?callback_query_id=%stext=ok", apiToken, update.CallbackQuery.ID) + resp, err := http.Get(answerUrl) if err != nil { log.Println(err) return @@ -70,9 +70,9 @@ func main() { log.Panic(http.ListenAndServe(fmt.Sprintf(":%v", port), nil)) } -func sendButtonAndDelete(chatId int, messageId int, text string) { - url := fmt.Sprintf("https://api.telegram.org/bot%s/sendMessage", api_token) - editReqFmt := ` +func sendButtonAndDelete(chatID int, messageID int, text string) { + url := fmt.Sprintf("https://api.telegram.org/bot%s/sendMessage", apiToken) + sendMsgFmt := ` { "chat_id": "%d", "text": "ok", @@ -85,8 +85,8 @@ func sendButtonAndDelete(chatId int, messageId int, text string) { ]] } ` - editReq := fmt.Sprintf(editReqFmt, chatId, text) - resp, err := http.Post(url, "application/json", strings.NewReader(editReq)) + sendMsgReq := fmt.Sprintf(sendMsgFmt, chatID, text) + resp, err := http.Post(url, "application/json", strings.NewReader(sendMsgReq)) if err != nil { log.Println(err) return @@ -98,8 +98,8 @@ func sendButtonAndDelete(chatId int, messageId int, text string) { return } log.Println(string(body)) - delete_url := fmt.Sprintf("https://api.telegram.org/bot%s/deleteMessage?chat_id=%d&message_id=%d", api_token, chatId, messageId) - resp, err = http.Get(delete_url) + deleteUrl := fmt.Sprintf("https://api.telegram.org/bot%s/deleteMessage?chat_id=%d&message_id=%d", apiToken, chatID, messageID) + resp, err = http.Get(deleteUrl) if err != nil { log.Println(err) return