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

120
Views
I have this code below it's supposed to send a discord embed after 10 messages in a specific channel but for some reason it doesn't and logs no errors
const { MessageEmbed } = require("discord.js")
module.exports = {
  name: "test",
  description: "A test command",
  run: async(client, message, args)=>{
    let count = 0;
    let channelId = message.channel.id;
    client.on("messageCreate", async(newMessage)=>{ // dont use "message" here
      if (newMessage.channel.id === channelId) {
        count = count + 1;
         if (count === 10) {
           let embed = new MessageEmbed()
           .setDescription("Hello")
           .setColor("RANDOM")
           return message.channel.send({ embeds: [embed] })
         }
      } else if (newMessage.channel.id !== channelId) {
         return;
      }
    })
  }
}

I'm trying to make a command that sends an embed to a specific channel every 10 messages are sent but the above code isn't working and I'm not getting any errors either could someone help?

about 4 years ago · Juan Pablo Isaza
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!