diff options
Diffstat (limited to 'src/commands/dev')
-rw-r--r-- | src/commands/dev/eval.ts | 10 | ||||
-rw-r--r-- | src/commands/dev/javascript.ts | 9 | ||||
-rw-r--r-- | src/commands/dev/sh.ts | 12 | ||||
-rw-r--r-- | src/commands/dev/test.ts | 18 |
4 files changed, 22 insertions, 27 deletions
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index 2be2963..ab7787d 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -262,8 +262,8 @@ export default class EvalCommand extends BushCommand { embed.setTimestamp(); - if (inputTS) embed.addFields([{ name: ':inbox_tray: Input (typescript)', value: inputTS }]); - embed.addFields([{ name: `:inbox_tray: Input${inputTS ? ' (transpiled javascript)' : ''}`, value: inputJS }]); + if (inputTS) embed.addFields({ name: ':inbox_tray: Input (typescript)', value: inputTS }); + embed.addFields({ name: `:inbox_tray: Input${inputTS ? ' (transpiled javascript)' : ''}`, value: inputJS }); const output = await this.codeblock(rawResult, 'js', { depth: selDepth ?? 0, @@ -279,10 +279,10 @@ export default class EvalCommand extends BushCommand { embed .setTitle(`${emojis[err ? 'errorFull' : 'successFull']} ${err ? 'Uns' : 'S'}uccessfully Evaluated Expression`) .setColor(colors[err ? 'error' : 'success']) - .addFields([{ name: `:outbox_tray: ${err ? 'Error' : 'Output'}`, value: output }]); + .addFields({ name: `:outbox_tray: ${err ? 'Error' : 'Output'}`, value: output }); - if (!err && methods) embed.addFields([{ name: ':wrench: Methods', value: methods }]); - if (!err && proto) embed.addFields([{ name: ':gear: Proto', value: proto }]); + if (!err && methods) embed.addFields({ name: ':wrench: Methods', value: methods }); + if (!err && proto) embed.addFields({ name: ':gear: Proto', value: proto }); if (!silent || message.util.isSlashMessage(message)) { await message.util.reply({ content: null, embeds: [embed] }); diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts index e472a5a..6b6c7e1 100644 --- a/src/commands/dev/javascript.ts +++ b/src/commands/dev/javascript.ts @@ -73,16 +73,13 @@ export default class JavascriptCommand extends BushCommand { }); embed.setTitle(`${emojis.successFull} Successfully Evaluated Expression`).setColor(colors.success); - embed.addFields([ - { name: '📥 Input', value: input }, - { name: '📤 Output', value: output } - ]); + embed.addFields({ name: '📥 Input', value: input }, { name: '📤 Output', value: output }); } catch (e) { embed.setTitle(`${emojis.errorFull} Unable to Evaluate Expression`).setColor(colors.error); - embed.addFields([ + embed.addFields( { name: '📥 Input', value: input }, { name: '📤 Error', value: await this.client.utils.inspectCleanRedactCodeblock(e, 'js', { colors: false }) } - ]); + ); } embed.setTimestamp().setFooter({ text: message.author.tag, iconURL: message.author.displayAvatarURL() ?? undefined }); diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index 7ffdf27..1b9ce22 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -59,10 +59,10 @@ export default class ShCommand extends BushCommand { .setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined }) .setTimestamp() .setTitle('Shell Command') - .addFields([ + .addFields( { name: '📥 Input', value: await this.client.utils.codeblock(input, 1024, 'sh', true) }, { name: 'Running', value: emojis.loading } - ]); + ); await message.util.reply({ embeds: [embed] }); @@ -80,14 +80,12 @@ export default class ShCommand extends BushCommand { embed.setTitle(`${emojis.successFull} Executed command successfully.`).setColor(colors.success).spliceFields(1, 1); - if (stdout) embed.addFields([{ name: '📤 stdout', value: await this.client.utils.codeblock(stdout, 1024, 'ansi', true) }]); - if (stderr) embed.addFields([{ name: '📤 stderr', value: await this.client.utils.codeblock(stderr, 1024, 'ansi', true) }]); + if (stdout) embed.addFields({ name: '📤 stdout', value: await this.client.utils.codeblock(stdout, 1024, 'ansi', true) }); + if (stderr) embed.addFields({ name: '📤 stderr', value: await this.client.utils.codeblock(stderr, 1024, 'ansi', true) }); } catch (e) { embed.setTitle(`${emojis.errorFull} An error occurred while executing.`).setColor(colors.error).spliceFields(1, 1); - embed.addFields([ - { name: '📤 Output', value: await this.client.utils.codeblock(formatError(e, true), 1024, 'ansi', true) } - ]); + embed.addFields({ name: '📤 Output', value: await this.client.utils.codeblock(formatError(e, true), 1024, 'ansi', true) }); } await message.util.edit({ embeds: [embed] }); } diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index 600aeac..ac0ad83 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -62,17 +62,17 @@ export default class TestCommand extends BushCommand { if (args.feature) { if (['button', 'buttons'].includes(args.feature?.toLowerCase())) { - const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents([ + const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents( new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'primaryButton', label: 'Primary' }), new ButtonBuilder({ style: ButtonStyle.Secondary, customId: 'secondaryButton', label: 'Secondary' }), new ButtonBuilder({ style: ButtonStyle.Success, customId: 'successButton', label: 'Success' }), new ButtonBuilder({ style: ButtonStyle.Danger, customId: 'dangerButton', label: 'Danger' }), new ButtonBuilder({ style: ButtonStyle.Link, label: 'Link', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' }) - ]); + ); return await message.util.reply({ content: 'buttons', components: [buttonRow] }); } else if (['embed', 'button embed'].includes(args.feature?.toLowerCase())) { const embed = new EmbedBuilder() - .addFields([{ name: 'Field Name', value: 'Field Content' }]) + .addFields({ name: 'Field Name', value: 'Field Content' }) .setAuthor({ name: 'Author', iconURL: 'https://www.w3schools.com/w3css/img_snowtops.jpg', url: 'https://google.com/' }) .setColor(message.member?.displayColor ?? colors.default) .setDescription('Description') @@ -85,9 +85,9 @@ export default class TestCommand extends BushCommand { ) .setTitle('Title'); - const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents([ + const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents( new ButtonBuilder({ style: ButtonStyle.Link, label: 'Link', url: 'https://google.com/' }) - ]); + ); return await message.util.reply({ content: 'Test', embeds: [embed], components: [buttonRow] }); } else if (['lots of buttons'].includes(args.feature?.toLowerCase())) { const buttonRows: ActionRowBuilder<ButtonBuilder>[] = []; @@ -96,7 +96,7 @@ export default class TestCommand extends BushCommand { for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); const button = new ButtonBuilder({ style: ButtonStyle.Primary, customId: id, label: id }); - row.addComponents([button]); + row.addComponents(button); } buttonRows.push(row); } @@ -128,7 +128,7 @@ export default class TestCommand extends BushCommand { for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); const button = new ButtonBuilder({ style: ButtonStyle.Secondary, customId: id, label: id }); - row.addComponents([button]); + row.addComponents(button); } ButtonRows.push(row); } @@ -159,9 +159,9 @@ export default class TestCommand extends BushCommand { const m = await message.util.reply({ content: 'Click for modal', components: [ - new ActionRowBuilder<ButtonBuilder>().addComponents([ + new ActionRowBuilder<ButtonBuilder>().addComponents( new ButtonBuilder({ style: ButtonStyle.Primary, label: 'Modal', customId: 'test;modal' }) - ]) + ) ] }); |