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

Emoticon to file Error #81

Open
Nimbly8836 opened this issue Jun 8, 2024 · 0 comments
Open

Emoticon to file Error #81

Nimbly8836 opened this issue Jun 8, 2024 · 0 comments

Comments

@Nimbly8836
Copy link

Nimbly8836 commented Jun 8, 2024

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)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant