Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: adapter-qq not can send private message. #1456

Open
Mcayear opened this issue Sep 11, 2024 · 1 comment
Open

Bug: adapter-qq not can send private message. #1456

Mcayear opened this issue Sep 11, 2024 · 1 comment
Labels
bug BUG

Comments

@Mcayear
Copy link

Mcayear commented Sep 11, 2024

Describe the bug

QQ适配器发送私聊消息时出错

    public async sendQQPrivateMsg(employeeName: string, content: h[]) {
        if (this.debug) {
            this.logger.info(content.toString());
        }
        console.log(this.userInfo.qqid)
        if (this.employeeNoDisplay && employeeName.length) {
            this.qqBot.sendPrivateMessage(this.userInfo.qqid, [h.text("工号 " + employeeName + ": "), ...content]);
        } else {
            this.qqBot.sendPrivateMessage(this.userInfo.qqid, content);
        }
    }
2024-09-12 06:26:34 [I] http { data: null, url: 'https://sandbox.api.sgroup.qq.com/v2/groups/D7008FC26B8C34C05F54F4FB7CD1E3A8/messages', status: 500, statusText: 'Internal Server Error', headers: HeadersList { cookies: null, [Symbol(headers map)]: Map(8) { 'date' => { name: 'Date', value: 'Wed, 11 Sep 2024 22:26:33 GMT' }, 'content-type' => { name: 'Content-Type', value: 'application/json' }, 'content-length' => { name: 'Content-Length', value: '105' }, 'connection' => { name: 'Connection', value: 'keep-alive' }, 'x-tps-trace-id' => { name: 'X-Tps-Trace-Id', value: 'a620b1be6b2c44f6f6ef66bf5672282b' }, 'access-control-allow-credentials' => { name: 'Access-Control-Allow-Credentials', value: 'true' }, 'access-control-allow-methods' => { name: 'Access-Control-Allow-Methods', value: 'GET, POST, OPTIONS' }, 'access-control-allow-headers' => { name: 'Access-Control-Allow-Headers', value: 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,authorization' } }, [Symbol(headers map sorted)]: null } }
2024-09-12 06:26:34 [W] app Error: Internal Server Error
                            at [cordis.invoke] (D:\koishi-app\node_modules\@cordisjs\plugin-http\lib\index.cjs:335:23)
                            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
                            at GroupInternal.<computed> (D:\koishi-app\node_modules\@satorijs\adapter-qq\src\internal\internal.ts:33:32)
                            at send (D:\koishi-app\node_modules\@satorijs\adapter-qq\src\message.ts:250:13)
                            at QQMessageEncoder.flush (D:\koishi-app\node_modules\@satorijs\adapter-qq\src\message.ts:278:5)
                            at QQMessageEncoder.send (D:\koishi-app\node_modules\@satorijs\core\src\message.ts:54:5)
                            at Proxy.sendMessage (D:\koishi-app\node_modules\@satorijs\core\src\bot.ts:188:22)

Steps to reproduce

使用 qqBot 发送私聊消息。

Expected behavior

发现 API 调用与预期不符,报错中的 /v2/groups/D7008FC26B8C34C05F54F4FB7CD1E3A8/messages 是发送群聊消息。

开发者文档 中要求使用 /v2/users/{openid}/messages 来发送私聊消息。

Screenshots

No response

Versions

System:
OS: Windows 10 10.0.19045
CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz

Binaries:
Node: 20.11.0
Yarn: 4.1.1

Koishi:
Core: 4.17.12
Console: 5.29.3

Additional context

adapter-qq: v4.8.2

@Mcayear Mcayear added the bug BUG label Sep 11, 2024
@Mcayear Mcayear changed the title Bug: Bug: adapter-qq not can send private message. Sep 11, 2024
@DGCK81LNN
Copy link
Contributor

DGCK81LNN commented Sep 12, 2024

可以复现。@koishijs/[email protected]

(我使用的 send 指令同 @koishijs/plugin-echo 的 echo)

不指定用户id时可以正常发送。指定用户id发送时报错。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug BUG
Projects
None yet
Development

No branches or pull requests

2 participants