-
-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathmain.go
More file actions
32 lines (26 loc) · 739 Bytes
/
main.go
File metadata and controls
32 lines (26 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"context"
"fmt"
"os"
"github.com/mymmrac/telego"
)
func main() {
// Get Bot token from environment variables
botToken := os.Getenv("TOKEN")
// Create bot and enable debugging info
// (more on configuration in /examples/configuration/main.go)
// Note: Please keep in mind that default logger may expose sensitive information, use in development only
bot, err := telego.NewBot(botToken, telego.WithDefaultDebugLogger())
if err != nil {
fmt.Println(err)
os.Exit(1)
}
// Call method getMe (https://core.telegram.org/bots/api#getme)
botUser, err := bot.GetMe(context.Background())
if err != nil {
fmt.Println("Error:", err)
}
// Print Bot information
fmt.Printf("Bot user: %+v\n", botUser)
}