Skip to content

Emoticon to file Error #81

@Nimbly8836

Description

@Nimbly8836

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions