feat: Telegram bot, notifications, profile settings, 365-day refresh tokens
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user