Skip to content

Feat/telegram#22

Merged
WillianSilva51 merged 3 commits intomainfrom
feat/telegram
Feb 23, 2026
Merged

Feat/telegram#22
WillianSilva51 merged 3 commits intomainfrom
feat/telegram

Conversation

@WillianSilva51
Copy link
Copy Markdown
Owner

@WillianSilva51 WillianSilva51 commented Feb 23, 2026

No description provided.

…add configuration and client handling

- Removed `LoginCommandHandler` and migrated logic to `LoginCallbackHandler` with support for callback-based login flow.
- Introduced `TelegramConfiguration` to centralize bot client configuration with injectable `TelegramClient`.
- Updated `TelegramCommandHandler` interface to use generic `BotApiMethod<?>` for flexible bot responses.
- Adjusted `ZaldoTelegramBot` to handle `AnswerCallbackQuery` and improve callback execution.
- Extended session expiration in `UserSessionManager` from 20 to 30 minutes for enhanced user experience.

Signed-off-by: Willian Silva <williansilva@alu.ufc.br>
- Added methods to remove and clear active keyboards for better UI interactions.
- Enhanced `FlowContext` with `lastMessageId` to track message states.
- Updated `ZaldoTelegramBot` to manage keyboard state transitions and validate callback actions.
- Improved resilience in session management by refining `executeClient` and error handling in Telegram API calls.

Signed-off-by: Willian Silva <williansilva@alu.ufc.br>
- Created `ConfirmDeleteUserCallbackHandler` and `DeleteUserCallbackHandler` for user deletion flow with confirmation prompts.
- Improved error handling and session management in `DeleteUserCallbackHandler` with clear feedback messages.
- Updated `ZaldoTelegramBot` to validate user existence during interactions and prompt account creation if necessary.
- Fixed newline escape issue in `ListTransactionCallbackHandler` for better UI consistency.

Signed-off-by: Willian Silva <williansilva@alu.ufc.br>
@WillianSilva51 WillianSilva51 self-assigned this Feb 23, 2026
Copilot AI review requested due to automatic review settings February 23, 2026 21:17
@WillianSilva51 WillianSilva51 added the enhancement New feature or request label Feb 23, 2026
@WillianSilva51 WillianSilva51 merged commit fdf9f2b into main Feb 23, 2026
3 checks passed
@WillianSilva51 WillianSilva51 deleted the feat/telegram branch February 23, 2026 21:19
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the Telegram bot functionality with improved keyboard management, user deletion features, and better UX through message editing and expiration handling. The changes refactor how the bot tracks active keyboards to prevent users from interacting with stale buttons, consolidate login flow handling, and add user account deletion capabilities.

Changes:

  • Implemented keyboard expiration tracking using lastMessageId in FlowContext to prevent interactions with old keyboards
  • Added user deletion functionality with confirmation flow (ConfirmDeleteUserCallbackHandler and DeleteUserCallbackHandler)
  • Refactored TelegramClient to use Spring dependency injection via TelegramConfiguration bean
  • Migrated login flow from command handler to callback handler for better UX with in-place message editing
  • Extended session expiration from 20 to 30 minutes and improved CI test reporting

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
TelegramConfiguration.java New Spring configuration that creates TelegramClient bean for dependency injection
UserSessionManager.java Increased session expiration from 20 to 30 minutes
FlowContext.java Added lastMessageId field to track the most recent message with active keyboard
TelegramCommandHandler.java Changed return type from SendMessage to BotApiMethod<?> for more flexibility
StartCommandHandler.java Updated to return BotApiMethod<?> instead of SendMessage
LoginCommandHandler.java Removed - functionality moved to LoginCallbackHandler
HelpCommandHandler.java Updated to return BotApiMethod<?> instead of SendMessage
LoginCallbackHandler.java Refactored to directly implement login flow logic using EditMessageText, removing dependency on LoginCommandHandler
DeleteUserCallbackHandler.java New handler to execute user deletion and clear session
ConfirmDeleteUserCallbackHandler.java New handler to show user deletion confirmation dialog
ListTransactionCallbackHandler.java Fixed escaped newline sequences (\n\n to \n\n) in empty transaction message
ZaldoTelegramBot.java Major refactor: injected TelegramClient, added keyboard tracking/expiration logic, improved callback handling with AnswerCallbackQuery, and better unauthenticated user handling
maven.yml Added working-directory and improved test summary extraction to show only final test results

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants