1 |
import { CommandInteraction, FileOptions, GuildMember, Interaction, Message, MessageAttachment } from 'discord.js'; |
import { CommandInteraction, FileOptions } from 'discord.js'; |
2 |
import BaseCommand from '../../utils/structures/BaseCommand'; |
import BaseCommand from '../../utils/structures/BaseCommand'; |
3 |
import DiscordClient from '../../client/Client'; |
import DiscordClient from '../../client/Client'; |
|
import CommandOptions from '../../types/CommandOptions'; |
|
4 |
import InteractionOptions from '../../types/InteractionOptions'; |
import InteractionOptions from '../../types/InteractionOptions'; |
|
import MessageEmbed from '../../client/MessageEmbed'; |
|
|
import { download } from '../../utils/util'; |
|
5 |
import path from 'path'; |
import path from 'path'; |
|
import { fetchEmoji } from '../../utils/Emoji'; |
|
6 |
|
|
7 |
export default class AddsnippetCommand extends BaseCommand { |
export default class AddsnippetCommand extends BaseCommand { |
8 |
supportsInteractions: boolean = true; |
supportsInteractions: boolean = true; |
25 |
return; |
return; |
26 |
} |
} |
27 |
|
|
28 |
await msg.reply({ |
try { |
29 |
content: snippet.content.trim() === '' ? undefined : snippet.content, |
await msg.reply({ |
30 |
files: snippet.files.map(name => { |
content: snippet.content.trim() === '' ? undefined : snippet.content, |
31 |
return { |
files: snippet.files.map(name => { |
32 |
name, |
return { |
33 |
attachment: path.resolve(__dirname, '../../../storage', name) |
name, |
34 |
} as FileOptions |
attachment: path.resolve(process.env.SUDO_PREFIX ?? path.join(__dirname, '../../..'), 'storage', name) |
35 |
}), |
} as FileOptions |
36 |
embeds: snippet.embeds |
}), |
37 |
}); |
embeds: snippet.embeds |
38 |
|
}); |
39 |
|
} |
40 |
|
catch (e) { |
41 |
|
console.log(e); |
42 |
|
await msg.reply({ content: 'Looks like that snippet is corrupted. Maybe invalid embed schema?', ephemeral: true }); |
43 |
|
} |
44 |
} |
} |
45 |
|
|
46 |
let cmdName = ''; |
let cmdName = ''; |
58 |
return await command.run(client, msg, options); |
return await command.run(client, msg, options); |
59 |
} |
} |
60 |
} |
} |
|
} |
|
61 |
|
} |