1 |
rakin |
10 |
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 |
|
|
const announcement = await msg.content.substring(msg.content.indexOf(' ')); |
18 |
|
|
|
19 |
|
|
try { |
20 |
|
|
const channel = await msg.guild.channels.cache.find(c => c.id === app.config.get('announcement_channel')); |
21 |
|
|
|
22 |
|
|
if (!channel) { |
23 |
|
|
await msg.reply({ |
24 |
|
|
content: ":x: Channel not found" |
25 |
|
|
}); |
26 |
|
|
|
27 |
|
|
return; |
28 |
|
|
} |
29 |
|
|
|
30 |
|
|
await channel.send({ |
31 |
|
|
content: announcement |
32 |
|
|
}); |
33 |
|
|
|
34 |
|
|
await msg.react('✅'); |
35 |
|
|
} |
36 |
|
|
catch(e) { |
37 |
|
|
console.log(e); |
38 |
|
|
|
39 |
|
|
await msg.reply({ |
40 |
|
|
content: ":x: Failed to send message" |
41 |
|
|
}); |
42 |
|
|
} |
43 |
|
|
} |
44 |
|
|
}; |