From a86ed6e1b4124b7eb477dbd34246da7b139f62df Mon Sep 17 00:00:00 2001 From: HYY <95246895+HYY1116@users.noreply.github.com> Date: Fri, 25 Oct 2024 01:07:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=88=B3=E4=B8=80=E6=88=B3=E9=80=82?= =?UTF-8?q?=E9=85=8D=20NapCat=E3=80=81=E6=96=87=E6=A1=A3=E6=95=B4=E7=90=86?= =?UTF-8?q?=20(#122)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: MistEO --- README.md | 3 ++- docs/Deployment.md | 31 +++++++++++-------------------- src/plugins/greeting/__init__.py | 6 ++++-- src/plugins/take_name/__init__.py | 4 ++-- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 801bf36..8c98046 100644 --- a/README.md +++ b/README.md @@ -89,13 +89,14 @@ ### 开源库 [nonebot2](https://github.com/nonebot/nonebot2): 跨平台 Python 异步聊天机器人框架 -[go-cqhttp](https://github.com/Mrs4s/go-cqhttp): cqhttp的golang实现,轻量、原生跨平台. +~~[go-cqhttp](https://github.com/Mrs4s/go-cqhttp): cqhttp的golang实现,轻量、原生跨平台.~~ [nonebot-plugin-gocqhttp](https://github.com/mnixry/nonebot-plugin-gocqhttp): 一款在NoneBot2中直接运行go-cqhttp的插件, 无需额外下载安装 [jieba_fast](https://github.com/deepcs233/jieba_fast): 高效的中文分词库 [demucs](https://github.com/facebookresearch/demucs): Code for the paper Hybrid Spectrogram and Waveform Source Separation [so-vits-svc](https://github.com/innnky/so-vits-svc): 基于vits与softvc的歌声音色转换模型 [ChatRWKV](https://github.com/BlinkDL/ChatRWKV): ChatRWKV is like ChatGPT but powered by RWKV (100% RNN) language model, and open source. [PaddleSpeech](https://github.com/PaddlePaddle/PaddleSpeech): Easy-to-use Speech Toolkit including Self-Supervised Learning model, SOTA/Streaming ASR with punctuation, Streaming TTS with text frontend, Speaker Verification System, End-to-End Speech Translation and Keyword Spotting. Won NAACL2022 Best Demo Award. +[NapCat](https://github.com/NapNeko/NapCatQQ): 现代化的基于 NTQQ 的 Bot 协议端实现 ### 贡献者 diff --git a/docs/Deployment.md b/docs/Deployment.md index 59d4236..4f6d11d 100644 --- a/docs/Deployment.md +++ b/docs/Deployment.md @@ -52,7 +52,6 @@ ```bash nb plugin install nonebot_plugin_apscheduler - nb plugin install nonebot_plugin_gocqhttp nb driver install websockets nb driver install fastapi ``` @@ -82,6 +81,17 @@ 若安装失败,在 Windows 上可能需要额外安装 `Visual Studio`,Linux 上需要 `build-essential` 注:项目将优先尝试导入 `jieba-fast` 库,如果导入失败则使用 `jieba` 库,无需手动修改代码 +7. 安装并配置 NapCat + + 若使用 `NapCat` 作为 QQ 客户端,可重新支持了戳一戳功能 ~~目前就改了这个~~ 。具体部署方法参照 [NapCat](https://napneko.com/guide/start-install) 官方步骤。 + 在 NapCat 配置文件中使用反向 WebSocket 连接牛牛 + + ```bash + ws://localhost:8080/onebot/v11/ws + ``` + + **注意!使用戳一戳功能需要用到 NapCat 自有 API,因此需要额外配置 [PacketServer](https://napneko.com/config/advanced#%E9%85%8D%E7%BD%AE-packetserver)** + ## 启动 Pallas-Bot ```bash @@ -91,12 +101,6 @@ nb run # 运行 **注意!请不要关闭这个命令行窗口!这会导致 Pallas-Bot 停止运行!** -## 访问后台并登陆账号 - -一切顺利的话,在加载完后你大概会看到一个显眼链接,把它复制到浏览器打开 -(本地部署的话可以直接访问 ) - -然后就是比较直观的操作了,直接添加你的账号并登陆即可 ## 后续更新 @@ -116,19 +120,6 @@ AI 功能均对设备硬件要求较高(要么有一块 6G 显存或更高的 配置 AI 功能请参考 [部署教程 AI 篇](AIDeployment.md) -## FAQ - -### 一直无法登陆 - -最近腾讯管得严了(所以不要用大号),可以参考 https://github.com/Mrs4s/go-cqhttp/issues/1939 尝试解决下 - -### 牛牛只发语音不发文字怎么办? - -多半是被风控了( WebUI 上点开账号可以看到输出提示) -自己拿手机登下随便找个群发句话,应该会有提示让你验证 - -如果没有就多挂几天吧,可能过几天就好了 ( ´_ゝ` ) - ## 开发者群 QQ 群: [牛牛听话!](https://jq.qq.com/?_wv=1027&k=tlLDuWzc) diff --git a/src/plugins/greeting/__init__.py b/src/plugins/greeting/__init__.py index 0263fc6..b827e74 100644 --- a/src/plugins/greeting/__init__.py +++ b/src/plugins/greeting/__init__.py @@ -108,8 +108,10 @@ async def handle_first_receive(bot: Bot, event: Event, state: T_State): await asyncio.sleep(delay) config.refresh_cooldown('poke') - poke_msg: str = '[CQ:poke,qq={}]'.format(event.user_id) - await all_notice.finish(Message(poke_msg)) + await get_bot(str(event.self_id)).call_api('group_poke', **{ + "group_id": event.group_id, + "user_id": event.user_id + }) elif event.notice_type == 'group_increase': if event.user_id == event.self_id: diff --git a/src/plugins/take_name/__init__.py b/src/plugins/take_name/__init__.py index 694f7e9..9ca4472 100644 --- a/src/plugins/take_name/__init__.py +++ b/src/plugins/take_name/__init__.py @@ -70,8 +70,8 @@ async def change_name(): }) # 戳一戳 - await bot.call_api('send_group_msg', **{ - 'message': Message('[CQ:poke,qq={}]'.format(target_user_id)), + await bot.call_api('group_poke', **{ + 'user_id': target_user_id, 'group_id': group_id })