Creates a minimal valid plugin structure.
(plugin_path: Path, repo_url: str, version: str = "1.0.0")
| 29 | |
| 30 | |
| 31 | def _write_local_test_plugin(plugin_path: Path, repo_url: str, version: str = "1.0.0"): |
| 32 | """Creates a minimal valid plugin structure.""" |
| 33 | plugin_path.mkdir(parents=True, exist_ok=True) |
| 34 | metadata = { |
| 35 | "name": TEST_PLUGIN_NAME, |
| 36 | "repo": repo_url, |
| 37 | "version": version, |
| 38 | "author": "AstrBot Team", |
| 39 | "desc": "Local test plugin", |
| 40 | "short_desc": "Local test short description", |
| 41 | } |
| 42 | with open(plugin_path / "metadata.yaml", "w", encoding="utf-8") as f: |
| 43 | yaml.dump(metadata, f) |
| 44 | with open(plugin_path / "main.py", "w", encoding="utf-8") as f: |
| 45 | f.write("from astrbot.api.star import Star, Context, StarManager\n") |
| 46 | f.write("@StarManager.register\n") |
| 47 | f.write("class HelloWorld(Star):\n") |
| 48 | f.write(" def __init__(self, context: Context): ...\n") |
| 49 | |
| 50 | |
| 51 | def _write_requirements(plugin_path: Path): |
no test coverage detected