/
main.go
588 lines (548 loc) · 18.6 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
package main
import (
"encoding/json"
"errors"
"fmt"
"io"
"log"
"os"
"strconv"
"strings"
"sync"
"time"
"github.com/tetra5/diabler/pkg/d4/events"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
)
const (
defaultUTCOffset = 0
defaultWBAlarmTimer = 0 // Minutes
dataPath = "./data/diabler.json"
updateInterval = 30 // Seconds
)
var mu sync.Mutex
type Data struct {
Users []User `json:"diabler"`
// const jsonStr = `
// {
// "diabler": [
// {
// "chat_id": "123456789",
// "utc_offset": 0,
// "wb_notify_period": 0,
// "wb_notified_on": "2006-01-02T15:04:05Z",
// "menu_message_id": 0
// }
// ]
// }
// `
}
type User struct {
ChatID string `json:"chat_id"`
UTCOffset int `json:"utc_offset,omitempty"`
WBAlarmTimer int `json:"wb_alarm_timer,omitempty"`
WBNotifiedOn time.Time `json:"wb_notified_on,omitempty"`
MenuMessageID int `json:"menu_message_id,omitempty"`
}
func UpdateTimers(wbs *events.WorldBossSchedule, bot *tgbotapi.BotAPI) {
data, err := LoadData(dataPath)
if err != nil {
log.Printf("Error loading data: %s", err)
}
wb := wbs.Next()
for i, u := range data.Users {
if u.WBAlarmTimer == 0 {
continue
}
chatID, err := strconv.ParseInt(u.ChatID, 10, 64)
if err != nil {
log.Printf("Error parsing Chat ID %q: %s", u.ChatID, err)
continue
}
remaining := time.Until(wb.SpawnTime)
if remaining < time.Duration(u.WBAlarmTimer)*time.Minute+time.Duration(updateInterval*1.5)*time.Second {
if u.WBNotifiedOn == wb.SpawnTime {
continue
}
timerDuration := remaining - time.Duration(u.WBAlarmTimer)*time.Minute
if timerDuration < 0 {
continue
}
log.Printf("Setting %s timer for %d ...", timerDuration.String(), chatID)
go MakeTimer(chatID, u.WBAlarmTimer, timerDuration, bot, wb)
data.Users[i].WBNotifiedOn = wb.SpawnTime
err = SaveData(dataPath, data)
if err != nil {
log.Printf("Error saving data: %s", err)
}
}
}
}
func MakeTimer(chatID int64, alarmTime int, duration time.Duration, bot *tgbotapi.BotAPI, boss events.WorldBoss) {
timer := time.NewTimer(duration)
<-timer.C
msg := tgbotapi.NewMessage(chatID, "")
msg.ParseMode = tgbotapi.ModeMarkdown
msg.Text = fmt.Sprintf(WBAlarmStr, boss.Name, PluralizeStr(alarmTime, "minute", "minutes", true))
_, err := bot.Send(msg)
if err != nil {
log.Printf("Error sending message to Chat ID %d: %s", chatID, err)
}
}
func LoadData(fPath string) (data *Data, err error) {
mu.Lock()
defer mu.Unlock()
f, errOpenFile := os.OpenFile(fPath, os.O_CREATE|os.O_RDONLY, 0644)
// log.Printf("Reading from %q ... ", fPath)
bytes, errReadAll := io.ReadAll(f)
// log.Printf("Read %d bytes", len(bytes))
errUnmarshal := json.Unmarshal(bytes, &data)
err = errors.Join(errOpenFile, errReadAll, errUnmarshal)
return data, err
}
func SaveData(fPath string, d *Data) (err error) {
mu.Lock()
defer mu.Unlock()
f, errOpenFile := os.OpenFile(fPath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
bytes, errMarshal := json.Marshal(&d)
log.Printf("Writing to %q ...", fPath)
n, errWrite := f.Write(bytes)
if errWrite != nil {
return errWrite
}
log.Printf("Wrote %d bytes", n)
err = errors.Join(errOpenFile, errMarshal, errWrite)
return err
}
func GetUserIdx(d *Data, chatID int64) (idx int) {
idx = -1
for i, u := range d.Users {
id, err := strconv.ParseInt(u.ChatID, 10, 64)
if err != nil {
return
}
if chatID == id {
return i
}
}
return idx
}
func NewUser(chatID int64) (user User) {
return User{
UTCOffset: defaultUTCOffset,
WBAlarmTimer: defaultWBAlarmTimer,
WBNotifiedOn: time.Unix(0, 0),
ChatID: strconv.FormatInt(chatID, 10),
MenuMessageID: 0,
}
}
func main() {
token := os.Getenv("TELEGRAM_TOKEN")
if token == "" {
log.Fatalf("TELEGRAM_TOKEN env var is missing")
}
bot, err := tgbotapi.NewBotAPI(token)
if err != nil {
log.Fatalf("tgbotapi.NewBotAPI: %s", err)
}
timeout := 30
updateConfig := tgbotapi.NewUpdate(0)
updateConfig.Timeout = timeout
log.Printf("Telegram: @%s, update timeout %s", &bot.Self, PluralizeStr(timeout, "second", "seconds", true))
wbs := events.NewWorldBossSchedule()
ticker := time.NewTicker(time.Second * updateInterval)
go func() {
for {
<-ticker.C
go UpdateTimers(wbs, bot)
}
}()
for update := range bot.GetUpdatesChan(updateConfig) {
var chatID int64
if update.Message != nil {
chatID = update.Message.Chat.ID
} else if update.CallbackQuery != nil {
chatID = update.CallbackQuery.Message.Chat.ID
} else {
continue
}
msg := tgbotapi.NewMessage(chatID, "")
msg.ParseMode = tgbotapi.ModeMarkdown
// This flag decides if we should store message ID for the menu system to work properly.
// Basically the "menu system" is just an ordinary chat message and there is an API call to
// modify its contents being it text or markup (inline buttons) or both simultaneously.
// Keeping that in mind not only we have to have this flag but also store the "menu" message ID
// somewhere to keep things persistent.
savingMessageID := false
data, err := LoadData(dataPath)
if err != nil {
log.Printf("Error loading data: %s. I make a new one!", err)
data = &Data{}
}
idx := GetUserIdx(data, chatID)
if idx == -1 {
log.Printf("User %d not found. I make a new one!", chatID)
data.Users = append(data.Users, NewUser(chatID))
idx = GetUserIdx(data, chatID)
err := SaveData(dataPath, data)
if err != nil {
log.Printf("Error saving data: %s", err)
msg.Text = DataSaveErrorStr
}
}
utcOffset := data.Users[idx].UTCOffset
fz := time.FixedZone("", 3600*utcOffset)
// Handling inline menu callbacks
if update.CallbackQuery != nil {
callback := tgbotapi.NewCallback(update.CallbackQuery.ID, update.CallbackQuery.Data)
_, err := bot.Request(callback)
if err != nil {
log.Printf("Error requesting callback: %s", err)
}
editMsg := tgbotapi.NewEditMessageTextAndMarkup(
chatID,
data.Users[idx].MenuMessageID,
"",
tgbotapi.NewInlineKeyboardMarkup(),
)
editMsg.ParseMode = tgbotapi.ModeMarkdown
switch update.CallbackQuery.Data {
//FIXME: Error editing "diabler-settings-time-offset-decrease" message: Too Many Requests: retry after 10
case "diabler-wb":
// Show next WB spawn time and alarm timer if set
rounded := RoundUpTime(wbs.Next().SpawnTime, time.Minute)
remaining := time.Until(rounded)
msg.Text = fmt.Sprintf(wbNextSpawnTimeStr,
wbs.Next().Name,
remaining.Round(time.Second).String(),
wbs.Next().SpawnTime.In(fz).Format(time.DateTime),
FormatUTCOffset(utcOffset),
)
var timerStr string
if data.Users[idx].WBAlarmTimer > 0 {
timerStr = fmt.Sprintf(WBTimerStr, PluralizeStr(data.Users[idx].WBAlarmTimer, "minute", "minutes", true))
} else {
timerStr = WBTimerDisabledStr
}
msg.Text = strings.Join([]string{msg.Text, timerStr}, "\n")
case "diabler-settings":
textLines := []string{
SettingsMenuStr,
fmt.Sprintf(TimeOffsetStr, FormatUTCOffset(data.Users[idx].UTCOffset)),
}
if data.Users[idx].WBAlarmTimer == 0 {
textLines = append(textLines, WBTimerDisabledMenuStr)
} else {
textLines = append(textLines, fmt.Sprintf(WBTimerMenuStr, PluralizeStr(data.Users[idx].WBAlarmTimer, "minute", "minutes", true)))
}
editMsg.Text = strings.Join(textLines, "\n")
editMsg.ReplyMarkup = &settingsMenuMarkup
_, err := bot.Send(editMsg)
if err != nil {
log.Printf("Error editing %q message: %s", "diabler-settings", err)
}
case "diabler-settings-time-offset":
textLines := []string{
SettingsMenuTimeOffsetStr,
fmt.Sprintf(TimeOffsetStr, FormatUTCOffset(data.Users[idx].UTCOffset)),
}
editMsg.Text = strings.Join(textLines, "\n")
editMsg.ReplyMarkup = &settingsTimeOffsetMenuMarkup
_, err := bot.Send(editMsg)
if err != nil {
log.Printf("Error editing %q message: %s", "diabler-settings-time-offset", err)
}
case "diabler-settings-time-offset-reset":
data.Users[idx].UTCOffset = 0
saveDataErr := SaveData(dataPath, data)
data, loadDataErr := LoadData(dataPath)
err := errors.Join(saveDataErr, loadDataErr)
if err != nil {
log.Printf("%q error(s): %s", "diabler-settings-time-offset-reset", err)
}
textLines := []string{
SettingsMenuTimeOffsetStr,
fmt.Sprintf(TimeOffsetStr, FormatUTCOffset(data.Users[idx].UTCOffset)),
}
editMsg.Text = strings.Join(textLines, "\n")
editMsg.ReplyMarkup = &settingsTimeOffsetMenuMarkup
_, err = bot.Send(editMsg)
if err != nil {
log.Printf("Error editing %q message: %s", "diabler-settings-time-offset-reset", err)
}
case "diabler-settings-time-offset-decrease":
if data.Users[idx].UTCOffset <= -12 {
data.Users[idx].UTCOffset = -12
} else {
data.Users[idx].UTCOffset -= 1
}
saveDataErr := SaveData(dataPath, data)
data, loadDataErr := LoadData(dataPath)
err := errors.Join(saveDataErr, loadDataErr)
if err != nil {
log.Printf("%q error(s): %s", "diabler-settings-time-offset-decrease", err)
}
textLines := []string{
SettingsMenuTimeOffsetStr,
fmt.Sprintf(TimeOffsetStr, FormatUTCOffset(data.Users[idx].UTCOffset)),
}
editMsg.Text = strings.Join(textLines, "\n")
editMsg.ReplyMarkup = &settingsTimeOffsetMenuMarkup
_, err = bot.Send(editMsg)
if err != nil {
log.Printf("Error editing %q message: %s", "diabler-settings-time-offset-decrease", err)
}
case "diabler-settings-time-offset-increase":
if data.Users[idx].UTCOffset >= 14 {
data.Users[idx].UTCOffset = 14
} else {
data.Users[idx].UTCOffset += 1
}
saveDataErr := SaveData(dataPath, data)
data, loadDataErr := LoadData(dataPath)
err := errors.Join(saveDataErr, loadDataErr)
if err != nil {
log.Printf("%q error(s): %s", "diabler-settings-time-offset-increase", err)
}
textLines := []string{
SettingsMenuTimeOffsetStr,
fmt.Sprintf(TimeOffsetStr, FormatUTCOffset(data.Users[idx].UTCOffset)),
}
editMsg.Text = strings.Join(textLines, "\n")
editMsg.ReplyMarkup = &settingsTimeOffsetMenuMarkup
_, err = bot.Send(editMsg)
if err != nil {
log.Printf("Error editing %q message: %s", "diabler-settings-time-offset-decrease", err)
}
case "diabler-settings-alarm":
textLines := []string{
SettingsMenuAlarmStr,
}
if data.Users[idx].WBAlarmTimer == 0 {
textLines = append(textLines, WBTimerDisabledMenuStr)
} else {
textLines = append(textLines, fmt.Sprintf(WBTimerMenuStr, PluralizeStr(data.Users[idx].WBAlarmTimer, "minute", "minutes", true)))
}
editMsg.Text = strings.Join(textLines, "\n")
editMsg.ReplyMarkup = &settingsAlarmMenuMarkup
_, err = bot.Send(editMsg)
if err != nil {
log.Printf("Error editing %q message: %s", "diabler-settings-alarm", err)
}
case "diabler-settings-alarm-disable":
data.Users[idx].WBAlarmTimer = 0
data.Users[idx].WBNotifiedOn = time.Unix(0, 0)
saveDataErr := SaveData(dataPath, data)
data, loadDataErr := LoadData(dataPath)
err := errors.Join(saveDataErr, loadDataErr)
if err != nil {
log.Printf("%q error(s): %s", "diabler-settings-alarm-disable", err)
}
textLines := []string{
SettingsMenuAlarmStr,
}
if data.Users[idx].WBAlarmTimer == 0 {
textLines = append(textLines, WBTimerDisabledMenuStr)
} else {
textLines = append(textLines, fmt.Sprintf(WBTimerMenuStr, PluralizeStr(data.Users[idx].WBAlarmTimer, "minute", "minutes", true)))
}
editMsg.Text = strings.Join(textLines, "\n")
editMsg.ReplyMarkup = &settingsAlarmMenuMarkup
_, err = bot.Send(editMsg)
if err != nil {
log.Printf("Error editing %q message: %s", "diabler-settings-alarm-disable", err)
}
case "diabler-main":
editMsg.Text = MainMenuStr
editMsg.ReplyMarkup = &mainMenuMarkup
_, err := bot.Send(editMsg)
if err != nil {
log.Printf("Error editing %q message: %s", "diabler-main", err)
}
}
// More callback handling
// FIXME: Error editing "diabler-settings-alarm-decrease-" message: Bad Request: message is not modified:
// specified new message content and reply markup are exactly the same as a current content and reply markup of the message
if strings.HasPrefix(update.CallbackQuery.Data, "diabler-settings-alarm-decrease-") {
minutes := ParseAlarmCallbackData(update.CallbackQuery.Data)
if data.Users[idx].WBAlarmTimer-minutes >= 0 {
data.Users[idx].WBAlarmTimer -= minutes
} else {
data.Users[idx].WBAlarmTimer = 0
}
data.Users[idx].WBNotifiedOn = time.Unix(0, 0)
saveDataErr := SaveData(dataPath, data)
data, loadDataErr := LoadData(dataPath)
err := errors.Join(saveDataErr, loadDataErr)
if err != nil {
log.Printf("%q error(s): %s", "diabler-settings-alarm-decrease-", err)
}
textLines := []string{
SettingsMenuAlarmStr,
}
if data.Users[idx].WBAlarmTimer == 0 {
textLines = append(textLines, WBTimerDisabledMenuStr)
} else {
textLines = append(textLines, fmt.Sprintf(WBTimerMenuStr, PluralizeStr(data.Users[idx].WBAlarmTimer, "minute", "minutes", true)))
}
editMsg.Text = strings.Join(textLines, "\n")
editMsg.ReplyMarkup = &settingsAlarmMenuMarkup
_, err = bot.Send(editMsg)
if err != nil {
log.Printf("Error editing %q message: %s", "diabler-settings-alarm-decrease-", err)
}
}
if strings.HasPrefix(update.CallbackQuery.Data, "diabler-settings-alarm-increase-") {
minutes := ParseAlarmCallbackData(update.CallbackQuery.Data)
if data.Users[idx].WBAlarmTimer+minutes <= 180 {
data.Users[idx].WBAlarmTimer += minutes
} else {
data.Users[idx].WBAlarmTimer = 180
}
data.Users[idx].WBNotifiedOn = time.Unix(0, 0)
saveDataErr := SaveData(dataPath, data)
data, loadDataErr := LoadData(dataPath)
err := errors.Join(saveDataErr, loadDataErr)
if err != nil {
log.Printf("%q error(s): %s", "diabler-settings-alarm-increase-", err)
}
textLines := []string{
SettingsMenuAlarmStr,
}
if data.Users[idx].WBAlarmTimer == 0 {
textLines = append(textLines, WBTimerDisabledMenuStr)
} else {
textLines = append(textLines, fmt.Sprintf(WBTimerMenuStr, PluralizeStr(data.Users[idx].WBAlarmTimer, "minute", "minutes", true)))
}
editMsg.Text = strings.Join(textLines, "\n")
editMsg.ReplyMarkup = &settingsAlarmMenuMarkup
_, err = bot.Send(editMsg)
if err != nil {
log.Printf("Error editing %q message: %s", "diabler-settings-alarm-increase-", err)
}
}
}
if update.Message != nil {
// Handling chat commands
switch update.Message.Command() {
case "diabler":
savingMessageID = true
msg.Text = MainMenuStr
msg.ReplyMarkup = mainMenuMarkup
default:
continue
}
}
if msg.Text == "" {
continue
}
sentMsg, err := bot.Send(msg)
if err != nil {
log.Printf("Error sending message: %s", err)
}
if savingMessageID {
data.Users[idx].MenuMessageID = sentMsg.MessageID
err := SaveData(dataPath, data)
if err != nil {
log.Printf("Error saving Message ID: %s", err)
}
}
}
}
func RoundUpTime(t time.Time, dur time.Duration) time.Time {
rounded := t.Round(dur)
if rounded.Before(t) {
rounded = rounded.Add(dur)
}
return rounded
}
func FormatUTCOffset(offset int) string {
offsetStr := strconv.Itoa(offset)
if offset >= 0 {
offsetStr = "+" + offsetStr
}
return "UTC" + offsetStr
}
func PluralizeStr(n int, singular string, plural string, includeN bool) (result string) {
nStr := strconv.Itoa(n)
lastDigit, _ := strconv.Atoi(nStr[len(nStr)-1:])
isPlural := lastDigit != 1
if isPlural {
result = plural
} else {
result = singular
}
if includeN {
result = fmt.Sprintf("%d %s", n, result)
}
return result
}
func ParseAlarmCallbackData(s string) (minutes int) {
fields := strings.Split(s, "-")
minutes, _ = strconv.Atoi(strings.Replace(fields[len(fields)-1], "m", "", -1))
return minutes
}
const (
wbNextSpawnTimeStr = "*%s* | `%s`\n%s %s."
DataSaveErrorStr = "Error 37. Please try again later."
WBTimerDisabledStr = "Alarm | `Disabled`"
WBTimerDisabledMenuStr = "Alarm: `Disabled`"
WBTimerStr = "Alarm | `%s`"
WBTimerMenuStr = "Alarm: `%s`"
WBAlarmStr = "*%s* | `%s`"
MainMenuStr = "*Diabler*"
SettingsMenuStr = "*Diabler | Settings*"
SettingsMenuTimeOffsetStr = "*Diabler | Settings | Time offset*"
SettingsMenuAlarmStr = "*Diabler | Settings | Alarm*"
TimeOffsetStr = "Time offset: `%s`"
)
var mainMenuMarkup = tgbotapi.NewInlineKeyboardMarkup(
tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData("👿 Next World Boss", "diabler-wb"),
),
tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData("\u2699 Settings", "diabler-settings"),
),
)
var settingsMenuMarkup = tgbotapi.NewInlineKeyboardMarkup(
tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData("🌎 Time offset", "diabler-settings-time-offset"),
tgbotapi.NewInlineKeyboardButtonData("⏰ Alarm", "diabler-settings-alarm"),
),
tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData("Main menu", "diabler-main"),
),
)
// TODO: add -15m and +15m offsets
var settingsTimeOffsetMenuMarkup = tgbotapi.NewInlineKeyboardMarkup(
tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData("-1 hour", "diabler-settings-time-offset-decrease"),
tgbotapi.NewInlineKeyboardButtonData("Reset", "diabler-settings-time-offset-reset"),
tgbotapi.NewInlineKeyboardButtonData("+1 hour", "diabler-settings-time-offset-increase"),
),
tgbotapi.NewInlineKeyboardRow(
returnToSettingsButton,
),
tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData("Main menu", "diabler-main"),
),
)
var settingsAlarmMenuMarkup = tgbotapi.NewInlineKeyboardMarkup(
tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData("-30", "diabler-settings-alarm-decrease-30m"),
tgbotapi.NewInlineKeyboardButtonData("-5", "diabler-settings-alarm-decrease-5m"),
tgbotapi.NewInlineKeyboardButtonData("-1", "diabler-settings-alarm-decrease-1m"),
tgbotapi.NewInlineKeyboardButtonData("+1", "diabler-settings-alarm-increase-1m"),
tgbotapi.NewInlineKeyboardButtonData("+5", "diabler-settings-alarm-increase-5m"),
tgbotapi.NewInlineKeyboardButtonData("+30", "diabler-settings-alarm-increase-30m"),
),
tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData("❌ Disable", "diabler-settings-alarm-disable"),
),
tgbotapi.NewInlineKeyboardRow(
returnToSettingsButton,
),
tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData("Main menu", "diabler-main"),
),
)
var returnToSettingsButton = tgbotapi.NewInlineKeyboardButtonData("⬅️ Return to Settings", "diabler-settings")