#Can't send File into Channel

3 messages · Page 1 of 1 (latest)

analog hatch
#

Im using this: https://github.com/pedroslopez/whatsapp-web.js/pull/2620
to automatically post messages in a channel, i want to post media too.

But i can't seem to get it to work, here's my Code:

        const msg = new MessageMedia({
          mimetype: mime,
          data: file,
          filename: null,
          filesize: null,
        })
        await client.sendMessage(channel, msg)

mime is image/jpeg
file is a base64 encoded file, encoded using python like this: base64.b64encode(file_content).decode('utf-8')

Error will be in the next message because of char limitation in Discord.

GitHub

Table of Contents

  • Description
  • Related Issues
  • Usage Example
  • I Want to Test this PR
  • I Got an Error While Testing This PR ❌
  • How Has the PR Been Tested (latest test on 29.09.2024)

Th...

#

This is the Error:

May 08 16:18:59 t0stbrot.net node[164810]: Error: Evaluation failed: DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
May 08 16:18:59 t0stbrot.net node[164810]:     at window.WWebJS.mediaInfoToFile (pptr://__puppeteer_evaluation_script__:631:35)
May 08 16:18:59 t0stbrot.net node[164810]:     at window.WWebJS.processMediaData (pptr://__puppeteer_evaluation_script__:352:36)
May 08 16:18:59 t0stbrot.net node[164810]:     at window.WWebJS.sendMessage (pptr://__puppeteer_evaluation_script__:29:48)
May 08 16:18:59 t0stbrot.net node[164810]:     at pptr://__puppeteer_evaluation_script__:10:45
May 08 16:18:59 t0stbrot.net node[164810]:     at ExecutionContext._ExecutionContext_evaluate (/var/www/wa-api/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:229:15)
May 08 16:18:59 t0stbrot.net node[164810]:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
May 08 16:18:59 t0stbrot.net node[164810]:     at async ExecutionContext.evaluate (/var/www/wa-api/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:107:16)
May 08 16:18:59 t0stbrot.net node[164810]:     at async Client.sendMessage (/var/www/wa-api/node_modules/whatsapp-web.js/src/Client.js:949:25)
May 08 16:18:59 t0stbrot.net node[164810]:     at async send (/var/www/wa-api/index.js:34:9)
May 08 16:18:59 t0stbrot.net node[164810]:     at async IncomingMessage.<anonymous> (/var/www/wa-api/index.js:64:17)
grizzled flicker