add server and update /help

This commit is contained in:
2022-09-04 22:32:58 +07:00
parent 2a2a449dcf
commit bde8e7dae0
2 changed files with 18 additions and 3 deletions
+14 -1
View File
@@ -6,6 +6,7 @@ import (
"io/ioutil"
"log"
"math/rand"
"net/http"
"os"
"strings"
"student_bot/commands"
@@ -101,6 +102,18 @@ func run() {
log.Panicln(err)
}
go func() {
http.HandleFunc("/send_today_lessons_to_chat", func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
_, _ = fmt.Fprintf(w, `{"result":"ok"}`)
})
port := ":10001"
log.Println("Server is start up! port", port)
log.Fatal(http.ListenAndServe(port, nil))
}()
log.Println("Bot is start up!")
for update := range updates {
@@ -129,7 +142,7 @@ func run() {
send(bot, tgbot.NewMessage(chatId, messages.StartMessage()))
case commands.Help:
send(bot, tgbot.NewMessage(chatId, messages.HelpMessage()))
send(bot, tgbot.NewMessage(chatId, messages.HelpMessage(chatId)))
case commands.Ping:
send(bot, tgbot.NewMessage(chatId, messages.PongMessage()))