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

257
Views
Delete Command After Execute discord.js

How do i make my command delete from chat after executing in this code:

    const Discord = require("discord.js");

module.exports.run = async (client, message, args) => {
    if (message.author.id != process.env.OWNERID)
        return message.channel.send("Only my developer can use this command...");
    const msg = args.slice(0).join(" ");
    if (!msg) return message.reply("Send something!");
    message.channel.send(msg);
};

module.exports.help = {
    name: "send-message",
    description: "N/A",
    usage: "d!send-message [Message]",
    accessableby: "Bot Owners",
    aliases: []
};

like if i were to do " d!send-message discord.js help

how would i make "d!send-message discord.js help" delete from discord chat by the bot after executed?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use .delete() function

Here's an example for you:

const Discord = require("discord.js");

module.exports.run = async (client, message, args) => {
    if (message.author.id != process.env.OWNERID)
        return message.channel.send("Only my developer can use this command...");
    const msg = args.slice(0).join(" ");
    if (!msg) return message.reply("Send something!");
    message.channel.send(msg);
    message.delete()  // ** NEW LINE
};

module.exports.help = {
    name: "send-message",
    description: "N/A",
    usage: "d!send-message [Message]",
    accessableby: "Bot Owners",
    aliases: []
};

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!