feat(onebot): add rename_group_file action#719
Merged
linyuchen merged 1 commit intoLLOneBot:devfrom Mar 6, 2026
Merged
Conversation
Contributor
Reviewer's Guide新增一个 OneBot11 动作 处理 rename_group_file 动作的时序图sequenceDiagram
actor Client
participant OneBotAdapter
participant RenameGroupFile
participant NtGroupApi
Client->>OneBotAdapter: send action rename_group_file with payload
OneBotAdapter->>RenameGroupFile: dispatch with payload
RenameGroupFile->>RenameGroupFile: validate payloadSchema
RenameGroupFile->>NtGroupApi: renameGroupFile(groupId, fileId, currentParentDirectory, newName)
NtGroupApi-->>RenameGroupFile: RenameGroupFileResponse
alt retCode != 0
RenameGroupFile->>RenameGroupFile: throw Error(clientWording)
RenameGroupFile-->>OneBotAdapter: error
OneBotAdapter-->>Client: error response
else retCode == 0
RenameGroupFile-->>OneBotAdapter: null
OneBotAdapter-->>Client: ok response
end
新的 rename_group_file OneBot11 动作的类图classDiagram
class BaseAction {
<<abstract>>
ctx
+payloadSchema
+actionName
+_handle(payload)
}
class RenameGroupFile {
+actionName
+payloadSchema
+_handle(payload Payload) Promise~null~
}
class Payload {
+group_id number|string
+file_id string
+current_parent_directory string
+new_name string
}
class NtGroupApi {
+renameGroupFile(groupId string, fileId string, currentParentDirectory string, newName string) Promise~RenameGroupFileResponse~
}
class RenameGroupFileResponse {
+renameGroupFileResult ResultWrapper
}
class ResultWrapper {
+result Result
}
class Result {
+retCode number
+clientWording string
}
BaseAction <|-- RenameGroupFile
RenameGroupFile --> Payload
RenameGroupFile --> NtGroupApi : uses
NtGroupApi --> RenameGroupFileResponse
RenameGroupFileResponse --> ResultWrapper
ResultWrapper --> Result
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your Experience访问你的 dashboard 以:
Getting HelpOriginal review guide in EnglishReviewer's GuideAdds a new OneBot11 action Sequence diagram for handling the rename_group_file actionsequenceDiagram
actor Client
participant OneBotAdapter
participant RenameGroupFile
participant NtGroupApi
Client->>OneBotAdapter: send action rename_group_file with payload
OneBotAdapter->>RenameGroupFile: dispatch with payload
RenameGroupFile->>RenameGroupFile: validate payloadSchema
RenameGroupFile->>NtGroupApi: renameGroupFile(groupId, fileId, currentParentDirectory, newName)
NtGroupApi-->>RenameGroupFile: RenameGroupFileResponse
alt retCode != 0
RenameGroupFile->>RenameGroupFile: throw Error(clientWording)
RenameGroupFile-->>OneBotAdapter: error
OneBotAdapter-->>Client: error response
else retCode == 0
RenameGroupFile-->>OneBotAdapter: null
OneBotAdapter-->>Client: ok response
end
Class diagram for the new rename_group_file OneBot11 actionclassDiagram
class BaseAction {
<<abstract>>
ctx
+payloadSchema
+actionName
+_handle(payload)
}
class RenameGroupFile {
+actionName
+payloadSchema
+_handle(payload Payload) Promise~null~
}
class Payload {
+group_id number|string
+file_id string
+current_parent_directory string
+new_name string
}
class NtGroupApi {
+renameGroupFile(groupId string, fileId string, currentParentDirectory string, newName string) Promise~RenameGroupFileResponse~
}
class RenameGroupFileResponse {
+renameGroupFileResult ResultWrapper
}
class ResultWrapper {
+result Result
}
class Result {
+retCode number
+clientWording string
}
BaseAction <|-- RenameGroupFile
RenameGroupFile --> Payload
RenameGroupFile --> NtGroupApi : uses
NtGroupApi --> RenameGroupFileResponse
RenameGroupFileResponse --> ResultWrapper
ResultWrapper --> Result
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - 我在这里给出了一些高层次的反馈:
- 在
_handle中,建议在访问retCode和clientWording之前,对res.renameGroupFileResult?.result做好防护(例如使用可选链或显式检查),这样当 API 返回的结构异常时,可以以更清晰的错误失败,而不是在访问嵌套属性时直接抛出异常。
面向 AI Agent 的提示
Please address the comments from this code review:
## Overall Comments
- In `_handle`, consider guarding `res.renameGroupFileResult?.result` (e.g., with optional chaining or explicit checks) before accessing `retCode` and `clientWording` so that unexpected API responses fail with a clearer error instead of throwing on a nested property access.帮我变得更有用!请在每条评论上点选 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English
Hey - I've left some high level feedback:
- In
_handle, consider guardingres.renameGroupFileResult?.result(e.g., with optional chaining or explicit checks) before accessingretCodeandclientWordingso that unexpected API responses fail with a clearer error instead of throwing on a nested property access.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `_handle`, consider guarding `res.renameGroupFileResult?.result` (e.g., with optional chaining or explicit checks) before accessing `retCode` and `clientWording` so that unexpected API responses fail with a clearer error instead of throwing on a nested property access.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
增加 rename_group_file API,对齐 napcat 的行为
LLBot 目前没有修改群文件名称的 API,但是 napcat 有这个 API
(是我加的)Summary
rename_group_fileOneBot11 action for renaming files in QQ group file systemntGroupApi.renameGroupFileAPI already exists; this PR exposes it as an OneBot actionDetails
Action name:
rename_group_fileParameters (compatible with NapCat):
group_idfile_idcurrent_parent_directory/)new_nameChanges:
src/onebot11/action/llbot/file/RenameGroupFile.tsRenameGroupFile = 'rename_group_file'inActionNameenuminitActionMapImplementation follows the same pattern as the existing
RenameGroupFileFolderandMoveGroupFileactions.Summary by Sourcery
新功能:
rename_group_fileOneBot11 动作用于在群文件系统中重命名文件。Original summary in English
Summary by Sourcery
New Features: