feat: add linuxawesomebot console entry point for uv run

This commit is contained in:
snowy-yang committed 2026-09-12 19:38:33 +08:00
1 parent 82ec179d21
commit 570eb0df70
4 files changed
+26 -10

No files matched your search

+10 -8
View File
@@ -22,7 +22,15 @@ cp config.example.toml config.toml
## 启动机器人 ## 启动机器人
```bash ```bash
uv run python bot.py uv run linuxawesomebot
```
也可以 `uv run python bot.py`,效果相同。
## 测试
```bash
uv run pytest
``` ```
## OneBot 实现端配置(以 NapCat 为例) ## OneBot 实现端配置(以 NapCat 为例)
@@ -68,12 +76,6 @@ uv run python bot.py
## 本地测试(Windows 也可) ## 本地测试(Windows 也可)
```bash
uv run python test_fake_onebot.py
```
模拟一个 OneBot 实现端连入并逐条发送命令,验证机器人的回复。
## systemd 部署(Linux) ## systemd 部署(Linux)
```ini ```ini
@@ -84,7 +86,7 @@ After=network.target
[Service] [Service]
WorkingDirectory=/opt/LinuxAwesomeBot WorkingDirectory=/opt/LinuxAwesomeBot
ExecStart=/usr/local/bin/uv run python bot.py ExecStart=/usr/local/bin/uv run linuxawesomebot
Restart=always Restart=always
[Install] [Install]
+5 -1
View File
@@ -200,8 +200,12 @@ class Bot:
await self.ob.stop() await self.ob.stop()
if __name__ == "__main__": def main():
if sys.platform == "win32": if sys.platform == "win32":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
cfg = load_config() cfg = load_config()
asyncio.run(Bot(cfg).run()) asyncio.run(Bot(cfg).run())
if __name__ == "__main__":
main()
+10
View File
@@ -17,3 +17,13 @@ dev = [
"pytest>=9.1.1", "pytest>=9.1.1",
"pytest-asyncio>=1.4.0", "pytest-asyncio>=1.4.0",
] ]
[project.scripts]
linuxawesomebot = "bot:main"
[build-system]
requires = ["setuptools>=75"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
py-modules = ["bot", "onebot", "monitor", "alerter"]
Generated
+1 -1
View File
@@ -252,7 +252,7 @@ wheels = [
[[package]] [[package]]
name = "linuxawesomebot" name = "linuxawesomebot"
version = "0.1.0" version = "0.1.0"
source = { virtual = "." } source = { editable = "." }
dependencies = [ dependencies = [
{ name = "aiohttp" }, { name = "aiohttp" },
{ name = "psutil" }, { name = "psutil" },