文章目录
- 一.安装pipx
- 二.安装nonebot
- 三.部署第三方插件
- 3.1 服务器状态查看
一.安装pipx
python3 -m pip3 install --user pipx
python3 -m pipx ensurepath
重新打开远程窗口
二.安装nonebot
pipx install nb-cli
[?] 要使用哪些驱动器? QQ (QQ 官方机器人)
[?] 要使用哪些适配器? HTTPX (HTTPX 驱动器), websockets (websockets 驱动器)
[?] 立即安装依赖? (Y/n) Yes
[?] 创建虚拟环境? (Y/n) Yes
vim .env
ENVIRONMENT=dev
DRIVER=~httpx+~websockets
# 沙箱模式开启,线上关闭
QQ_IS_SANDBOX=true
COMMOND_START=["/"]
QQ_BOTS='[
{
"id":"xxxxxxxx",
"token":"xxx",
"secret":"xxxxx",
"intent":{
"c2c_group_at_messages":true
# 线上开启,并在上一句添加,分割
# "public_guild_messages":true
}
}
]'
SUPERUSERS=["xxxxxx"]
server_status_enabled=true
server_status_truncate=true
SERVER_STATUS_TEMPLATE='
CPU: {{ "%02d" % cpu_usage }}%
Memory: {{ "%02d" % memory_usage.percent }}%
Runtime: {{ runtime | relative_time | humanize_delta }}
{% if swap_usage.total %}Swap: {{ "%02d" % swap_usage.percent }}%{% endif %}
Disk:
{% for name, usage in disk_usage.items() %}
{{ name }}: {{ "%02d" % usage.percent }}%
{% endfor %}'
server_status_only_superusers=false
nb run --reload
运行机器人
官q robot超级账号获取
将机器人回复的日志记录,这里即为openid
SUPERUSERS=["","xxxxxx"]
三.部署第三方插件
3.1 服务器状态查看
nb plugin install nonebot-plugin-status
vim .env
配置项
SUPERUSERS=["xxxxxx"]
server_status_enabled=true
server_status_truncate=true
SERVER_STATUS_TEMPLATE='
CPU: {{ "%02d" % cpu_usage }}%
Memory: {{ "%02d" % memory_usage.percent }}%
Runtime: {{ runtime | relative_time | humanize_delta }}
{% if swap_usage.total %}Swap: {{ "%02d" % swap_usage.percent }}%{% endif %}
Disk:
{% for name, usage in disk_usage.items() %}
{{ name }}: {{ "%02d" % usage.percent }}%
{% endfor %}'
server_status_only_superusers=false