-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
49 lines (39 loc) · 1.34 KB
/
index.js
File metadata and controls
49 lines (39 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
'use strict';
const Jade = require('@botsocket/jade');
module.exports = {
name: 'repeat',
register: (client) => {
client.command({
name: 'repeat',
alias: ['say'],
args: ['text'],
flags: ['channel'],
validate: {
args: Jade.obj({
text: Jade.string().required(),
}),
},
handler: async (message, { args: { text }, flags: { channel } }) => {
if (!message.member.hasPermission('ADMINISTRATOR')) {
return message.reply(`You are missing the \`ADMINISTRATOR\` permission.`);
}
let c = message.channel;
if (channel) {
if (message.client.channels.cache.has(channel)) {
c = message.client.channels.cache.get(channel);
}
else {
const match = channel.match(/<#(\d{17,19})>/);
if (message.client.channels.cache.has(match[1])) {
c = message.client.channels.cache.get(match[1]);
}
}
}
try {
await c.send(text);
}
catch {}
},
});
},
};