-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_keyboards.go
37 lines (32 loc) · 1.06 KB
/
user_keyboards.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
package main
import tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
var users_keybords map[string]tgbotapi.ReplyKeyboardMarkup
func load_keybords() {
users_keybords = make(map[string]tgbotapi.ReplyKeyboardMarkup)
users_keybords["default"] = tgbotapi.NewReplyKeyboard(
tgbotapi.NewKeyboardButtonRow(
tgbotapi.NewKeyboardButton("Добавить ссылку"),
tgbotapi.NewKeyboardButton("Получить ссылку"),
),
tgbotapi.NewKeyboardButtonRow(
tgbotapi.NewKeyboardButton("Мои кредиты")),
)
users_keybords["back"] = tgbotapi.NewReplyKeyboard(
tgbotapi.NewKeyboardButtonRow(
tgbotapi.NewKeyboardButton("Назад"),
),
)
}
func return_to_default(update *tgbotapi.Update) {
msg := tgbotapi.NewMessage(update.Message.Chat.ID, "Выберите действие")
msg.ReplyMarkup = users_keybords["default"]
if _, err := bot.Send(msg); err != nil {
errorLog.Println(err)
return
}
id := update.Message.From.ID
if len(users_status[id]) > 1 {
users_status[id] = users_status[id][:1]
}
users_status[id][0] = 1
}