Open
Description
Unofficial emoji message to fileBox error
In the file puppet-wechat4u.ts
around line 675 under case PUPPET.types.Message.Emoticon
, here is my solution:
case PUPPET.types.Message.Emoticon: {
/**
* Emoji message
*/
const msg = await this.wechat4u.getMsgImg(rawPayload.MsgId)
const fileExt = await getExtensionFromBuffer(msg.data)
const ext = fileExt?.ext || 'jpg'
filename = `${rawPayload.MsgId}.${ext}`
const file = FileBox.fromBuffer(
msg.data,
filename,
)
return file
}
"dependencies": {
"file-type": "^16.5.4"
},
import { fromBuffer } from "file-type";
export async function getExtensionFromBuffer(buffer: Buffer) {
return await fromBuffer(buffer)
}
Metadata
Metadata
Assignees
Labels
No labels