This commit is contained in:
@@ -1,5 +1,17 @@
|
||||
"""Reviewed JWeBot local command adapters and broker implementation."""
|
||||
|
||||
from .cs_autochess import (
|
||||
CARD_BY_ID,
|
||||
COACH_BONUSES,
|
||||
MAX_PLAYERS,
|
||||
MIN_PLAYERS,
|
||||
PLAYER_POOL,
|
||||
CsMajorAutochess,
|
||||
build_round_plan,
|
||||
lineup_power,
|
||||
matchup_modifier,
|
||||
parse_autochess_action,
|
||||
)
|
||||
from .descriptors import (
|
||||
DIRECT_KERNEL_COMMANDS,
|
||||
DIRECT_KERNEL_COMMAND_KINDS,
|
||||
@@ -35,6 +47,9 @@ from .steam import (
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"CARD_BY_ID",
|
||||
"COACH_BONUSES",
|
||||
"CsMajorAutochess",
|
||||
"DICE_CHALLENGE_TIMEOUT_SECONDS",
|
||||
"DEFAULT_STEAM_MIHOMO_PROXY_URL",
|
||||
"DIRECT_KERNEL_COMMANDS",
|
||||
@@ -43,8 +58,12 @@ __all__ = [
|
||||
"LOCAL_COMMAND_ALIASES",
|
||||
"LOCAL_EXTENSIONS",
|
||||
"LOCAL_GAME_TIMEOUT_SECONDS",
|
||||
"MAX_PLAYERS",
|
||||
"MAX_RPS_PLAYERS",
|
||||
"MIN_PLAYERS",
|
||||
"OFFICIAL_AUTHOR",
|
||||
"PLAYER_POOL",
|
||||
"build_round_plan",
|
||||
"KernelCommandDescriptor",
|
||||
"LocalExtensionDescriptor",
|
||||
"LocalExtensionError",
|
||||
@@ -58,8 +77,11 @@ __all__ = [
|
||||
"deterministic_int",
|
||||
"local_command_parts",
|
||||
"local_extension_command_token",
|
||||
"lineup_power",
|
||||
"matchup_modifier",
|
||||
"parse_autochess_action",
|
||||
"extension_for_kind",
|
||||
"render_feature_list",
|
||||
]
|
||||
|
||||
__version__ = "0.6.3a0+1015"
|
||||
__version__ = "0.6.4a0+1015"
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
"""Generated reviewed adapter for cs-major-autochess."""
|
||||
|
||||
from jwebot_sdk import Event, ExtensionResult, ReplyPlan, SingleGroupContext
|
||||
|
||||
|
||||
PROFILE = 'cs-major-autochess'
|
||||
AUTHOR = 'jwebot'
|
||||
DESCRIPTION = 'CS自走棋'
|
||||
HELP_ENTRIES = ('/自走棋开始|报名',)
|
||||
COMMANDS = ('/自走棋', '/cs自走棋', '/autochess', '/选', '/刷新', '/锁定', '/战术', '/升级教练', '/上阵', '/下阵', '/出售', '/阵容', '/赛程', '/结束回合')
|
||||
|
||||
|
||||
def _handler(context: SingleGroupContext, command: str):
|
||||
def handle(event: Event, arguments: str) -> ExtensionResult:
|
||||
response = context.services.call(
|
||||
PROFILE,
|
||||
operation="execute",
|
||||
payload={
|
||||
"command": command,
|
||||
"arguments": arguments,
|
||||
"event": event.to_mapping(),
|
||||
},
|
||||
)
|
||||
text = response.get("text")
|
||||
if not isinstance(text, str) or not text.strip():
|
||||
raise ValueError("local service returned invalid text")
|
||||
return ExtensionResult(
|
||||
reply=ReplyPlan.text(text),
|
||||
metadata={"local_extension": PROFILE, "author": AUTHOR},
|
||||
)
|
||||
|
||||
return handle
|
||||
|
||||
|
||||
def plugin(context: SingleGroupContext) -> None:
|
||||
for command in COMMANDS:
|
||||
context.commands.register(command, _handler(context, command))
|
||||
File diff suppressed because it is too large
Load Diff
@@ -61,6 +61,20 @@ LOCAL_COMMAND_ALIASES = {
|
||||
"人物": "person_info",
|
||||
"个人属性": "person_info",
|
||||
"person": "person_info",
|
||||
"自走棋": "cs_autochess",
|
||||
"cs自走棋": "cs_autochess",
|
||||
"autochess": "cs_autochess",
|
||||
"选": "cs_autochess",
|
||||
"刷新": "cs_autochess",
|
||||
"锁定": "cs_autochess",
|
||||
"战术": "cs_autochess",
|
||||
"升级教练": "cs_autochess",
|
||||
"上阵": "cs_autochess",
|
||||
"下阵": "cs_autochess",
|
||||
"出售": "cs_autochess",
|
||||
"阵容": "cs_autochess",
|
||||
"赛程": "cs_autochess",
|
||||
"结束回合": "cs_autochess",
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +155,13 @@ LOCAL_EXTENSIONS = (
|
||||
"game_rules",
|
||||
),
|
||||
),
|
||||
LocalExtensionDescriptor(
|
||||
extension_id="cs-major-autochess",
|
||||
author=JWEBOT_AUTHOR,
|
||||
description="CS自走棋",
|
||||
help_entries=("/自走棋开始|报名",),
|
||||
command_kinds=("cs_autochess",),
|
||||
),
|
||||
LocalExtensionDescriptor(
|
||||
extension_id="person-directory",
|
||||
author=OFFICIAL_AUTHOR,
|
||||
|
||||
@@ -14,6 +14,7 @@ from datetime import datetime, timezone
|
||||
from typing import Any, Callable
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from .cs_autochess import CsMajorAutochess
|
||||
from .descriptors import LOCAL_COMMAND_ALIASES, render_feature_list
|
||||
from .player_games import PlayerGames
|
||||
|
||||
@@ -107,6 +108,7 @@ class LocalCommandEngine:
|
||||
self.profile_fact_is_safe = profile_fact_is_safe
|
||||
self.profile_expiry = profile_expiry
|
||||
self.players = PlayerGames(ledger, person_display_label)
|
||||
self.autochess = CsMajorAutochess(ledger)
|
||||
|
||||
def handle(self, row: dict[str, Any], event: dict[str, Any]) -> str:
|
||||
question = str(row["question"])
|
||||
@@ -128,6 +130,8 @@ class LocalCommandEngine:
|
||||
"game_rules",
|
||||
}:
|
||||
return self.reply_cleaner(self.players.handle(row, kind, arguments))
|
||||
if kind == "cs_autochess":
|
||||
return self.reply_cleaner(self.autochess.handle(row))
|
||||
if kind == "dice":
|
||||
return self.reply_cleaner(self.dice(row, arguments))
|
||||
if kind == "dice_challenge":
|
||||
|
||||
Reference in New Issue
Block a user