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

233
Visualizações
Discord.js bot reply with slash command

I have a working slash command, which is great. I can use the command with one input parameter eg /command string and it will execute the command. However I am looking to set up a Discord bot that uses that command in a channel every 5 or so minutes. I can't seem to get the bot to use the command, any ideas on how to get it to work?

It just displays the string in the channel but the bot doesn't execute the command.

bot.on('messageCreate', async (msg) => {
    if (msg.content === "!loop") {
        interval = setInterval (function () {
            msg.channel.send("/command string")
        }, 3 * 1000);
    }
})
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Bots can only receive Application Command Interactions, not create them. This means your bot won't be able to run other bot's slash commands, click their buttons or use their dropdown menus.

If you have control over the other bot's code, though, you can set it up to listen for messages (not interactions) from your second bot, and run code accordingly.

But be aware: as MegaMix mentioned in their comment, if the bot you want to control isn't yours, you probably won't be able to do that, as it is a best practice to ignore messages from other bots to prevent abuse and infinite loops.

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