fix: refresh platform commands after command changes - #9685
Open
casama233 wants to merge 1 commit into
Open
Conversation
casama233
force-pushed
the
agent/refresh-platform-commands
branch
from
August 14, 2026 12:40
21ecf35 to
60880dc
Compare
casama233
marked this pull request as ready for review
August 14, 2026 12:44
casama233
force-pushed
the
agent/refresh-platform-commands
branch
from
August 14, 2026 13:14
e2a7ebc to
67a6d70
Compare
casama233
force-pushed
the
agent/refresh-platform-commands
branch
from
August 14, 2026 13:16
67a6d70 to
bbe3ffc
Compare
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.
Follow-up to #4485.
#4485 correctly made Telegram and Discord skip disabled handlers when platform commands are collected, but runtime changes from Dashboard → Plugins → Manage Behaviors do not currently trigger a platform command re-sync. As a result, disabling or renaming commands updates AstrBot's runtime state while already-registered native commands can remain stale on the platform. This is especially problematic near platform command-count limits because disabling commands does not promptly free those native command slots.
Modifications / 改动点
Platform.refresh_registered_commands()hook so adapters that expose native commands can opt into runtime refresh without platform-specific conditionals in the dashboard service.check_guildsso stale guild commands can also be removed when the desired command set becomes empty;30034).This is intentionally limited to the adapters that currently expose AstrBot-managed native command registration (
DiscordandTelegram). Other adapters inherit the no-op hook.This is not a duplicate of #4485:
fix:exclude disabled commands from platform command registration #4485: disabled handlers are excluded on the next collection.
This PR: runtime command-management changes trigger that collection/sync for already-running adapters.
This is NOT a breaking change. / 这不是一个破坏性变更。
Screenshots or Test Results / 运行截图或测试结果
Verification on the final PR commit:
Code Format Check✅Unit Tests✅Smoke Test✅AstrBot Dashboard CI✅CodeQL✅The regression tests added in this PR cover:
Checklist / 检查清单