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

236
Views
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 answers
Answer question

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 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!