Compare commits

..

4 Commits
v1.0.5 ... main

3 changed files with 15 additions and 11 deletions

4
go.mod
View File

@ -1,5 +1,5 @@
module go.balki.me/tglistbot
go 1.20
go 1.23.4
require go.balki.me/anyhttp v0.2.0
require go.balki.me/anyhttp v0.4.0

4
go.sum
View File

@ -1,2 +1,2 @@
go.balki.me/anyhttp v0.2.0 h1:W6aGcmjF5CMJvJYtbYCywxnYoErFhFc76vwaqUG5FAQ=
go.balki.me/anyhttp v0.2.0/go.mod h1:JhfekOIjgVODoVqUCficjpIgmB3wwlB7jhN0eN2EZ/s=
go.balki.me/anyhttp v0.4.0 h1:K639Mc8qCIO5B6ugLJCLQenkwxh9rihEK5JZ/xNfvV0=
go.balki.me/anyhttp v0.4.0/go.mod h1:JhfekOIjgVODoVqUCficjpIgmB3wwlB7jhN0eN2EZ/s=

18
main.go
View File

@ -23,11 +23,11 @@ import (
var Version string
var apiToken string
var usage string = `Telegram List bot
var usage = `Telegram List bot
Environment variables:
TGLB_API_TOKEN (required): See https://core.telegram.org/bots#how-do-i-create-a-bot
TGLB_PORT (default 28923): Set numerical port or unix//run/path.sock for unix socket
TGLB_DATA_PATH (default .): Directory path where list data is stored
TGLB_API_TOKEN (required) : See https://core.telegram.org/bots#how-do-i-create-a-bot
TGLB_ADDR (default :28923) : See https://pkg.go.dev/go.balki.me/anyhttp#readme-address-syntax
TGLB_DATA_PATH (default .) : Directory path where list data is stored
`
func main() {
@ -41,9 +41,9 @@ func main() {
}
addr := func() string {
addr := os.Getenv("TGLB_PORT")
addr := os.Getenv("TGLB_ADDR")
if addr == "" {
return "28923"
return ":28923"
}
return addr
}()
@ -154,7 +154,11 @@ func main() {
}
})
log.Panicln(anyhttp.ListenAndServe(addr, nil))
err := anyhttp.ListenAndServe(addr, nil)
if err != nil {
log.Panicln(err)
}
}
func handleTextAdded(gl *glist.GList, text string) {