"""Generated reviewed adapter for cs-major-autochess.""" from jwebot_sdk import Event, ExtensionResult, ReplyPlan, SingleGroupContext PROFILE = 'cs-major-autochess' AUTHOR = 'jwebot' DESCRIPTION = '自走棋' 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(), }, ) texts = response.get("texts") if isinstance(texts, list) and texts and all( isinstance(item, str) and item.strip() for item in texts ): return ExtensionResult( reply=ReplyPlan.multi_text(texts), metadata={"local_extension": PROFILE, "author": AUTHOR}, ) 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))