18 |
|
|
19 |
async run(client: DiscordClient, msg: CommandInteraction, options: InteractionOptions) { |
async run(client: DiscordClient, msg: CommandInteraction, options: InteractionOptions) { |
20 |
if (options.options.getSubcommand(true) === 'get') { |
if (options.options.getSubcommand(true) === 'get') { |
21 |
const snippet = await client.snippetManager.get(msg.guild!.id, options.options.getString('name')!); |
const snippet = await client.snippetManager.getParsed(msg.guild!.id, options.options.getString('name')!); |
22 |
|
|
23 |
if (!snippet) { |
if (!snippet) { |
24 |
await msg.reply({ |
await msg.reply({ |
30 |
} |
} |
31 |
|
|
32 |
await msg.reply({ |
await msg.reply({ |
33 |
content: snippet.content, |
content: snippet.content.trim() === '' ? undefined : snippet.content, |
34 |
files: snippet.files.map(name => { |
files: snippet.files.map(name => { |
35 |
return { |
return { |
36 |
name, |
name, |
37 |
attachment: path.resolve(__dirname, '../../../storage', name) |
attachment: path.resolve(__dirname, '../../../storage', name) |
38 |
} as FileOptions |
} as FileOptions |
39 |
}), |
}), |
40 |
|
embeds: snippet.embeds |
41 |
}); |
}); |
42 |
} |
} |
43 |
|
|