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/libretranslate-bot/main.go
2023-07-29 16:42:28 +05:00

27 lines
472 B
Go

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://libretranslate-bot.herokuapp.com", ":"+os.Getenv("PORT")))
app.client = bot.Client()
bot.HandleMessage("/start", app.startHandler)
bot.HandleMessage(".+", app.msgHandler)
log.Fatal(bot.Start())
}