Skip to content

Default message and customizable template#50

Merged
warengonzaga merged 55 commits intodevfrom
new/default-customizable-message
Jul 13, 2025
Merged

Default message and customizable template#50
warengonzaga merged 55 commits intodevfrom
new/default-customizable-message

Conversation

@warengonzaga
Copy link
Member

@warengonzaga warengonzaga commented Jul 9, 2025

This pull request introduces several enhancements to configuration files, new chat modes, and project setup tasks. Key changes include updates to .env files for improved clarity and performance, the addition of specialized chat modes for distinct development roles, and a new tasks.json file for streamlined build processes.

Configuration Updates:

  • .env.example: Added optional BOT_USERNAME for performance optimization and clarified settings like NODE_ENV and MY_COMPANY_NAME to improve usability and reduce API calls. [1] [2]
  • .env.railway: Updated COMPANY_NAME to MY_COMPANY_NAME for consistency and added BOT_USERNAME configuration.

Chat Modes:

Project Setup:

  • .vscode/tasks.json: Added a new task configuration for building the bot using yarn build, improving developer workflows.

Documentation Refinements:

  • CONTRIBUTING.md: Improved phrasing for contribution guidelines and clarified the pull request process for better readability and compliance.

@warengonzaga warengonzaga self-assigned this Jul 9, 2025
Copilot AI review requested due to automatic review settings July 9, 2025 17:39
Copy link
Contributor

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 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 bot as any in TemplateNotificationOptions reduces type safety. Consider using the specific Telegraf<BotContext> type (or a defined interface) for clearer API contracts.
  bot?: any;

src/utils/templateManager.ts:138

  • [nitpick] Reassigning the updates parameter 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> {

@warengonzaga
Copy link
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.

@warengonzaga warengonzaga marked this pull request as draft July 10, 2025 07:46
@warengonzaga warengonzaga changed the title default customizable message Default message and customizable template Jul 10, 2025
This was linked to issues Jul 10, 2025
@warengonzaga warengonzaga added api API integration and external services (Issues/PRs) maintainer Maintainer expertise required (Issues/PRs) labels Jul 10, 2025
@warengonzaga warengonzaga moved this to In Review in Unthread Partnership Jul 10, 2025
@warengonzaga warengonzaga added this to the 📦 v1.0.0-rc1 milestone Jul 10, 2025
@warengonzaga warengonzaga moved this from In Review to In Progress in Unthread Partnership Jul 10, 2025
@warengonzaga warengonzaga moved this from In Progress to In Review in Unthread Partnership Jul 13, 2025
@warengonzaga warengonzaga marked this pull request as ready for review July 13, 2025 09:29
@warengonzaga warengonzaga marked this pull request as draft July 13, 2025 10:58
@warengonzaga warengonzaga marked this pull request as ready for review July 13, 2025 14:00
@warengonzaga warengonzaga merged commit 12488fb into dev Jul 13, 2025
3 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in Unthread Partnership Jul 13, 2025
@warengonzaga warengonzaga deleted the new/default-customizable-message branch July 13, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api API integration and external services (Issues/PRs) maintainer Maintainer expertise required (Issues/PRs)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Default message format structure Customizable message format

3 participants