1
bot/examples/getme/main.go

23 lines
364 B
Go
Raw Permalink Normal View History

2022-04-26 00:02:51 +08:00
package main
import (
"context"
"fmt"
"os"
"github.com/go-telegram/bot"
)
func main() {
b, err := bot.New(os.Getenv("EXAMPLE_TELEGRAM_BOT_TOKEN"))
if nil != err {
// panics for the sake of simplicity.
// you should handle this error properly in your code.
panic(err)
}
2022-04-26 00:02:51 +08:00
user, _ := b.GetMe(context.Background())
2022-04-26 00:02:51 +08:00
fmt.Printf("User: %#v\n", user)
}