Closed d0j1a1701 closed 1 month ago
如果你使用以下指令尝试从 @ 中读取用户 id
ctx.command("test <user:user>") .action(async (_, userStr) => { ctx.logger('test').info(userStr) })
你会发现在 Telegram 适配器下你读了个寂寞
以下是详细日志
2024-08-25 14:59:28 [D] telegram [response] { ok: true, result: [ { update_id: 561271410, message: { message_id: 425, from: { id: 5420165211, is_bot: false, first_name: 'd0j1a1701', username: 'd0j1a1701', language_code: 'zh-hans', is_premium: true }, chat: { id: -1002201482660, title: '「香草」测试群', type: 'supergroup' }, date: 1724569167, text: '/test @d0j1a1701', entities: [ { offset: 0, length: 5, type: 'bot_command' }, { offset: 6, length: 10, type: 'mention' } ] } } ] } 2024-08-25 14:59:28 [D] telegram receive {"update_id":561271410,"message":{"message_id":425,"from":{"id":5420165211,"is_bot":false,"first_name":"d0j1a1701","username":"d0j1a1701","language_code":"zh-hans","is_premium":true},"chat":{"id":-1002201482660,"title":"「香草」测试群","type":"supergroup"},"date":1724569167,"text":"/test @d0j1a1701","entities":[{"offset":0,"length":5,"type":"bot_command"},{"offset":6,"length":10,"type":"mention"}]}} 2024-08-25 14:59:28 [I] test telegram:undefined
可以看到一个巨大的 telegram:undefined 呈现在眼前。
telegram:undefined
最小复现代码如上
我们拿出接入 NapCat 的 onebot 适配器。
2024-08-25 15:01:10 [I] test onebot:30******26 // 被 @ 人的正确 QQ 号码。
No response
System: OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish) CPU: (4) x64 AMD EPYC 7B13 64-Core Processor
Binaries: Node: 21.7.3 Yarn: 4.1.1
Koishi: Core: 4.17.12 Console: 5.29.3
有关 Koishi 使用方面的问题可以在 Discussions 版 的 Q&A 区 提问。Issue 主要用于反馈 Koishi 本身的 bug。我已帮你移动分区。
根据我目前使用的 Bot,Telegram 不支持获取 <at /> 元素的任何属性。我使用过的所有 Bot 均使用 quote 或直接输入 UserID 的方法获取要进行操作的目标用户。
<at />
Describe the bug
如果你使用以下指令尝试从 @ 中读取用户 id
你会发现在 Telegram 适配器下你读了个寂寞
以下是详细日志
可以看到一个巨大的
telegram:undefined
呈现在眼前。Steps to reproduce
最小复现代码如上
Expected behavior
我们拿出接入 NapCat 的 onebot 适配器。
Screenshots
No response
Versions
System: OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish) CPU: (4) x64 AMD EPYC 7B13 64-Core Processor
Binaries: Node: 21.7.3 Yarn: 4.1.1
Koishi: Core: 4.17.12 Console: 5.29.3
Additional context
No response