Fix: Change faceId type from number to number | string in setMsgReaction#534
Merged
Merged
Conversation
Co-authored-by: sj817 <[email protected]>
Copilot
AI
changed the title
[WIP] Bug: bot.setMsgReaction 的 faceId 类型不应该只是 number
Fix: Change faceId type from number to number | string in setMsgReaction
Oct 2, 2025
Collaborator
|
怎么变得这么智能了,好厉害 |
Member
|
@yusheng929 |
Contributor
|
你可以通过以下命令安装该版本: |
sj817
marked this pull request as ready for review
October 2, 2025 01:02
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a type incompatibility issue in the setMsgReaction method by changing the faceId parameter type from number to number | string across all adapter implementations.
- Updated type signature to accept both number and string for
faceIdparameter - Applied the change consistently across interface definition, base class, and concrete implementations
- Maintains backward compatibility while resolving type mismatches with specific adapter implementations
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/core/src/types/adapter/class.ts | Updated interface definition to accept number | string for faceId |
| packages/core/src/adapter/base/index.ts | Updated abstract base class method signature |
| packages/core/src/adapter/onebot/core/core.ts | Updated OneBot adapter implementation |
| packages/core/src/adapter/input/index.ts | Updated console adapter implementation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Merged
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.
Description
Fixed the
faceIdparameter type inbot.setMsgReactionto accept bothnumberandstringtypes, resolving a type incompatibility issue between the adapter base class and specific adapter implementations.Problem
The
setMsgReactionmethod was defined withfaceIdasnumberonly, but adapter implementations (like Lagrange.OneBot and NapCat.Onebot) require string types for their underlying APIs. This created a type mismatch where:faceIdas string-only typefaceId + '')Solution
Updated the type signature across all adapter classes to accept
faceId: number | string:packages/core/src/types/adapter/class.ts) - Updated theAdapterTypeinterfacepackages/core/src/adapter/base/index.ts) - Updated the abstract base implementationpackages/core/src/adapter/onebot/core/core.ts) - Updated the concrete implementationpackages/core/src/adapter/input/index.ts) - Updated the console implementationThis change is backward compatible since it expands the accepted types rather than restricting them, and the existing string conversion logic (
faceId + '') already handles both number and string inputs correctly.Testing
Verified that the type change is valid TypeScript and that the existing implementation logic (which converts to string) works correctly with both input types.
Fixes issue where
faceIdtype was incompatible with adapter base class requirements.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/4876f32048baf8ac/node_modules/.bin/prebuild-install -r napi --pkg_version=5.1.7 --pkg_name=sqlite3(dns block)node /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
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.