adapter-qq收不到指令

adapter-qq 默认是关闭状态。没有改过配置的话 adapter-qq 不会启动,发送消息没有回复是正常现象。

2 个赞

adapter-qq我已经配置完成并且启动测试过了,而且在我自己写的插件中使用ctx.on判断session.content关键词是能正常收发信息了的,下面是使用ctx.on判断session.content关键词的代码,完全按照文档写的

ctx.on('message', async (session) => {
  if (session.content === "信息") {
    await session.send("收到了哦!");
    const res = await ctx.http.get('/v2/user/get_user_info', {
        params: {
          qqguild: session.event.user.id,
          key: apikey
        }
      })
      .then(function (response) {
        return response;
      });
    await session.send(`${res.user.qq}的信息如下:\nid:${res.user.id}\n昵称:${res.user.name}\nQQ频道ID:${res.user.qqguild_id}\nKOOK:${res.user.kook_id}\nTelegram:${res.user.telegram_name}\nOSU:${res.user.osu_name}\n好感度:${res.user.favorability}\n硬币:${res.user.coin}\n上次签到日期:${res.user.check_in_time_last}\n签到排名:${res.user.check_rank}\n用户组:${res.user.group}\n注册时间:${res.user.registered_time}`);
  }
})

就是ctx.command指令不会触发,但是下面是在我的插件中的指令系统,它却无法触发,为了方便我就只使用了文档中最简单的代码,它一样无法在QQ频道中触发,但是我使用adapter-kook在KOOK和沙盒中测试过了却能触发

ctx.command('echoTest <message>' )
  .action((_, message) => message)
3 个赞

那只能说明是插件相互作用的问题。可以尝试卸载你自己安装的插件(不要动预装插件),并且删掉除了 ctx.command 以外的所有逻辑,然后重试是否能够响应。

2 个赞

作为其中的一种可能,请尝试如下的解决方法:

在「依赖管理」中找到「@koishijs/plugin-adapter-qq」一项,然后将版本切换为「4.1.11」,最后点击右上角确认。

2 个赞

两种方法都尝试过了,依旧无法解决问题 :smiling_face_with_tear:

3 个赞

好的,接下来麻烦提供一下收到 Session 的具体内容:

点击左侧栏的「资

2 个赞

没打完吧 :melting_face:

3 个赞

没打完,等我一下。

2 个赞

首先,再次提醒一下,请提供上面所述的四项信息。你在顶楼说「GUILD_MESSAGES已勾选」,这显然只能通过修改配置做到。只要你修改了配置,你就需要贴上修改了配置的截图。安装插件、启用插件等行为同样属于修改了配置。其他人的 adapter-qq 能够正常运作而你的无法运作,只可能是你的配置出了问题,而非其他方面的问题。

在贴出配置以后,可以按照如下方法操作:

点击左侧栏的「文件资源管理器」页面,选择 koishi.yml,在文件的 最开头顶格 添加这样的内容:

logger:
  levels:
    qq: 3

点击右上角的保存,然后点击左侧栏的「插件配置」页面,点击「全局设置」右上角的「重新启动」以重启 Koishi。

之后,再次对机器人发送 help 指令。

最后,按照上面相同的方法提供四项信息,我们会判断问题。

2 个赞

在插件的全局配置中我修改过prefix,加上了指令前缀左斜杠 “/” 并将左斜杠设置为了第一优先,第二则是为空,在adapter-qq插件中填入了机器人id、secret、token,并将type切换为private,sandbox开启,intents中勾选GUILD_MESSAGES,之后我创建了一个新的名为 user 的插件,并在工作区中进行开发,但是按照文档中编写指令系统ctx.command却无法收到信息,使用ctx.on判断session.content的文字却能收到


System:
OS: Linux 3.10 CentOS Linux 7 (Core)
CPU: (2) x64 Intel(R) Xeon(R) Platinum 8255C CPU @ 2.50GHz

Binaries:
Node: 18.18.2
npm: 10.2.3

Koishi:
Core: 4.15.6
Console: 5.19.5



从重启开始到发送了help和user插件的test123 123

{"id":1,"type":"info","level":2,"name":"app","meta":{},"content":"\u001b[38;5;15;1mKoishi/4.15.6\u001b[0m","timestamp":1701486427066}
{"id":2,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mgroup:entry\u001b[0m","timestamp":1701486427193}
{"id":3,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mgroup:basic\u001b[0m","timestamp":1701486427194}
{"id":4,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mcommands\u001b[0m","timestamp":1701486427194}
{"id":5,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mhelp\u001b[0m","timestamp":1701486427221}
{"id":6,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mlocales\u001b[0m","timestamp":1701486427229}
{"id":7,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mrate-limit\u001b[0m","timestamp":1701486427244}
{"id":8,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mtelemetry\u001b[0m","timestamp":1701486427257}
{"id":9,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mgroup:console\u001b[0m","timestamp":1701486427267}
{"id":10,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45manalytics\u001b[0m","timestamp":1701486427268}
{"id":11,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mconfig\u001b[0m","timestamp":1701486427287}
{"id":12,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mconsole\u001b[0m","timestamp":1701486427411}
{"id":13,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mdataview\u001b[0m","timestamp":1701486427486}
{"id":14,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mexplorer\u001b[0m","timestamp":1701486427501}
{"id":15,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mlogger\u001b[0m","timestamp":1701486427593}
{"id":16,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45minsight\u001b[0m","timestamp":1701486427607}
{"id":17,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mmarket\u001b[0m","timestamp":1701486427621}
{"id":18,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45msandbox\u001b[0m","timestamp":1701486427723}
{"id":19,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mstatus\u001b[0m","timestamp":1701486427740}
{"id":20,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mtheme-vanilla\u001b[0m","timestamp":1701486427784}
{"id":21,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mgroup:storage\u001b[0m","timestamp":1701486427796}
{"id":22,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mdatabase-sqlite\u001b[0m","timestamp":1701486427796}
{"id":23,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45massets-local\u001b[0m","timestamp":1701486427832}
{"id":24,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mgroup:adapter\u001b[0m","timestamp":1701486427855}
{"id":25,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45madapter-kook\u001b[0m","timestamp":1701486427856}
{"id":26,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45madapter-qq\u001b[0m","timestamp":1701486427886}
{"id":27,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mgroup:develop\u001b[0m","timestamp":1701486427914}
{"id":28,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45mhmr\u001b[0m","timestamp":1701486427915}
{"id":29,"type":"info","level":2,"name":"loader","meta":{"paths":[""]},"content":"apply plugin \u001b[38;5;45muser:vqgjle\u001b[0m","timestamp":1701486428004}
{"id":30,"type":"info","level":2,"name":"assets","meta":{"paths":["group:storage/assets-local"]},"content":"missing config \"selfUrl\", fallback to \"file:\" scheme","timestamp":1701486428141}
{"id":33,"type":"info","level":2,"name":"router","meta":{"paths":[""]},"content":"server listening at \u001b[38;5;170mhttp://127.0.0.1:5140\u001b[0m","timestamp":1701486428539}
{"id":57,"type":"debug","level":3,"name":"qq","meta":{"paths":["group:adapter/adapter-qq"]},"content":"url: wss://sandbox.api.sgroup.qq.com/websocket","timestamp":1701486429223}
{"id":58,"type":"info","level":2,"name":"adapter","meta":{"paths":["group:adapter/adapter-qq"]},"content":"connect to server: \u001b[38;5;44mwss://sandbox.api.sgroup.qq.com/websocket\u001b[0m","timestamp":1701486429763}
{"id":60,"type":"debug","level":3,"name":"qq","meta":{"paths":["group:adapter/adapter-qq"]},"content":"{ op: \u001b[33m0\u001b[39m, s: \u001b[33m1\u001b[39m, t: \u001b[32m'READY'\u001b[39m, d: { version: \u001b[33m1\u001b[39m, session_id: \u001b[32m'9ee8840b-706e-4ee3-8a42-616e44657b94'\u001b[39m, user: { id: \u001b[32m'13486757395816293983'\u001b[39m, username: \u001b[32m'可爱小纨素-测试中'\u001b[39m, bot: \u001b[33mtrue\u001b[39m, status: \u001b[33m1\u001b[39m }, shard: [ \u001b[33m0\u001b[39m, \u001b[33m1\u001b[39m ] } }","timestamp":1701486429924}
{"id":61,"type":"info","level":2,"name":"adapter","meta":{"paths":["group:adapter/adapter-kook"]},"content":"connect to server: \u001b[38;5;44mwss://ws.kaiheila.cn/gateway\u001b[0m","timestamp":1701486430070}
{"id":66,"type":"debug","level":3,"name":"qq","meta":{"paths":["group:adapter/adapter-qq"]},"content":"{ op: \u001b[33m11\u001b[39m }","timestamp":1701486471039}
{"id":68,"type":"debug","level":3,"name":"qq","meta":{"paths":["group:adapter/adapter-qq"]},"content":"{ op: \u001b[33m0\u001b[39m, s: \u001b[33m2\u001b[39m, t: \u001b[32m'MESSAGE_CREATE'\u001b[39m, id: \u001b[32m'MESSAGE_CREATE:08b3e6c596e6939980cc011098f56e38b701489fbfaaab06'\u001b[39m, d: { author: { avatar: \u001b[32m'https://qqchannel-profile-1251316161.file.myqcloud.com/169995552511845300acf2a001?t=1699955526'\u001b[39m, bot: \u001b[33mfalse\u001b[39m, id: \u001b[32m'10291085124237954812'\u001b[39m, username: \u001b[32m'Yuuz12'\u001b[39m }, channel_id: \u001b[32m'1817240'\u001b[39m, content: \u001b[32m'help'\u001b[39m, guild_id: \u001b[32m'14699859815162802995'\u001b[39m, id: \u001b[32m'08b3e6c596e6939980cc011098f56e38b701489fbfaaab06'\u001b[39m, member: { joined_at: \u001b[32m'2021-12-11T09:13:38+08:00'\u001b[39m, nick: \u001b[32m'Yuuz12'\u001b[39m, roles: [ \u001b[32m'4'\u001b[39m, \u001b[32m'16'\u001b[39m ] }, seq: \u001b[33m183\u001b[39m, seq_in_channel: \u001b[32m'183'\u001b[39m, timestamp: \u001b[32m'2023-12-02T11:08:15+08:00'\u001b[39m } }","timestamp":1701486495956}
{"id":72,"type":"debug","level":3,"name":"qq","meta":{"paths":["group:adapter/adapter-qq"]},"content":"{ op: \u001b[33m0\u001b[39m, s: \u001b[33m3\u001b[39m, t: \u001b[32m'MESSAGE_CREATE'\u001b[39m, id: \u001b[32m'MESSAGE_CREATE:08b3e6c596e6939980cc011098f56e38b80148aebfaaab06'\u001b[39m, d: { author: { avatar: \u001b[32m'https://qqchannel-profile-1251316161.file.myqcloud.com/169995552511845300acf2a001?t=1699955526'\u001b[39m, bot: \u001b[33mfalse\u001b[39m, id: \u001b[32m'10291085124237954812'\u001b[39m, username: \u001b[32m'Yuuz12'\u001b[39m }, channel_id: \u001b[32m'1817240'\u001b[39m, content: \u001b[32m'test123 123'\u001b[39m, guild_id: \u001b[32m'14699859815162802995'\u001b[39m, id: \u001b[32m'08b3e6c596e6939980cc011098f56e38b80148aebfaaab06'\u001b[39m, member: { joined_at: \u001b[32m'2021-12-11T09:13:38+08:00'\u001b[39m, nick: \u001b[32m'Yuuz12'\u001b[39m, roles: [ \u001b[32m'4'\u001b[39m, \u001b[32m'16'\u001b[39m ] }, seq: \u001b[33m184\u001b[39m, seq_in_channel: \u001b[32m'184'\u001b[39m, timestamp: \u001b[32m'2023-12-02T11:08:30+08:00'\u001b[39m } }","timestamp":1701486510990}
{"id":76,"type":"debug","level":3,"name":"qq","meta":{"paths":["group:adapter/adapter-qq"]},"content":"{ op: \u001b[33m11\u001b[39m }","timestamp":1701486512292}
{"id":80,"type":"debug","level":3,"name":"qq","meta":{"paths":["group:adapter/adapter-qq"]},"content":"{ op: \u001b[33m11\u001b[39m }","timestamp":1701486553546}
3 个赞

试试艾特机器人后加指令?)

3 个赞

实测有效

5 个赞

没有任何 Koishi 教程里提到开启 sandbox。为何要开启?


理论上私域不需要 at 机器人即可触发指令。上面的 sandbox 可能是原因,建议进行排查。此外,如果有安装了其他插件的话,需要一并提供。

2 个赞

我搭了一个 私域 bot 也需要 @ 才回复,蹲一个不需要 @ 的方案或配置

我是在群里

1 个赞

似乎我的配置是正确的,接下来我将使用特权卡

企业绿色通道

1 个赞



@ koishijs/plugin-adapter-qq 4.2.3
我的频道私域bot,不需要 @ 触发的配置,感觉也没什么特别的,不是在沙盒频道测试的

1 个赞

这是群还是频道
好的是频道(
群里目前只能 @

1 个赞

目前群聊没有私域(

1 个赞


是的,我的错

1 个赞