feat: add linuxawesomebot console entry point for uv run
This commit is contained in:
1 parent
82ec179d21
commit
570eb0df70
4 files changed
+26
-10
No files matched your search
@@ -22,7 +22,15 @@ cp config.example.toml config.toml
|
||||
## 启动机器人
|
||||
|
||||
```bash
|
||||
uv run python bot.py
|
||||
uv run linuxawesomebot
|
||||
```
|
||||
|
||||
也可以 `uv run python bot.py`,效果相同。
|
||||
|
||||
## 测试
|
||||
|
||||
```bash
|
||||
uv run pytest
|
||||
```
|
||||
|
||||
## OneBot 实现端配置(以 NapCat 为例)
|
||||
@@ -68,12 +76,6 @@ uv run python bot.py
|
||||
|
||||
## 本地测试(Windows 也可)
|
||||
|
||||
```bash
|
||||
uv run python test_fake_onebot.py
|
||||
```
|
||||
|
||||
模拟一个 OneBot 实现端连入并逐条发送命令,验证机器人的回复。
|
||||
|
||||
## systemd 部署(Linux)
|
||||
|
||||
```ini
|
||||
@@ -84,7 +86,7 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/LinuxAwesomeBot
|
||||
ExecStart=/usr/local/bin/uv run python bot.py
|
||||
ExecStart=/usr/local/bin/uv run linuxawesomebot
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
|
||||
@@ -200,8 +200,12 @@ class Bot:
|
||||
await self.ob.stop()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def main():
|
||||
if sys.platform == "win32":
|
||||
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
||||
cfg = load_config()
|
||||
asyncio.run(Bot(cfg).run())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -17,3 +17,13 @@ dev = [
|
||||
"pytest>=9.1.1",
|
||||
"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"]
|
||||
Reference in new issue
Block a user