diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2021-05-29 04:01:47 +0000 |
---|---|---|
committer | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2021-05-29 04:01:47 +0000 |
commit | 57de6733b62c83ff197f9236f71545d8ef1e1103 (patch) | |
tree | 71f0920b153dfc4031f35d7c62907c9dc28d540d /src/commands/dev/eval.ts | |
parent | 28e98a1131fc2e11fa3cf8aa20fe03e57af38a12 (diff) | |
download | tanzanite-57de6733b62c83ff197f9236f71545d8ef1e1103.tar.gz tanzanite-57de6733b62c83ff197f9236f71545d8ef1e1103.tar.bz2 tanzanite-57de6733b62c83ff197f9236f71545d8ef1e1103.zip |
Automatically format code
Diffstat (limited to 'src/commands/dev/eval.ts')
-rw-r--r-- | src/commands/dev/eval.ts | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index cfe75cc..bab5f8e 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -5,7 +5,8 @@ import { inspect, promisify } from 'util'; import { exec } from 'child_process'; const clean = (text) => { - if (typeof text === 'string') return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203)); + if (typeof text === 'string') + return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203)); else return text; }; @@ -47,7 +48,10 @@ export default class EvalCommand extends BushCommand { }); } - public async exec(message: Message, { depth, code, silent }: { depth: number; code: string; silent: boolean }): Promise<void> { + public async exec( + message: Message, + { depth, code, silent }: { depth: number; code: string; silent: boolean } + ): Promise<void> { const embed: MessageEmbed = new MessageEmbed(); try { @@ -68,15 +72,30 @@ export default class EvalCommand extends BushCommand { output = clean(output); embed .setTitle('✅ Evaled code successfully') - .addField('📥 Input', code.length > 1012 ? 'Too large to display. Hastebin: ' + (await this.client.util.haste(code)) : '```js\n' + code + '```') - .addField('📤 Output', output.length > 1012 ? 'Too large to display. Hastebin: ' + (await this.client.util.haste(output)) : '```js\n' + output + '```') + .addField( + '📥 Input', + code.length > 1012 + ? 'Too large to display. Hastebin: ' + (await this.client.util.haste(code)) + : '```js\n' + code + '```' + ) + .addField( + '📤 Output', + output.length > 1012 + ? 'Too large to display. Hastebin: ' + (await this.client.util.haste(output)) + : '```js\n' + output + '```' + ) .setColor('#66FF00') .setFooter(message.author.username, message.author.displayAvatarURL({ dynamic: true })) .setTimestamp(); } catch (e) { embed .setTitle('❌ Code was not able to be evaled') - .addField('📥 Input', code.length > 1012 ? 'Too large to display. Hastebin: ' + (await this.client.util.haste(code)) : '```js\n' + code + '```') + .addField( + '📥 Input', + code.length > 1012 + ? 'Too large to display. Hastebin: ' + (await this.client.util.haste(code)) + : '```js\n' + code + '```' + ) .addField( '📤 Output', e.length > 1012 |