feat: Telegram bot, notifications, profile settings, 365-day refresh tokens

This commit is contained in:
Cosmo
2026-02-06 14:11:26 +00:00
parent 9e467b0448
commit afeb3adddf
7 changed files with 448 additions and 128 deletions

View File

@@ -47,11 +47,14 @@ func (b *Bot) Start() {
updates := b.api.GetUpdatesChan(u)
for update := range updates {
if update.Message == nil {
if update.CallbackQuery != nil {
go b.handleCallback(update.CallbackQuery)
continue
}
go b.handleMessage(update.Message)
if update.Message != nil {
go b.handleMessage(update.Message)
}
}
}
@@ -66,6 +69,20 @@ func (b *Bot) SendMessage(chatID int64, text string) error {
return err
}
func (b *Bot) SendMessageWithKeyboard(chatID int64, text string, keyboard *tgbotapi.InlineKeyboardMarkup) error {
if b == nil || b.api == nil {
return nil
}
msg := tgbotapi.NewMessage(chatID, text)
msg.ParseMode = "HTML"
if keyboard != nil {
msg.ReplyMarkup = keyboard
}
_, err := b.api.Send(msg)
return err
}
func (b *Bot) GetAPI() *tgbotapi.BotAPI {
if b == nil {
return nil