1 |
const MessageEmbed = require("../src/MessageEmbed"); |
2 |
|
3 |
module.exports = { |
4 |
async handle(msg, cm) { |
5 |
if (typeof cm.args[0] === 'undefined') { |
6 |
await msg.reply({ |
7 |
embeds: [ |
8 |
new MessageEmbed() |
9 |
.setColor('#f14a60') |
10 |
.setDescription(`This command requires at least one argument.`) |
11 |
] |
12 |
}); |
13 |
|
14 |
return; |
15 |
} |
16 |
|
17 |
var ch = await msg.mentions?.channels?.first(); |
18 |
let text; |
19 |
let args = [...cm.args]; |
20 |
|
21 |
|
22 |
if (typeof ch !== 'object' || ch === null) { |
23 |
ch = msg.channel; |
24 |
} |
25 |
else { |
26 |
args.pop(); |
27 |
} |
28 |
|
29 |
text = args.join(' '); |
30 |
|
31 |
try { |
32 |
await ch.send({ |
33 |
content: text |
34 |
}); |
35 |
} |
36 |
catch(e) { |
37 |
console.log(e); |
38 |
|
39 |
await msg.reply({ |
40 |
embeds: [ |
41 |
new MessageEmbed() |
42 |
.setColor('#f14a60') |
43 |
.setDescription(`I don't have enough permission to send messages on this channel.`) |
44 |
] |
45 |
}); |
46 |
|
47 |
return; |
48 |
} |
49 |
|
50 |
await msg.react('✅'); |
51 |
} |
52 |
}; |