NoneBot2 安装与配置
NONEBOT2 SETUP
- 科室:结构科
- 编目范围:持续更新
- 相关人物:SeaSmall
- 访问范围:OPEN ARCHIVE
NoneBot2 是一个现代的、渐进式的 Python 异步机器人框架,基于「预定义字符串匹配」规则,插件化程度高。
📱 手机 Termux 安装
安装 Ubuntu 环境
与云崽相同,先安装 Termux 和 Ubuntu 容器。
curl -sL https://wintersea.cn/ziyuan/sh/u.sh | bash
./ubuntu.sh
激活虚拟环境
./u.sh
bash ./first.sh
source myenv/bin/activate
安装 NoneBot
pip install nb-cli
nb
按照提示选择:回车 → 回车 → 项目名 → 选择驱动器 → 完成。
安装插件并启动
cd 项目名
nb plugin install nonebot-plugin-gocqhttp
nb run
打开浏览器访问 http://127.0.0.1:8080/go-cqhttp/ 配置账号。
🖥️ Ubuntu 安装
bash <(curl -sL https://wintersea.cn/ziyuan/sh/SeaSmall_Shell.sh)
8
0
2
1
source env/bin/activate
nb
💻 Windows 安装
安装 Python
下载安装 Python 3.10 (Win10) 或 Python 3.8 (Win7)。
安装 NoneBot
pip install nb-cli
nb
启动项目
cd 项目名
nb plugin install nonebot-plugin-gocqhttp
nb run
❓ 常见问题
如何重启?
- 手机:
./u.sh→cd ~→cd 项目名→nb run - Ubuntu:
sudo -i→cd 项目名→nb run - Windows:到项目目录 → 打开 cmd →
nb run
本文来自 SeaSmall 个人博客的既有文档,内容版权归 SeaSmall 所有。