8 |
|
|
9 |
export default class EmbedBuildCommand extends BaseCommand { |
export default class EmbedBuildCommand extends BaseCommand { |
10 |
supportsInteractions: boolean = false; |
supportsInteractions: boolean = false; |
11 |
|
supportsLegacy: boolean = false; |
12 |
|
|
13 |
constructor() { |
constructor() { |
14 |
super('embed__build', 'automation', []); |
super('embed__build', 'automation', []); |
21 |
} |
} |
22 |
|
|
23 |
try { |
try { |
24 |
const embedData = JSON.parse(options.isInteraction ? options.options.getString('json_schema')! : options.args.join(' ')); |
const embedData = JSON.parse((options.isInteraction ? options.options.getString('json_schema')! : options.args.join(' ')).replace(/^embed\:/, '')); |
25 |
|
|
26 |
if (!embedData) { |
if (!embedData) { |
27 |
throw new Error('Parse Error'); |
throw new Error('Parse Error'); |
29 |
|
|
30 |
try { |
try { |
31 |
const embed = new MessageEmbed(embedData); |
const embed = new MessageEmbed(embedData); |
32 |
|
|
33 |
|
if (embedData.color) { |
34 |
|
try { |
35 |
|
embed.setColor(embedData.color); |
36 |
|
} |
37 |
|
catch (e) { |
38 |
|
console.log(e); |
39 |
|
} |
40 |
|
} |
41 |
|
|
42 |
await message.channel?.send({ |
await message.channel?.send({ |
43 |
embeds: [embed] |
embeds: [embed] |