A plugin for restarting NTQQ when bot disconnection
Project description
⚠警告
①本插件仅适用于Windows用户!(原理上使用了WinAPI和Win命令行)
②本插件由于Windows的窗口句柄的原因,在插件开启/关闭时会杀死存在的所有QQ进程!
③本插件只适用于NTQQ登录过期的情况(此情况仍旧可以重启后正常登录),
对于其他情况(包括但不限于账号冻结、版本过低),无法提供有效的解决方案 !
📖 介绍
此插件主要用于帮助llonebot用户在长时间运行机器人的情况下, 遇到的NTQQ登录过期导致Bot下线的情况。
当Bot断连时,本插件会自动重启NTQQ并窗口最小化。(账号登录靠NTQQ自带的自动登录)
💿 安装
使用 nb-cli 安装
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot-plugin-ntqq-restart
使用包管理器安装
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令pip
pip install nonebot-plugin-ntqq-restart
pdm
pdm add nonebot-plugin-ntqq-restart
poetry
poetry add nonebot-plugin-ntqq-restart
conda
conda install nonebot-plugin-ntqq-restart
打开 nonebot2 项目根目录下的 pyproject.toml
文件, 在 [tool.nonebot]
部分追加写入
plugins = ["nonebot-plugin-ntqq-restart"]
⚙️ 配置
在 nonebot2 项目的.env
文件中添加下表中的必填配置
配置项 | 必填 | 默认值 | 说明 |
---|---|---|---|
NTQQ_Path | 是 | 无 | NTQQ的.exe文件的完整路径 |
enable_restart_when_disc | 否 | True | 允许Bot断连后重启NTQQ |
enable_login_when_nbrun | 否 | False | 允许nb加载时运行NTQQ |
enable_close_qq_when_shutdown | 否 | False | 允许nb关闭时关闭NTQQ |
restart_after_disc_time | 否 | 10 | 在Bot断连的{int}秒后重启NTQQ |
retry_max_time | 否 | 5 | 重试NTQQ窗口最小化的最大时间(秒) |
🎉 使用
①插件配置
你可以参照配置文件示例或文档-配置以配置插件参数
②NTQQ端设置(此两个选项保持打开状态)
③配置后直接运行nonebot即可
nb run
效果图
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
Built Distribution
Close
Hashes for nonebot_plugin_ntqq_restart-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff866b4f1059486c28b7973f1320693fbf88d832a31e38c63a1c3ecfa584cdb4 |
|
MD5 | 3c779db09d061af9b59317839b98053b |
|
BLAKE2b-256 | 353d8f8187259ef4c7595b06c1e6982252743149a33090c1468a09f16c91e404 |
Close
Hashes for nonebot_plugin_ntqq_restart-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 616126a086f0aad9018ba96dece261aa7bf8d461abe74f3bd61f0925e03c504c |
|
MD5 | 165345779c916a5f9d10de660f66dde9 |
|
BLAKE2b-256 | 7804350dfe2b464a0ee633761606ea06f02e9d8c9dca6735ec35b94a6838a32b |