feat: add subaccount admin command for superusers - #1288
Open
This-is-XiaoDeng wants to merge 4 commits into
Open
feat: add subaccount admin command for superusers#1288This-is-XiaoDeng wants to merge 4 commits into
This-is-XiaoDeng wants to merge 4 commits into
Conversation
Add an admin-only command 'subaccount' (alias '子账号') to the larkuser plugin, restricted to superusers, for managing sub-account bindings: - view: Check the binding status of a specified user ID - bind: Bind one account as a sub-account of another (with confirmation) - unbind: Unbind a sub-account from its parent (with confirmation) - unbind --all: Unbind all sub-accounts of a specified main account (with confirmation) Bind/unbind operations use larkuser's prompt tool to require explicit confirmation, listing the IDs and nicknames of involved accounts. Also adds helper functions to larkutils/subaccount.py: - get_sub_accounts(main_account) -> list[str] - remove_main_account(user_id) -> None - remove_all_sub_accounts(main_account) -> list[str] Closes # (pending PR)
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 39 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This-is-XiaoDeng
enabled auto-merge
July 24, 2026 14:19
Add help metadata for the new subaccount admin command to larkhelp system, categorized as 'superuser' with usage instructions in all three languages (zh_hans, en_us, zh_tw).
xxtg666
approved these changes
Jul 28, 2026
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.
Summary
Adds an admin-only command
subaccount(alias子账号) to thelarkuserplugin, restricted to superusers, for managing sub-account bindings.Features
subaccount view <用户ID>/subaccount 状态 <用户ID>): Check the binding status of a specified user ID — shows whether it's a sub-account, a main account with sub-accounts, or has no bindings.subaccount bind <子账号ID> <主账号ID>): Bind one account as a sub-account of another. Requires confirmation via the prompt tool, showing both involved accounts' IDs and nicknames.subaccount unbind <子账号ID>): Unbind a sub-account from its main account. Requires confirmation showing the sub-account and its main account details.subaccount unbind <主账号ID> --all): Unbind all sub-accounts of a specified main account. Requires confirmation listing all sub-accounts.Changes
src/plugins/nonebot_plugin_larkutils/subaccount.pyget_sub_accounts(main_account) -> list[str]: Query all sub-account IDs of a main account.remove_main_account(user_id) -> None: Remove a sub-account's binding.remove_all_sub_accounts(main_account) -> list[str]: Remove all sub-accounts of a main account, returning the removed IDs.src/plugins/nonebot_plugin_larkutils/__init__.pysrc/plugins/nonebot_plugin_larkuser/matchers/subaccount_admin.py(new)larkuser's existingprompttool for confirmation flows.src/plugins/nonebot_plugin_larkuser/__init__.pyLanguage files (
src/lang/*/larkuser.yaml)subaccount_admin.*translation keys for zh_hans, en_us, and zh_tw.