Skip to content

/start support, expose sourceId, target => ChannelType & typescript fixes#4

Merged
wtfsayo merged 13 commits into1.xfrom
odi-dm
Jul 7, 2025
Merged

/start support, expose sourceId, target => ChannelType & typescript fixes#4
wtfsayo merged 13 commits into1.xfrom
odi-dm

Conversation

@odilitime
Copy link
Copy Markdown
Member

@odilitime odilitime commented Jun 26, 2025

Summary by CodeRabbit

  • New Features

    • Added support for handling the Telegram bot /start command.
    • Introduced a centralized type mapping for Telegram event payloads.
  • Improvements

    • Enhanced message metadata with a unique source identifier.
    • Improved detection for sending direct messages in Telegram integration.
    • Updated TypeScript configuration for stricter type and unused code checks.
    • Streamlined markdown-to-Telegram formatting logic for clarity.
  • Chores

    • Incremented package version to 1.0.5.
    • Updated build scripts for improved compilation workflow.
  • Tests

    • Improved type safety in test cases for message sending with attachments.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 26, 2025

Warning

Rate limit exceeded

@wtfsayo has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 26 minutes and 3 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between fb992be and b34e701.

📒 Files selected for processing (3)
  • src/messageManager.ts (5 hunks)
  • src/service.ts (2 hunks)
  • src/tests.ts (2 hunks)

Walkthrough

The updates introduce stricter TypeScript compiler checks, add a new event payload mapping interface, and refine the handling of Telegram events and message metadata. The build script now runs both tsup and tsc. Minor code cleanups, type improvements, and handler additions are applied, with no changes to public API signatures.

Changes

File(s) Change Summary
package.json Bumped version to 1.0.5; build script now runs tsup && tsc instead of just tsup.
src/messageManager.ts Added sourceId UUID to message metadata; refined DM check condition; improved comments and formatting.
src/service.ts Added /start command handler emitting SLASH_START event; removed commented runtime reference.
src/tests.ts Imported TelegramContent type; cast message content in test to TelegramContent.
src/types.ts Added TelegramEventPayloadMap interface mapping event types to their payload types.
src/utils.ts Renamed unused regex callback parameter from match to _match in markdown conversion functions.
tsconfig.json Enabled stricter checks (noUnusedLocals, noUnusedParameters), disabled skipLibCheck, set baseUrl,
added typeRoots, and configured path aliases for @elizaos/core.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TelegramBot
    participant Service
    participant Runtime

    User->>TelegramBot: Sends /start command
    TelegramBot->>Service: start() handler invoked
    Service->>Runtime: Emit SLASH_START event (with ctx)
Loading
sequenceDiagram
    participant Telegram
    participant MessageManager
    participant Memory
    participant OutgoingHandler

    Telegram->>MessageManager: Receives message
    MessageManager->>Memory: Create Memory (add sourceId to metadata)
    MessageManager->>OutgoingHandler: Callback for outgoing message
    OutgoingHandler-->>Telegram: Send DM if channelType is 'DM'
Loading

Poem

🐰
A hop, a skip, a stricter check,
Types and paths align in spec.
Telegram events now mapped with care,
Start commands handled, changes in the air.
With metadata neat and code refined,
This bunny leaves no bug behind!

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch odi-dm

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 26, 2025

Note

Unit test generation is an Early Access feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/messageManager.ts (1)

405-405: Consider removing commented-out code.

The commented-out _isLastMessage variable appears to be dead code. Consider removing it entirely unless there's a specific reason to keep it for future reference.

-            //const _isLastMessage = i === sentMessages.length - 1;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between adec4a6 and 6cdd9f3.

📒 Files selected for processing (7)
  • package.json (3 hunks)
  • src/messageManager.ts (5 hunks)
  • src/service.ts (2 hunks)
  • src/tests.ts (2 hunks)
  • src/types.ts (1 hunks)
  • src/utils.ts (5 hunks)
  • tsconfig.json (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/tests.ts (1)
src/types.ts (1)
  • TelegramContent (8-11)
🔇 Additional comments (14)
src/tests.ts (2)

7-7: LGTM: Type import addition aligns with stricter TypeScript settings.

The addition of TelegramContent import supports the explicit type casting on line 148, which is necessary due to the stricter TypeScript configuration.


148-148: LGTM: Explicit type casting improves type safety.

The explicit casting to TelegramContent ensures type compatibility with the sendMessageInChunks method and aligns with the stricter TypeScript compiler settings introduced in tsconfig.json.

tsconfig.json (3)

11-11: Verify that disabling skipLibCheck doesn't cause build issues.

Setting skipLibCheck: false enables type checking for all declaration files, which may reveal type errors in dependencies. Ensure the build passes successfully with this change.


23-24: LGTM: Stricter unused variable checking improves code quality.

Enabling noUnusedLocals and noUnusedParameters enforces cleaner code and prevents accumulation of unused variables. The parameter renaming in src/utils.ts properly addresses this requirement.


26-26: LGTM: Explicit typeRoots improves type resolution.

Explicitly defining typeRoots provides clearer control over where TypeScript looks for type definitions, improving build consistency.

src/utils.ts (1)

77-77: LGTM: Proper handling of unused parameters for stricter TypeScript compliance.

The renaming of unused match parameters to _match follows the standard convention for marking intentionally unused parameters and satisfies the noUnusedParameters compiler setting introduced in tsconfig.json.

Also applies to: 84-84, 93-93, 104-104, 112-112, 123-123, 129-129, 138-138

src/service.ts (2)

21-21: LGTM: Type-only import improves build efficiency.

Converting TelegramWorldPayload to a type-only import aligns with TypeScript best practices and the stricter compiler settings.


144-150: LGTM: Proper /start command handler implementation.

The /start command handler correctly:

  • Uses the bot's start() method to listen for the command
  • Emits the appropriate SLASH_START event type
  • Passes the Telegram context as event data
  • Follows the established event emission pattern

However, verify that the SLASH_START event type is properly added to the TelegramEventPayloadMap interface in src/types.ts to ensure type safety.

src/messageManager.ts (3)

333-333: Good addition of sourceId generation.

The new sourceId field correctly generates a unique UUID based on the chat ID, which aligns with the PR objective to "expose sourceId". This provides a consistent identifier for the message source.


357-376: Improved consistency and documentation.

The changes here enhance code quality:

  • Consistent use of double quotes for string literals
  • Added helpful comments explaining MemoryType.MESSAGE and scope options
  • The sourceId is properly included in metadata

The comment clarifications about memory types and scope are valuable for maintainability.


389-389: Correct property name change aligns with type system.

The change from content.target === 'DM' to content?.channelType === 'DM' is a proper fix that:

  • Uses the correct property name channelType instead of target
  • Adds optional chaining for safety
  • Aligns with the PR objective about "target => ChannelType"

This change ensures the DM detection logic works correctly with the updated type structure.

package.json (3)

3-3: Version bump is appropriate.

The version increment from 1.0.0 to 1.0.2 follows semantic versioning practices for patch-level changes.


34-34: Excellent addition of type checking to build process.

Adding tsc to the build script ensures TypeScript type checking runs alongside bundling, which improves code quality and catches type errors early. This aligns well with the "typescript fixes" mentioned in the PR objectives.


51-79: Comprehensive plugin configuration metadata.

The new agentConfig section provides excellent documentation and configuration structure:

  • Proper plugin type specification
  • Clear parameter descriptions with type information
  • Appropriate sensitivity marking for the bot token
  • Required/optional flags for each parameter

This configuration supports the Telegram plugin functionality and follows good practices for plugin metadata.

Comment thread src/types.ts Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 26, 2025

UTG Post-Process Complete

No new issues were detected in the generated code and all check runs have completed. The unit test generation process has completed successfully.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 26, 2025

Creating a PR to put the unit tests in...

The changes have been created in this pull request: View PR

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@wtfsayo wtfsayo requested a review from Copilot July 7, 2025 16:19
Copy link
Copy Markdown
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 support for the Telegram /start command, exposes a unique sourceId in message payloads, refines channel targeting to use ChannelType, and tightens TypeScript configurations.

  • Registers a /start handler that emits a SLASH_START event.
  • Injects sourceId into messages in MessageManager.
  • Applies minor TypeScript and build-script fixes.

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/utils.ts Renamed unused match parameters to _match.
src/types.ts Introduced TelegramEventPayloadMap interface.
src/tests.ts Added TelegramContent import and cast in tests.
src/service.ts Hooked bot.start to emit SLASH_START events.
src/messageManager.ts Generated and attached sourceId; updated target logic.
package.json Bumped version to 1.0.5 and enhanced build script.
Comments suppressed due to low confidence (2)

src/types.ts:34

  • [nitpick] Consider adding a JSDoc comment above this interface to document the purpose and intended use of TelegramEventPayloadMap.
export interface TelegramEventPayloadMap {

src/tests.ts:148

  • A test case for the new /start event (emitting TelegramEventTypes.SLASH_START) is missing. Consider adding a unit test to verify that the bot's start handler correctly emits the event.
      await this.messageManager.sendMessageInChunks(mockContext as Context, messageContent as TelegramContent);

Comment thread src/tests.ts Outdated
Comment thread src/service.ts Outdated
Comment thread src/messageManager.ts
text: fullText,
// attachments?
source: 'telegram',
source: "telegram",
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

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

[nitpick] String literals elsewhere use single quotes. Consider changing this to 'telegram' to maintain code style consistency.

Suggested change
source: "telegram",
source: 'telegram',

Copilot uses AI. Check for mistakes.
Comment thread src/messageManager.ts Outdated
wtfsayo and others added 3 commits July 7, 2025 21:50
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@wtfsayo wtfsayo merged commit db2f2eb into 1.x Jul 7, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between adec4a6 and fb992be.

📒 Files selected for processing (7)
  • package.json (2 hunks)
  • src/messageManager.ts (5 hunks)
  • src/service.ts (2 hunks)
  • src/tests.ts (2 hunks)
  • src/types.ts (1 hunks)
  • src/utils.ts (5 hunks)
  • tsconfig.json (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/tests.ts (1)
src/types.ts (1)
  • TelegramContent (8-11)
🪛 Biome (1.9.4)
src/types.ts

[error] 34-34: expected , but instead found interface

Remove interface

(parse)


[error] 34-34: expected , but instead found TelegramEventPayloadMap

Remove TelegramEventPayloadMap

(parse)


[error] 34-34: expected , but instead found {

Remove {

(parse)


[error] 35-35: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 36-36: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 37-37: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 38-38: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 39-39: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 40-40: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 41-41: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 42-42: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 43-43: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 44-44: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 45-45: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 41-41: Unexpected label.

Only loops should be labeled.
The use of labels for other statements is suspicious and unfamiliar.

(lint/suspicious/noConfusingLabels)


[error] 34-46: This block statement doesn't serve any purpose and can be safely removed.

Standalone block statements without any block-level declarations are redundant in JavaScript and can be removed to simplify the code.

(lint/complexity/noUselessLoneBlockStatements)


[error] 41-41: This block statement doesn't serve any purpose and can be safely removed.

Standalone block statements without any block-level declarations are redundant in JavaScript and can be removed to simplify the code.
Safe fix: Remove redundant block.

(lint/complexity/noUselessLoneBlockStatements)

🔇 Additional comments (11)
tsconfig.json (1)

11-30: Excellent TypeScript configuration improvements!

These changes enhance type safety and code quality by:

  • Enforcing stricter type checking with skipLibCheck: false
  • Enabling unused code detection with noUnusedLocals and noUnusedParameters
  • Adding proper module resolution with path mappings for @elizaos/core
  • Including custom type definitions through typeRoots

These align perfectly with the TypeScript fixes mentioned in the PR objectives.

package.json (2)

3-3: Version increment looks good.

Standard semantic versioning practice for the feature additions and fixes in this PR.


34-34: Improved build process with type checking.

The updated build script now runs both tsup (bundling) and tsc (type checking), which ensures the code compiles correctly with the new strict TypeScript configuration. This is essential given the stricter compiler options introduced in tsconfig.json.

src/tests.ts (2)

7-7: Good type safety improvement.

Adding the explicit import for TelegramContent ensures proper typing throughout the test file.


148-148: Proper type casting for enhanced type safety.

The explicit cast to TelegramContent ensures type consistency with the sendMessageInChunks method, aligning with the enhanced type definitions introduced in this PR.

src/service.ts (1)

144-150: Excellent implementation of /start command support!

The handler properly:

  • Registers the /start command callback
  • Emits the appropriate TelegramEventTypes.SLASH_START event
  • Passes the Telegram context as event data
  • Removes the unnecessary runtime reference (good cleanup)

This directly addresses the "/start support" objective mentioned in the PR description.

src/utils.ts (1)

77-138: Good compliance with strict TypeScript settings.

Renaming unused match parameters to _match in regex replacement callbacks aligns with the new noUnusedParameters TypeScript setting. This is a standard convention that makes the code cleaner and more explicit about unused parameters while maintaining identical functionality.

src/messageManager.ts (4)

333-333: Good addition: sourceId generation

The addition of sourceId generation using the chat ID is a solid implementation that aligns with the PR objectives of exposing sourceId.


389-389: Improved property name for channel type checking

The change from content.target === 'DM' to content.channelType === 'DM' is a good improvement that aligns with the PR objectives of changing target to ChannelType. This makes the code more semantically clear.


372-372: Proper integration of sourceId in metadata

The addition of sourceId to the metadata object correctly exposes the source identifier as mentioned in the PR objectives.


357-361: Consistent quote formatting

The changes to use double quotes maintain consistency with the codebase formatting standards.

Comment thread src/types.ts
Comment on lines +34 to +46
export interface TelegramEventPayloadMap {
[TelegramEventTypes.MESSAGE_RECEIVED]: TelegramMessageReceivedPayload;
[TelegramEventTypes.MESSAGE_SENT]: TelegramMessageSentPayload;
[TelegramEventTypes.REACTION_RECEIVED]: TelegramReactionReceivedPayload;
[TelegramEventTypes.WORLD_JOINED]: TelegramWorldPayload;
[TelegramEventTypes.WORLD_CONNECTED]: TelegramWorldPayload;
[TelegramEventTypes.WORLD_LEFT]: TelegramWorldPayload;
[TelegramEventTypes.SLASH_START]: { ctx: Context };
[TelegramEventTypes.ENTITY_JOINED]: TelegramEntityPayload;
[TelegramEventTypes.ENTITY_LEFT]: TelegramEntityPayload;
[TelegramEventTypes.ENTITY_UPDATED]: TelegramEntityPayload;
[TelegramEventTypes.INTERACTION_RECEIVED]: TelegramReactionReceivedPayload;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Critical syntax error: Remove duplicate interface definition

The TelegramEventPayloadMap interface is incorrectly placed in the middle of the TelegramEventTypes enum definition, causing parse errors. This interface is already properly defined at lines 113-124.

Apply this diff to fix the syntax error:

-export interface TelegramEventPayloadMap {
-  [TelegramEventTypes.MESSAGE_RECEIVED]: TelegramMessageReceivedPayload;
-  [TelegramEventTypes.MESSAGE_SENT]: TelegramMessageSentPayload;
-  [TelegramEventTypes.REACTION_RECEIVED]: TelegramReactionReceivedPayload;
-  [TelegramEventTypes.WORLD_JOINED]: TelegramWorldPayload;
-  [TelegramEventTypes.WORLD_CONNECTED]: TelegramWorldPayload;
-  [TelegramEventTypes.WORLD_LEFT]: TelegramWorldPayload;
-  [TelegramEventTypes.SLASH_START]: { ctx: Context };
-  [TelegramEventTypes.ENTITY_JOINED]: TelegramEntityPayload;
-  [TelegramEventTypes.ENTITY_LEFT]: TelegramEntityPayload;
-  [TelegramEventTypes.ENTITY_UPDATED]: TelegramEntityPayload;
-  [TelegramEventTypes.INTERACTION_RECEIVED]: TelegramReactionReceivedPayload;
-}
+  // /start command event
+  SLASH_START = 'TELEGRAM_SLASH_START',

Note: The SLASH_START enum value needs to be added to the enum, and the payload mapping should be updated in the proper interface definition at lines 113-124.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export interface TelegramEventPayloadMap {
[TelegramEventTypes.MESSAGE_RECEIVED]: TelegramMessageReceivedPayload;
[TelegramEventTypes.MESSAGE_SENT]: TelegramMessageSentPayload;
[TelegramEventTypes.REACTION_RECEIVED]: TelegramReactionReceivedPayload;
[TelegramEventTypes.WORLD_JOINED]: TelegramWorldPayload;
[TelegramEventTypes.WORLD_CONNECTED]: TelegramWorldPayload;
[TelegramEventTypes.WORLD_LEFT]: TelegramWorldPayload;
[TelegramEventTypes.SLASH_START]: { ctx: Context };
[TelegramEventTypes.ENTITY_JOINED]: TelegramEntityPayload;
[TelegramEventTypes.ENTITY_LEFT]: TelegramEntityPayload;
[TelegramEventTypes.ENTITY_UPDATED]: TelegramEntityPayload;
[TelegramEventTypes.INTERACTION_RECEIVED]: TelegramReactionReceivedPayload;
}
// in src/types.ts, replace the misplaced interface in the middle of the enum
export enum TelegramEventTypes {
MESSAGE_RECEIVED = 'TELEGRAM_MESSAGE_RECEIVED',
MESSAGE_SENT = 'TELEGRAM_MESSAGE_SENT',
REACTION_RECEIVED = 'TELEGRAM_REACTION_RECEIVED',
WORLD_JOINED = 'TELEGRAM_WORLD_JOINED',
WORLD_CONNECTED = 'TELEGRAM_WORLD_CONNECTED',
WORLD_LEFT = 'TELEGRAM_WORLD_LEFT',
// /start command event
SLASH_START = 'TELEGRAM_SLASH_START',
ENTITY_JOINED = 'TELEGRAM_ENTITY_JOINED',
ENTITY_LEFT = 'TELEGRAM_ENTITY_LEFT',
ENTITY_UPDATED = 'TELEGRAM_ENTITY_UPDATED',
INTERACTION_RECEIVED = 'TELEGRAM_INTERACTION_RECEIVED',
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 34-34: expected , but instead found interface

Remove interface

(parse)


[error] 34-34: expected , but instead found TelegramEventPayloadMap

Remove TelegramEventPayloadMap

(parse)


[error] 34-34: expected , but instead found {

Remove {

(parse)


[error] 35-35: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 36-36: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 37-37: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 38-38: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 39-39: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 40-40: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 41-41: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 42-42: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 43-43: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 44-44: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 45-45: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 41-41: Unexpected label.

Only loops should be labeled.
The use of labels for other statements is suspicious and unfamiliar.

(lint/suspicious/noConfusingLabels)


[error] 34-46: This block statement doesn't serve any purpose and can be safely removed.

Standalone block statements without any block-level declarations are redundant in JavaScript and can be removed to simplify the code.

(lint/complexity/noUselessLoneBlockStatements)


[error] 41-41: This block statement doesn't serve any purpose and can be safely removed.

Standalone block statements without any block-level declarations are redundant in JavaScript and can be removed to simplify the code.
Safe fix: Remove redundant block.

(lint/complexity/noUselessLoneBlockStatements)

🤖 Prompt for AI Agents
In src/types.ts between lines 34 and 46, the TelegramEventPayloadMap interface
is incorrectly defined inside the TelegramEventTypes enum, causing syntax
errors. Remove this duplicate interface definition from these lines and instead
add the SLASH_START value to the TelegramEventTypes enum. Then update the
existing TelegramEventPayloadMap interface at lines 113-124 to include the
SLASH_START payload mapping with the correct type.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants