Skip to content

Commit 38cc597

Browse files
committed
fix: 修正 Discord 适配器中指令注册的变量命名
1 parent b50e335 commit 38cc597

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

astrbot/core/platform/sources/discord/discord_platform_adapter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def register_handler(self, handler_info) -> None:
365365
async def _collect_and_register_commands(self) -> None:
366366
"""收集所有指令并注册到Discord"""
367367
logger.info("[Discord] 开始收集并注册斜杠指令...")
368-
registered_command_names: set[str] = set()
368+
registered_commands: set[str] = set()
369369

370370
for handler_md in star_handlers_registry:
371371
if not star_map[handler_md.handler_module_path].activated:
@@ -375,7 +375,7 @@ async def _collect_and_register_commands(self) -> None:
375375
for event_filter in handler_md.event_filters:
376376
cmd_infos = self._extract_command_infos(event_filter, handler_md)
377377
for cmd_name, description in cmd_infos:
378-
if cmd_name in registered_command_names:
378+
if cmd_name in registered_commands:
379379
logger.warning(
380380
"[Discord] Duplicate slash command '%s' from %s ignored.",
381381
cmd_name,
@@ -405,11 +405,11 @@ async def _collect_and_register_commands(self) -> None:
405405
guild_ids=[self.guild_id] if self.guild_id else None,
406406
)
407407
self.client.add_application_command(slash_command)
408-
registered_command_names.add(cmd_name)
408+
registered_commands.add(cmd_name)
409409

410-
if registered_command_names:
410+
if registered_commands:
411411
logger.info(
412-
f"[Discord] 准备同步 {len(registered_command_names)} 个指令: {', '.join(sorted(registered_command_names))}",
412+
f"[Discord] 准备同步 {len(registered_commands)} 个指令: {', '.join(sorted(registered_commands))}",
413413
)
414414
else:
415415
logger.info("[Discord] 没有发现可注册的指令。")

0 commit comments

Comments
 (0)