Fix: Support Array<string | Elements> in active message interface#536
Merged
Conversation
Co-authored-by: sj817 <[email protected]>
Copilot
AI
changed the title
[WIP] Bug: 主动消息接口不支持
Fix: Support Array<string | Elements> in active message interface
Oct 2, 2025
Array<string 和消息段的组合>
sj817
marked this pull request as ready for review
October 2, 2025 00:12
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes type definitions in the active message interface to properly support arrays containing mixed strings and message elements. The issue was caused by incorrect local Message type definitions that only allowed Array<Elements> instead of the correct Array<string | Elements>.
Key changes:
- Remove incorrect local
Messagetype definitions that were shadowing the correctSendMessagetype - Update function parameters to use the proper
SendMessagetype from the type system - Enable support for mixed arrays like
['Hello', segment.at('123'), 'world']
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/core/src/service/bot.ts | Updated sendMsg function to use SendMessage type and removed local Message type definition |
| packages/core/src/core/karin/sendMsg.ts | Updated sendMaster and sendAdmin functions to use SendMessage type and removed local Message type definition |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Contributor
|
你可以通过以下命令安装该版本: |
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.
Problem
The active message interface (
sendMsg,sendMaster,sendAdmin) did not support arrays containing mixed strings and message segments. This prevented users from sending messages like:Root Cause
Two files had incorrect local
Messagetype definitions that only allowedArray<Elements>:While the correct
SendMessagetype was already properly defined in the type system as:The local definitions were shadowing the correct type and preventing mixed arrays.
Changes
This PR fixes the issue by removing the incorrect local
Messagetype definitions and using the properSendMessagetype:Files changed:
packages/core/src/service/bot.ts- UpdatedsendMsgfunction to useSendMessagetypepackages/core/src/core/karin/sendMsg.ts- UpdatedsendMasterandsendAdminfunctions to useSendMessagetypeImpact
After this fix, all active message functions now correctly support mixed arrays:
Testing
Fixes #[issue_number]
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
registry.npmmirror.comnode /home/REDACTED/.npm/_npx/c65dbefa27d408e0/node_modules/.bin/prebuild-install -r node --pkg_version=0.12.0 --pkg_name=node-pty-prebuilt-multiarch(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.