-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
main.go
46 lines (39 loc) · 1.24 KB
/
main.go
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"fmt"
"os"
"github.com/mymmrac/telego"
tu "github.com/mymmrac/telego/telegoutil"
)
func main() {
botToken := os.Getenv("TOKEN")
// 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)
}
// Keyboard parameters
keyboard := tu.Keyboard(
tu.KeyboardRow( // Row 1
tu.KeyboardButton("Button 1"), // Column 1
tu.KeyboardButton("Button 2"), // Column 2
),
tu.KeyboardRow( // Row 2
tu.KeyboardButton("Contact").WithRequestContact(), // Column 1
tu.KeyboardButton("Location").WithRequestLocation(), // Column 2
),
tu.KeyboardRow( // Row 3
tu.KeyboardButton("Poll Any").WithRequestPoll(tu.PollTypeAny()), // Column 1
tu.KeyboardButton("Poll Regular").WithRequestPoll(tu.PollTypeRegular()), // Column 2
tu.KeyboardButton("Poll Quiz").WithRequestPoll(tu.PollTypeQuiz()), // Column 3
),
).WithResizeKeyboard().WithInputFieldPlaceholder("Select something")
// Message parameters
message := tu.Message(
tu.ID(1234567),
"My message",
).WithReplyMarkup(keyboard)
// Sending message
_, _ = bot.SendMessage(message)
}