lc-cn / onebots Goto Github PK
View Code? Open in Web Editor NEW基于icqq的多例oneBot管理应用
Home Page: https://docs.onebots.org/
License: MIT License
基于icqq的多例oneBot管理应用
Home Page: https://docs.onebots.org/
License: MIT License
第一个问题,[email protected]
这个版本是可以选中复制的。
第二个问题,以下是输入内容后的报错信息:
[2024-03-26T14:46:40.187] [MARK] [OneBots:icqq] - 请输入滑块验证返回的ticket
unhandledRejection TypeError: process_1.default.stdin.write is not a function
at WebSocket.<anonymous> (/app/node_modules/onebots/lib/server/app.js:221:56)
at WebSocket.emit (node:events:517:28)
at Receiver.receiverOnMessage (/app/node_modules/ws/lib/websocket.js:1209:20)
at Receiver.emit (node:events:517:28)
at /app/node_modules/ws/lib/receiver.js:608:16
at node:internal/process/task_queues:140:7
at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
请问这个是需要更新协议还是需要换个qq
默认iPad协议
如何修改成其他协议呢
按照#局部安装配置完后
希望支持onebotv11与v12的正向 WebSocket
缺乏相关文档引导
{
"action":"send_private_msg",
"params":{
"user_id":10000000,
"message":[
{
"type":"node",
"data":{
"user_id":100006,
"nickname":"BOT",
"content":[
{
"type":"text",
"data":{
"text":"测试forward消息"
}
}
]
}
},
{
"type":"node",
"data":{
"user_id":100006,
"nickname":"BOT",
"content":[
{
"type":"image",
"data":{
"file":"https://cdn.seovx.com/?mom=302",
"cache":1,
"proxy":1
}
}
]
}
}
]
},
"echo":"lqmfcxia1i3WIt"
}
发送的是这样的一个消息,onebots
端好像无法处理,我将参数中的 content
更换为 message
后只保留第一个纯文本时可以成功发送(但是会多发送一个undefined消息),如果加入第二个图片类型消息就会跟之前一样无法发送,错误类型是408
,请求超时。
#41
响应数据的 message_id 大概率会返回 IhJsEwtf/KIAAAWxo1RDGWU9CwwB 这样的字符串 而不是 int
onebots0.0.3一下版本在公网环境部署时有安全性bug,请尽快升级到0.0.3版本
onebot协议V11
使用ws正向连接到机器人后,接收群消息上报数据得到了如下数据
{ "post_type": "message", "message_id": "H6oYlHh+63gAAXkXCGrChWSDAE0B", "user_id": "2021583736", "time": 1686306893, "seq": 96535, "rand": 141214341, "font": "微软雅黑", "message": "test", "raw_message": "test", "message_type": "group", "sender": { "user_id": 2021583736, "nickname": "咕咕咕", "card": "", "sex": "unknown", "age": 0, "area": "", "level": 1, "role": "owner", "title": "" }, "group_id": "531241100", "group_name": "交流群", "block": false, "sub_type": "normal", "anonymous": null, "atme": false, "atall": false, "group": {}, "member": {}, "self_id": 1667047824 }
其中 message_id 和 font 为字符串类型
按onebotV11标准群消息应当都为int类型,望修复
icqq协议,已经更新了最新版本qq
使用协议:Android_9.0.8.14755 [2024-01-23T10:48:12.849] [WARN] [icqq] - [禁止登录]登录失败,请前往QQ官网im.qq.com下载最新版QQ后重试,或通过问题反馈与我们联系。(错误码:45)
最新版的onebots
和icqqjs/icqq
又出现了合并转发一直超时的问题,我这边用的时候好像 action 匹配不到就会一直超时,应该是 V11 没有像 V12 那样匹配不到 action 就抛出 404 异常的兜底。
不太懂nodejs,现在手表登录过一阵就会被风控,查了解决办法说是配置qsign服务,我直接在config.yaml里加了sign_api_addr的字段好像没有用,有配置方法吗?
OS: Arch Linux x86_64
Node: v21.5.0
OneBots: 0.4.50
Icqq: 0.6.8
icqq的协议版本指定为8.9.93
使用aPad扫码登录
unhandledRejection TypeError: this.getT544 is not a function
at Client.tokenLogin (/home/kinare/Services/OneBots/node_modules/.pnpm/[email protected]/node_modules/icqq/lib/core/base-client.js:646:34)
at Client.refreshToken (/home/kinare/Services/OneBots/node_modules/.pnpm/[email protected]/node_modules/icqq/lib/core/base-client.js:1382:86)
at Client.refreshToken (/home/kinare/Services/OneBots/node_modules/.pnpm/[email protected]/node_modules/icqq/lib/core/base-client.js:521:35)
at heartbeatSuccess (/home/kinare/Services/OneBots/node_modules/.pnpm/[email protected]/node_modules/icqq/lib/core/base-client.js:1343:28)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
我原来是 gocq 反向连接的 nb, 之前是正常使用的,现在换到 onebots,但是在发送图文混合内容时出错,发送代码:
@help.handle()
async def _(event: MessageEvent, bot:Bot):
bot_id = int(bot.self_id)
if bot_id in config.bot_names:
message = f"<font color=green><b>{config.bot_names[bot_id]}目前支持的功能:</b></font>\n(请将UID替换为需要操作的B站UID)\n"
else:
message = "<font color=green><b>Bot目前支持的功能:</b></font>\n(请将UID替换为需要操作的B站UID)\n"
plugin_names:List[str] = []
for matchers_list in matchers.values():
for matcher in matchers_list:
if (
matcher.plugin_name
and matcher.plugin_name.startswith("haruka_bot")
and matcher.__doc__
):
doc = matcher.__doc__
plugin_names.append(doc)
func_name = doc[2:]
open_func = f"开启{func_name}"
close_func = f"关闭{func_name}"
if (open_func in plugin_names) and (close_func in plugin_names):
plugin_names.remove(open_func)
plugin_names.remove(close_func)
plugin_names.append(f"开启|关闭{func_name}")
message += '\n'.join(plugin_names) + "\n"
message += "点歌\n"
message += "绘画\n------------------------\n"
message += "示例:开启动态 123456\n"
message += "Tips:只发送 \"绘画\" 两个字将显示详细绘画帮助内容\n"
message = MessageSegment.image(await text_to_img(message, width=425))
message += f"\n当前版本:v{__version__}\n" "https://github.com/Misaka-Mikoto-Tech"
await help.finish(message)
其中 text_to_image
的返回类型是 bytes
, 我看 onebot
是以 base64://
格式发出去的
看现象应该是把base64给打印到屏幕上了
icqq 是可以通过 ver 指定协议版本号的,希望 onebots 也支持
node: 18.0.0
npm: 8.6.0
[email protected]
[email protected]
[email protected]
[2023-12-07T10:45:02.745] [INFO] [OneBots:icqq-V11(**********)] - ws客户端(/icqq/**********/V11)已连接
[2023-12-07T10:45:08.113] [INFO] [icqq] - recv from: [Private: **********(friend)] sss
unhandledRejection TypeError: Cannot read properties of undefined (reading 'text')
at /bot/onebot/node_modules/onebots/lib/adapters/icqq/index.js:210:34
at Array.map (<anonymous>)
at IcqqAdapter.toCqcode (/bot/onebot/node_modules/onebots/lib/adapters/icqq/index.js:208:38)
at V11.dispatch (/bot/onebot/node_modules/onebots/lib/service/V11/index.js:224:45)
at IcqqAdapter.<anonymous> (/bot/onebot/node_modules/onebots/lib/service/V11/index.js:107:18)
at IcqqAdapter.emit (node:events:527:28)
at Client.<anonymous> (/bot/onebot/node_modules/onebots/lib/adapters/icqq/index.js:279:18)
at Client.trip (/bot/onebot/node_modules/triptrap/lib/index.js:75:22)
at Client.emit (/bot/onebot/node_modules/icqq/lib/core/base-client.js:245:21)
at Client.em (/bot/onebot/node_modules/icqq/lib/client.js:720:18)
onebots:dev分支
icqq: 0.6.6
如题,根据debug测出,getSelfInfo
方法返回的 status
是 0
,即 good
字段的值,跟判断的online
始终无法匹配上,造成一直返回的是 false
。
module.exports = {
apps: [{
name: 'your-app-name',
script: 'onebots',
args: '-c config.yaml'
}]
}
pm2 start ecosystem.config.js
AI 给了我这个代码,但是跑不起来 (╯﹏╰)
onebot协议V11
使用ws正向连接到机器人后,接收群消息上报数据得到了如下数据
{ "post_type": "message", "message_id": "H6oYlHh+63gAAXkXCGrChWSDAE0B", "user_id": "2021583736", "time": 1686306893, "seq": 96535, "rand": 141214341, "font": "微软雅黑", "message": "test", "raw_message": "test", "message_type": "group", "sender": { "user_id": 2021583736, "nickname": "咕咕咕", "card": "", "sex": "unknown", "age": 0, "area": "", "level": 1, "role": "owner", "title": "" }, "group_id": "531241100", "group_name": "交流群", "block": false, "sub_type": "normal", "anonymous": null, "atme": false, "atall": false, "group": {}, "member": {}, "self_id": 1667047824 }
其中 user_id 和 group_id 为字符串类型
按onebotV11标准群消息应当为int类型,望修复
协议:OneBot-V12
连接方式:Websocket正向
现象:
在客户端收到撤回消息通知中detail_type为friend,而根据OneBot-v12协议,detail_type应为private_message_delete
{
"id": "...",
"impl": "onebots",
"version": 12,
"platform": "qq",
"self": {
"user_id": "xxx",
"platform": "qq",
"nickname": "xxx",
"user_displayname": "",
},
"self_id": 1919810,
"time": 1678650186,
"detail_type": "friend",
"type": "notice",
"sub_type": "recall",
"post_type": "notice",
"notice_type": "friend",
"user_id": "114514",
"friend": {},
"message_id": "xxxx",
"operator_id": 114514,
"seq": 22355,
"rand": 603984703,
}
原gocqhttp + nonebot2 的机器人项目,拟迁移到onebots
运行环境:Windows Server 2012
已使用 npm 安装 icqq 和 onebots 模块,并配置了config文件
使用命令npx onebots -r icqq
启动项目时,报 未找到 /根目录/data/<qq号>_v11.jsondb 文件 错误
文档和issue里没找到解决方法,不太清楚这个文件是怎么生成的
V12的消息缺少id字段
OneBots: 0.4.50
想在 Docker 等容器环境中使用,而这类环境难以完成 ticket
、 短信验证码等用户输入的传输。
参考方案一:
提供类似 go-cqhttp
那种网页直接辅助用户获取 ticket
,短信验证码可以写个简易网页,给个表单,通过这个表单传递短信验证码,onebots
轮询查询 ticket
和短信验证码。这又分为统一的域名服务和本地服务两种实现。
参考方案二:
指定文件名,用户可以将 ticket
和 短信验证码写入到指定文件中,客户端轮询读取文件内容,当文件内容不为空时即视为用户提交了所需要的参数。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.