Closed Star-Vk closed 1 year ago
mirai-js版本如下
"mirai-js": "^2.8.4"
mah版本如下:
2022-09-22 12:08:13 I/plugin: Successfully loaded plugin net.mamoe.mirai-api-http v2.6.1
mcl版本如下:
12:08:07 [INFO] iTXTech Mirai Console Loader version 2.1.0-71ec418 12:08:07 [INFO] https://github.com/iTXTech/mirai-console-loader 12:08:07 [INFO] This program is licensed under GNU AGPL v3 12:08:11 [INFO] Mirai Console Loader Announcement: Mirai Console Loader 公告栏 如果在图片上传的时候遇到问题请与我们联系 (需要提供图片文件源本) `- 如 Unsupported image type for ExternalResource * ` considering use gif/png/bmp/jpg format. `- Tracker: https://github.com/mamoe/mirai/issues/new/choose 常用资源整合 `- https://mirai.mamoe.net/topic/653 MCL 已推出 2.1.0,更好的支持 Mirai 2.11 的插件系统,建议更新。 12:08:11 [INFO] Verifying "net.mamoe:mirai-console" v2.12.1 12:08:11 [INFO] Verifying "net.mamoe:mirai-console-terminal" v2.12.1 12:08:11 [INFO] Verifying "net.mamoe:mirai-core-all" v2.12.1 12:08:11 [INFO] Verifying "org.itxtech:mcl-addon" v2.0.2 12:08:11 [INFO] Verifying "org.bouncycastle:bcprov-jdk15on" v1.64 2022-09-22 12:08:12 I/main: Starting mirai-console... 2022-09-22 12:08:12 I/main: Backend: version 2.12.1, built on 2022-07-31 17:49:27. 2022-09-22 12:08:12 I/main: Frontend Terminal: version 2.12.1, provided by Mamoe Technologies
用TS编写如下代码,监听群消息撤回事件:
bot.on('GroupRecallEvent', async ctx => { const msg = await myBot.bot.getMessageById({ messageId: ctx.messageId, target: ctx.group.id }); // repeat the msg recalled just now console.log(msg); bot.sendMessage({ group: msg.sender.group.id, message: msg.messageChain, }); //error })
error错误信息
类型“{ id?: number | undefined; nickname?: string | undefined; remark?: string | undefined; }”上不存在属性“group”。
但是根据文档:https://drincann.github.io/Mirai-js/#/v2.x/Bot?id=getmessagebyid 可知msg结构是这样的:
在BOinterface MessageFromMessageId { type: 'FriendMessage' | 'GroupMessage' | 'TempMessage'; messageChain: MessageType[]; sender: { id?: number; nickname?: string; remark?: string; } }
但是实际输出msg信息是:
在MessageFromMessageId定义如下:
interface MessageFromMessageId { type: 'FriendMessage' | 'GroupMessage' | 'TempMessage'; messageChain: MessageType[]; sender: { id?: number; nickname?: string; remark?: string; } }
感谢反馈,这两天太忙了,可能周末抽时间看下。
好的好的~
8f8d2b1 v2.8.9 released
不好意思拖了这么久,最近求职季,实在太忙。:upside_down_face:
mirai-js版本如下
mah版本如下:
mcl版本如下:
用TS编写如下代码,监听群消息撤回事件:
error错误信息
但是根据文档:https://drincann.github.io/Mirai-js/#/v2.x/Bot?id=getmessagebyid 可知msg结构是这样的:
但是实际输出msg信息是:
在MessageFromMessageId定义如下: