26 |
.split(/ +/); |
.split(/ +/); |
27 |
|
|
28 |
const command = await client.commands.get(cmdName); |
const command = await client.commands.get(cmdName); |
|
const allowed = await client.auth.verify(message.member!, cmdName); |
|
29 |
|
|
30 |
if (command && command.supportsLegacy) { |
if (command && command.supportsLegacy) { |
31 |
|
const allowed = await client.auth.verify(message.member!, command); |
32 |
|
|
33 |
if (allowed) { |
if (allowed) { |
34 |
await command.run(client, message, { |
const options = { |
35 |
cmdName, |
cmdName, |
36 |
args, |
args, |
37 |
argv: [cmdName, ...args], |
argv: [cmdName, ...args], |
38 |
normalArgs: args.filter(a => a[0] !== '-'), |
normalArgs: args.filter(a => a[0] !== '-'), |
39 |
options: args.filter(a => a[0] === '-'), |
options: args.filter(a => a[0] === '-'), |
40 |
isInteraction: false |
isInteraction: false |
41 |
} as CommandOptions); |
} as CommandOptions; |
42 |
|
|
43 |
|
if (!await client.cooldown.start(message, options)) |
44 |
|
return; |
45 |
|
|
46 |
|
await command.execute(client, message, options); |
47 |
} |
} |
48 |
else { |
else { |
49 |
await message.reply({ |
await message.reply({ |
58 |
return; |
return; |
59 |
} |
} |
60 |
|
|
61 |
const snippet = await client.snippetManager.get(message.guild!.id, cmdName); |
const snippet = await client.snippetManager.getParsed(message.guild!.id, cmdName); |
62 |
|
|
63 |
if (snippet) { |
if (snippet) { |
64 |
await message.channel.send({ |
try { |
65 |
content: snippet.content, |
await message.channel.send({ |
66 |
files: snippet.files.map(name => { |
content: snippet.content.trim() === '' ? undefined : snippet.content, |
67 |
return { |
files: snippet.files.map(name => { |
68 |
name, |
return { |
69 |
attachment: path.resolve(__dirname, '../../../storage', name) |
name, |
70 |
} as FileOptions |
attachment: path.resolve(__dirname, '../../../storage', name) |
71 |
}), |
} as FileOptions |
72 |
}); |
}), |
73 |
|
embeds: snippet.embeds |
74 |
|
}); |
75 |
|
} |
76 |
|
catch (e) { |
77 |
|
console.log(e); |
78 |
|
} |
79 |
|
|
80 |
return; |
return; |
81 |
} |
} |