This repository has been archived on 2023-12-11. You can view files and clone it, but cannot push or open issues or pull requests.
archive/golang/sacredeer-bot/main.go

27 lines
462 B
Go
Raw Permalink Normal View History

2023-07-29 14:42:28 +03:00
package main
import (
"log"
"os"
"github.com/yanzay/tbot/v2"
)
type application struct {
client *tbot.Client
}
var (
app application
bot *tbot.Server
token string
)
func main() {
bot = tbot.New(os.Getenv("TELEGRAM_TOKEN"), tbot.WithWebhook("https://magicdeer-bot.herokuapp.com", ":"+os.Getenv("PORT")))
app.client = bot.Client()
bot.HandleMessage("/start", app.startHandler)
bot.HandleMessage(".+", app.msgHandler)
log.Fatal(bot.Start())
}