Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
Trying to use canvacord

I used the trigger example code of canvacord, but I get the error:

DiscordAPIError: Cannot send an empty message

My code is:

const Command = require("../Structures/Command.js");
const canvacord = require('canvacord');
const Discord = require("discord.js")

module.exports = new Command({
    name: "image",
    description: "Edits an image!",
    permission: "SEND_MESSAGES",

    async run(message, args, client) {

        let avatar = message.author.displayAvatarURL({ dynamic: false, format: 'png' });
        let image = await canvacord.Canvas.trigger(avatar);
        let attachment = new Discord.MessageAttachment(image, "triggered.gif");
        message.channel.send(attachment);
    }
})

Normal text commands work totally fine, it is just this one that isnt working. I tried with other code examples, but it still doesnt work.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

When sending attachments, you need to specify them in the .send() function. You need to use the files property to make sure that the attachment is being sent properly, so you just need to edit the way you send the attachment to:

message.channel.send({
    files: [attachment]
})
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!