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?
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: []
};