Skip to content

Commit

Permalink
fix: 戳一戳适配 NapCat、文档整理 (#122)
Browse files Browse the repository at this point in the history
Co-authored-by: MistEO <[email protected]>
  • Loading branch information
HYY1116 and MistEO authored Oct 24, 2024
1 parent 5f48858 commit a86ed6e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 25 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 协议端实现

### 贡献者

Expand Down
31 changes: 11 additions & 20 deletions docs/Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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
Expand All @@ -91,12 +101,6 @@ nb run # 运行

**注意!请不要关闭这个命令行窗口!这会导致 Pallas-Bot 停止运行!**

## 访问后台并登陆账号

一切顺利的话,在加载完后你大概会看到一个显眼链接,把它复制到浏览器打开
(本地部署的话可以直接访问 <http://127.0.0.1:8080/go-cqhttp/>

然后就是比较直观的操作了,直接添加你的账号并登陆即可

## 后续更新

Expand All @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions src/plugins/greeting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/take_name/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
})

Expand Down

1 comment on commit a86ed6e

@MliKiowa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

戳一戳自NapCat 3.6.0及以后的版本在Linux平台 (amd64, arm64), MacOS平台(amd64, arm64),Windows平台 (amd64) 已内置 PacketBackend 实现

Image

Please sign in to comment.