Default message and customizable template#50
Merged
warengonzaga merged 55 commits intodevfrom Jul 13, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds end-to-end message templating, session management tasks, and extended admin/session persistence in the bots store.
- Introduces TemplateManager and enriches MessageFormatter with built‐in, default, and preview capabilities, plus admin notifications on template changes.
- Adds periodic session cleanup tasks and hooks them into bot startup/shutdown.
- Extends adminManager and BotsStore to support admin profiles, setup/DM sessions, and template storage.
Reviewed Changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/templateManager.ts | New TemplateManager for CRUD, preview, cloning, and defaults |
| src/utils/messageFormatter.ts | Expanded formatting engine with built‐in/default templates |
| src/utils/sessionTasks.ts | Background task for expired session cleanup |
| src/utils/adminManager.ts | Admin profile and setup/DM session utilities |
| src/sdk/types.ts | Added AdminProfile, SetupSession, DmSetupSession, and template types |
| src/sdk/bots-brain/BotsStore.ts | Persist admin profiles, sessions, and message templates |
| src/index.ts | Hooked session cleanup into startup/shutdown |
| src/handlers/webhookMessage.ts | Integrates template formatting in webhook message flows |
| package.json | Added UUID dependency |
Comments suppressed due to low confidence (3)
src/utils/templateManager.ts:24
- [nitpick] Typing
botasanyinTemplateNotificationOptionsreduces type safety. Consider using the specificTelegraf<BotContext>type (or a defined interface) for clearer API contracts.
bot?: any;
src/utils/templateManager.ts:138
- [nitpick] Reassigning the
updatesparameter can be confusing. Consider using a new variable (e.g.,finalUpdates) instead of mutating the function argument for clarity.
updates = updatesWithVariables;
src/utils/adminManager.ts:60
- New admin profile and session management functions in this module lack corresponding unit tests. Adding tests for
createAdminProfile, session CRUD, and notification flows will improve coverage and prevent regressions.
export async function createAdminProfile(telegramUserId: number, dmChatId: number, username?: string): Promise<boolean> {
Member
Author
|
@copilot, can you check the codebase, update the docstring, and remove any comments related to Phases. Lastly, make the docstring compact but informative at the same time, as much as possible. |
This was
linked to
issues
Jul 10, 2025
…ta.7 Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Remove sponsored ads section from README and bump version to 1.0.0-beta.7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several enhancements to configuration files, new chat modes, and project setup tasks. Key changes include updates to
.envfiles for improved clarity and performance, the addition of specialized chat modes for distinct development roles, and a newtasks.jsonfile for streamlined build processes.Configuration Updates:
.env.example: Added optionalBOT_USERNAMEfor performance optimization and clarified settings likeNODE_ENVandMY_COMPANY_NAMEto improve usability and reduce API calls. [1] [2].env.railway: UpdatedCOMPANY_NAMEtoMY_COMPANY_NAMEfor consistency and addedBOT_USERNAMEconfiguration.Chat Modes:
.github/chatmodes/WG Code Alchemist.chatmode.md: Introduced a chat mode focused on Clean Code principles and SOLID design, with detailed guidance for code transformation and developer education..github/chatmodes/WG Code Builder.chatmode.md: Added a chat mode aimed at educational development, combining clean code practices, strategic planning, and motivational insights..github/chatmodes/WG Code Planner.chatmode.md: Created a chat mode for project architecture and development strategy, emphasizing structured roadmaps and scalability..github/chatmodes/WG Code Sentinel.chatmode.md: Added a security-focused chat mode for identifying vulnerabilities and recommending fixes.Project Setup:
.vscode/tasks.json: Added a new task configuration for building the bot usingyarn build, improving developer workflows.Documentation Refinements:
CONTRIBUTING.md: Improved phrasing for contribution guidelines and clarified the pull request process for better readability and compliance.