mirror of
https://github.com/Ninluc/Dat_Boi.git
synced 2025-08-09 23:26:13 +02:00
Initial commit
This commit is contained in:
45
dmCommands/dm.js
Normal file
45
dmCommands/dm.js
Normal file
@ -0,0 +1,45 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../botconfig/config.json");
|
||||
const ee = require("../botconfig/embed.json");
|
||||
module.exports = {
|
||||
name: "dm",
|
||||
isPrivate: true,
|
||||
usage: "dm <USER_ID> <MESSAGE>",
|
||||
description: "Envoie un message privé à l'utilisateur spécifié par son id.",
|
||||
run: async (client, message, text, args) => {
|
||||
try {
|
||||
|
||||
let text = args.slice(1).join(" ")
|
||||
|
||||
client.users.fetch(args[0], false).then(u => {
|
||||
try {
|
||||
u.send({ content : text}).then(() => {
|
||||
message.react("✅")
|
||||
})
|
||||
.catch(e => {
|
||||
message.react("❌")
|
||||
})
|
||||
}
|
||||
catch (e) {
|
||||
message.react("❌")
|
||||
console.log(String(e.stack).bgRed);
|
||||
}
|
||||
}).catch(() => {
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Pas d'utilisateur trouvé :(`)]}
|
||||
);
|
||||
})
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed);
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user