Giter Club home page Giter Club logo

onebots's Introduction

Hi there 👋!I'm lc

Anurag's GitHub stats

Top Langs

More Repo

Readme Card

onebots's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

onebots's Issues

WebConsole 无法选中日志及输入ticket报错

  • WebConsole 无法选中日志并复制
  • 输入滑动验证码后报错

第一个问题,[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)

多个反向ws出现bug

onebots在设置多个反向ws地址时,会对每个地址建立 设置过的反向地址数量 次的连接
Cache_709b99409cfcae49.png

Cache_-5429aa541cd42404.png

Cache_-443280510409d8da.png

Cache_2b310f4f6c9f4df7.png

BUG:v11协议通过发送base64的语音数据时无法成功发送

bot端代码:
image
image
(其中wav_encode_to_tencent_silk函数将wav格式语音转换为silk格式的bytes)

onebot侧现象:
image

nonebot2版本:2.1.2
nonebot-adapter-onebot版本:2.3.1
onebots版本:0.6.1
发送语音时会将整个"[cq:record.....]"的字符串完整发送过来,而不是语音
image

可以保证的是语音转换正确,choronocat的red协议原样发送wav_encode_to_tencent_silk返回的bytes是可以正常播放的

BUG:v11协议通过发送base64的图片数据时无法成功发送

bot端代码:
image
image

onebot侧现象:
image

nonebot2版本:2.1.2
nonebot-adapter-onebot版本:2.3.1
onebots版本:0.6.1

发送图片时会提示无message,如果是文字+图片,图片会直接消失掉:
image

可以保证的是bytesIO返回的图片数据是正确的,因为gocq可以正常发送

V11自定义合并转发节点消息无法发送

{
    "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,请求超时。

image

OneBotV11的自定义合并转发节点

重要提醒

onebots0.0.3一下版本在公网环境部署时有安全性bug,请尽快升级到0.0.3版本

bug: onebotV11 上报数据的字段类型有误

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类型,望修复

苹果手机扫描,扫码后提示禁止登陆,错误码45

icqq协议,已经更新了最新版本qq
使用协议:Android_9.0.8.14755 [2024-01-23T10:48:12.849] [WARN] [icqq] - [禁止登录]登录失败,请前往QQ官网im.qq.com下载最新版QQ后重试,或通过问题反馈与我们联系。(错误码:45)

V11的合并转发再次无法发送

最新版的onebotsicqqjs/icqq 又出现了合并转发一直超时的问题,我这边用的时候好像 action 匹配不到就会一直超时,应该是 V11 没有像 V12 那样匹配不到 action 就抛出 404 异常的兜底。

如何配置sign_api_addr?

不太懂nodejs,现在手表登录过一阵就会被风控,查了解决办法说是配置qsign服务,我直接在config.yaml里加了sign_api_addr的字段好像没有用,有配置方法吗?

[BUG] refreshToken错误

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:// 格式发出去的

QQ里显示的:
3F}XQ8AH7FQ8I1

控制台屏显:
7F2%IKA62S8F19P78_M)BZ8

看现象应该是把base64给打印到屏幕上了

Bug: V11 文本消息上报报错

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)

bug:发送消息响应数据有误

onebotV11规定发送消息响应数据message_id应为number类型

image
image

代码中为string类型

image
image

使用OneBot开发框架Shiro发送消息获取到的Message_id为String字符串就像是这样“VHrJvQAACLeJ0L3QZMVuXgE=”的字符串数据

pm2 后台运行怎么搞

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撤回消息事件detail_type错误

协议: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,
}

未找到 <qq号>_v11.jsondb 文件

原gocqhttp + nonebot2 的机器人项目,拟迁移到onebots
运行环境:Windows Server 2012

已使用 npm 安装 icqq 和 onebots 模块,并配置了config文件
使用命令npx onebots -r icqq启动项目时,报 未找到 /根目录/data/<qq号>_v11.jsondb 文件 错误

文档和issue里没找到解决方法,不太清楚这个文件是怎么生成的

onebot v11是否不能发送图片类型?

image
经过测试,使用base64和路径格式发送消息都无法发送图片,所以问一下这里发送图片是否有别的格式要求或者问题,

使用的是8.9.80的apad协议sgin登录

Feature: 希望兼容无 TTY 环境

想在 Docker 等容器环境中使用,而这类环境难以完成 ticket 、 短信验证码等用户输入的传输。

参考方案一:

提供类似 go-cqhttp 那种网页直接辅助用户获取 ticket ,短信验证码可以写个简易网页,给个表单,通过这个表单传递短信验证码,onebots 轮询查询 ticket 和短信验证码。这又分为统一的域名服务和本地服务两种实现。

参考方案二:

指定文件名,用户可以将 ticket 和 短信验证码写入到指定文件中,客户端轮询读取文件内容,当文件内容不为空时即视为用户提交了所需要的参数。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.