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

131
Visualizações
discord-modals TypeError: Cannot read properties of undefined (reading 'EPHEMERAL')

I am using the package discord-modals to create better modals with my discord bot.

When I want to reply to the SlashCommandInteraction (actually it's the modalResponse listening event), then I can't make the reply ephemeral. When I remove the ephemeral bool, it works perfectly. But I don't understand why it doesn't work with a normal reply action.

await event.reply({content: `${replymsg}`, ephemeral: true});

So if I use this, I get the following error:

TypeError: Cannot read properties of undefined (reading 'EPHEMERAL')
    at ModalSubmitInteraction.reply (C:\Users\david_h7tqe3i\WebstormProjects\musicbottest\node_modules\discord-modals\src\v14\interfaces\InteractionResponses.js:51:57)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Client.<anonymous> (C:\Users\david_h7tqe3i\WebstormProjects\musicbottest\src\index.js:107:9)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:384:10)
    at processTicksAndRejections (node:internal/process/task_queues:85:21)

Process finished with exit code 1

And if I use the following code, it works:

await event.reply({content: `${replymsg}`});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There is a bug in discord-modals. It uses MessageFlags.FLAGS.EPHEMERAL, but MessageFlags.FLAGS is undefined. For a quick fix, you can edit node_modules/discord-modals/src/v14/interfaces/InteractionResponses.js and on line 51 replace

data.flags = options.ephemeral ? MessageFlags.FLAGS.EPHEMERAL : undefined;

with

data.flags = options.ephemeral ? MessageFlags.Ephemeral : undefined;

I've also opened a PR, hopefully, the maintainer will accept it soon.

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