Test frontend for nonebot v2+
Project description
NoneBot Plugin Test
✨ 在浏览器中测试你的 NoneBot 机器人 ✨
使用方法
加载插件
nonebot.load_plugin("nonebot_plugin_test")
在日志中将会输出测试网站地址,通常为 http://HOST:PORT/test/
准备开发
首先你需要安装 npm 的本地依赖:
npm install
不建议单独为此项目新建虚拟环境,直接在你原有的 nonebot 虚拟环境下使用即可。
进行开发
使用命令启动前端页面的开发服务器,你对前端页面的任何修改都可以预览:
npm run serve
这时候的页面连接不到 nonebot2
的实例,所以只能进行页面的开发。
下面介绍一下如何连接到已有的 nonebot2
项目上。
由于开启了 devServer
中的 writeToDisk
选项, webpack-dev-server
会将每次编译产生的文件写入 ./nonebot_plugin_test/dist
文件夹。
打开你的 bot 源码目录以及虚拟环境,将原来已经安装的 nonebot-test
包移除掉:
pip uninstall nonebot-test
将 bot 的依赖改为本地依赖:
- nonebot-test = { version = "^0.1.0", optional = true }
+ nonebot-test = { path = "relative/path/to/nonebot-test/", develop = true }
然后使用 poetry 重新安装依赖即可:
poetry update
poetry install
现在启动你的 bot,本地nonebot-test
包就可以开始工作了,打开 localhost:2333
(不需要打开前面所述的前端开发服务器:8080)就可以查看实时最新的前端页面了。
python bot.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nonebot-plugin-test-0.2.0.tar.gz
(538.8 kB
view hashes)
Built Distribution
Close
Hashes for nonebot-plugin-test-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9ee997c5c96160de4af02d10a7c6301b3fc4e942df7e70906df0534606ea23b |
|
MD5 | 2f604638f7b72b09b58730d119815a82 |
|
BLAKE2b-256 | 923f75ad4d3fba19e1ba901a5bde9470ea0f2a7a0c3d8c4f6be4a8932d7b9455 |
Close
Hashes for nonebot_plugin_test-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75cd18cc282815a03250bb86c7d2a8d6a66a5064ac335bedc9a3e268a1e7dd13 |
|
MD5 | 53922a206b3c8b30063f576911af041b |
|
BLAKE2b-256 | dc492e711e9b8cd2b61d9a9580fcdbc4ea17198e9d26f8bd5d250b9a93734b24 |