Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
Cannot send an empty message on discord.js v13

Okay so, I downloaded an old plugin that works on discord.js V12 (discord-pagination) and I want it to work on V13 too, so what can I do?

When I'm trying to use my command it says Cannot send an empty message, the issue is in that code below.

const paginationEmbed = async (msg, pages, emojiList = ["⏪", "⏩"], timeout = 120000) => {
    if (!msg && !msg.channel) throw new Error("Channel is inaccessible.");
    if (!pages) throw new Error("Pages are not given.");
    if (emojiList.length !== 2) throw new Error("Need two emojis.");
    let page = 0;
    const curPage = await msg.channel.send(pages[page].setFooter(`Page ${page + 1} / ${pages.length}`));
    for (const emoji of emojiList) await curPage.react(emoji);
    const reactionCollector = curPage.createReactionCollector((reaction, user) => emojiList.includes(reaction.emoji.name) && !user.bot, { time: timeout });
    reactionCollector.on("collect", (reaction) => {
        reaction.users.remove(msg.author);
        switch (reaction.emoji.name) {
            case emojiList[0]:
                page = page > 0 ? --page : pages.length - 1;
                break;
            case emojiList[1]:
                page = page + 1 < pages.length ? ++page : 0;
                break;
            default:
                break;
        }
        curPage.edit(pages[page].setFooter(`Page ${page + 1} / ${pages.length}`));
    });
    reactionCollector.on("end", () => {
        if (!curPage.deleted) {
            curPage.reactions.removeAll();
        }
    });
    return curPage;
};
module.exports = paginationEmbed;
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Guessing from your code, I think the problem is sending an embed.

message.channel.send(embed) // deprecated
message.channel.send({embeds: [embed] }) // V13 version

So for you you would have to change one line:

// change this
const curPage = await msg.channel.send(pages[page].setFooter(`Page ${page + 1} / ${pages.length}`));
// to this
const curPage = await msg.channel.send({ embeds: [pages[page].setFooter(`Page ${page + 1} / ${pages.length}`)] });

Same goes for curPage.edit:

// change this
curPage.edit(pages[page].setFooter(`Page ${page + 1} / ${pages.length}`));
// to this
curPage.edit({ embeds: [pages[page].setFooter(`Page ${page + 1} / ${pages.length}`)] });

Also you might want to give the Guide a read, on how to update from V12 to V13

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda