Install
openclaw skills install astrbot-plugin-dev-skillGuide for developing AstrBot plugins that match the AstrBot main repo, pass astr-plugin-reviewer checks, and cover commands, filters, hooks, LLM integrations, and agents. Use when requested to create or update an AstrBot plugin.
openclaw skills install astrbot-plugin-dev-skillUse this skill to write AstrBot plugins in a reviewer-first way: align with astr-plugin-reviewer hard checks, then follow the current AstrBot repository APIs and docs.
Before writing code, always read these two references first:
astr-plugin-reviewer and plugin-market submission checks.Then load only the references you need:
main.py and metadata.yaml first.metadata.yaml as the source of truth for plugin identity. Prefer desc plus repo, and never keep both desc and description.main.py, define a class that inherits Star. Prefer AstrBot's auto-discovery; do not introduce the deprecated @register decorator unless you are maintaining old code.filter exactly with from astrbot.api.event import filter to avoid reviewer failures and naming confusion.from astrbot.api import logger.httpx or aiohttp; do not use requests, blocking sleeps, or other blocking network calls.StarTools.get_data_dir(). It returns a Path.metadata.yaml exactly.from pathlib import Path
from astrbot.api import logger
from astrbot.api.event import AstrMessageEvent, filter
from astrbot.api.star import Context, Star, StarTools
class MyPlugin(Star):
def __init__(self, context: Context):
super().__init__(context)
self.data_dir: Path = StarTools.get_data_dir()
@filter.command("helloworld")
async def helloworld(self, event: AstrMessageEvent):
"""回复一个简单问候。"""
logger.info(f"helloworld triggered by {event.get_sender_id()}")
yield event.plain_result(f"Hello, {event.get_sender_name()}!")
async def terminate(self):
"""Called when the plugin is unloaded or disabled."""
Note: The @register decorator is deprecated in newer versions of AstrBot. Please use metadata.yaml to define plugin metadata. AstrBot automatically detects the plugin class inheriting from Star.
A complete plugin requires metadata.yaml for identification, requirements.txt for dependencies, and optionally logo.png, _conf_schema.json, and a README.md.
astrbot_plugin_, be lowercase, have no spaces, and be short.Commands are registered using @filter.command(name). AstrBot auto-parses command parameters by type hints. You can also use command groups, command aliases, and filter by event type, platform, or user permission.
AstrBot uses a message-chain system. You can respond with plain text, images, or a mix of components. Proactive messages are supported via unified_msg_origin and MessageChain.
_conf_schema.json for user settings.@filter.llm_tool or FunctionTool.self.context.llm_generate() to call LLMs directly.self.context.tool_loop_agent() for tool-loop agents.session_waiter for multi-step prompts with custom session filters.See references/advanced-features.md for examples.
Follow these patterns for robust, user-friendly plugins:
from astrbot.api import logger.See references/patterns.md for detailed code patterns.