aboutsummaryrefslogtreecommitdiff
path: root/src/commands/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/utilities')
-rw-r--r--src/commands/utilities/calculator.ts16
-rw-r--r--src/commands/utilities/decode.ts14
-rw-r--r--src/commands/utilities/highlight-show.ts36
-rw-r--r--src/commands/utilities/price.ts26
-rw-r--r--src/commands/utilities/suicide.ts36
-rw-r--r--src/commands/utilities/wolframAlpha.ts18
6 files changed, 82 insertions, 64 deletions
diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts
index 1a9d352..e17ef76 100644
--- a/src/commands/utilities/calculator.ts
+++ b/src/commands/utilities/calculator.ts
@@ -31,21 +31,25 @@ export default class CalculatorCommand extends BushCommand {
}
public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string }) {
- const decodedEmbed = new EmbedBuilder().addFields({
- name: '📥 Input',
- value: await util.inspectCleanRedactCodeblock(args.expression, 'mma')
- });
+ const decodedEmbed = new EmbedBuilder().addFields([
+ {
+ name: '📥 Input',
+ value: await util.inspectCleanRedactCodeblock(args.expression, 'mma')
+ }
+ ]);
try {
const calculated = /^(9\s*?\+\s*?10)|(10\s*?\+\s*?9)$/.test(args.expression) ? '21' : evaluate(args.expression);
decodedEmbed
.setTitle(`${util.emojis.successFull} Successfully Calculated Expression`)
.setColor(util.colors.success)
- .addFields({ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(calculated.toString(), 'mma') });
+ .addFields([{ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(calculated.toString(), 'mma') }]);
} catch (error) {
decodedEmbed
.setTitle(`${util.emojis.errorFull} Unable to Calculate Expression`)
.setColor(util.colors.error)
- .addFields({ name: `📤 Error`, value: await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') });
+ .addFields([
+ { name: `📤 Error`, value: await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') }
+ ]);
}
return await message.util.reply({ embeds: [decodedEmbed], allowedMentions: AllowedMentions.none() });
}
diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts
index 978c1c6..729cf35 100644
--- a/src/commands/utilities/decode.ts
+++ b/src/commands/utilities/decode.ts
@@ -55,17 +55,19 @@ export default class DecodeCommand extends BushCommand {
const encodeOrDecode = util.capitalizeFirstLetter(message?.util?.parsed?.alias ?? 'decoded');
const decodedEmbed = new EmbedBuilder()
.setTitle(`${encodeOrDecode} Information`)
- .addFields({ name: '📥 Input', value: await util.inspectCleanRedactCodeblock(data) });
+ .addFields([{ name: '📥 Input', value: await util.inspectCleanRedactCodeblock(data) }]);
try {
const decoded = Buffer.from(data, from).toString(to);
decodedEmbed
.setColor(util.colors.success)
- .addFields({ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(decoded) });
+ .addFields([{ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(decoded) }]);
} catch (error) {
- decodedEmbed.setColor(util.colors.error).addFields({
- name: `📤 Error ${encodeOrDecode.slice(1)}ing`,
- value: await util.inspectCleanRedactCodeblock(error?.stack ?? error)
- });
+ decodedEmbed.setColor(util.colors.error).addFields([
+ {
+ name: `📤 Error ${encodeOrDecode.slice(1)}ing`,
+ value: await util.inspectCleanRedactCodeblock(error?.stack ?? error)
+ }
+ ]);
}
return await message.util.reply({ embeds: [decodedEmbed], allowedMentions: AllowedMentions.none() });
}
diff --git a/src/commands/utilities/highlight-show.ts b/src/commands/utilities/highlight-show.ts
index 962d421..37ed6f6 100644
--- a/src/commands/utilities/highlight-show.ts
+++ b/src/commands/utilities/highlight-show.ts
@@ -41,23 +41,27 @@ export default class HighlightShowCommand extends BushCommand {
.setColor(util.colors.default);
if (highlight.blacklistedChannels.length)
- embed.addFields({
- name: 'Ignored Channels',
- value: highlight.blacklistedChannels
- .map((c) => `<#${c}>`)
- .join('\n')
- .substring(0, 1024),
- inline: true
- });
+ embed.addFields([
+ {
+ name: 'Ignored Channels',
+ value: highlight.blacklistedChannels
+ .map((c) => `<#${c}>`)
+ .join('\n')
+ .substring(0, 1024),
+ inline: true
+ }
+ ]);
if (highlight.blacklistedUsers.length)
- embed.addFields({
- name: 'Ignored Users',
- value: highlight.blacklistedUsers
- .map((u) => `<@!${u}>`)
- .join('\n')
- .substring(0, 1024),
- inline: true
- });
+ embed.addFields([
+ {
+ name: 'Ignored Users',
+ value: highlight.blacklistedUsers
+ .map((u) => `<@!${u}>`)
+ .join('\n')
+ .substring(0, 1024),
+ inline: true
+ }
+ ]);
return await message.util.reply({
embeds: [embed],
diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts
index 0117715..e4e4f50 100644
--- a/src/commands/utilities/price.ts
+++ b/src/commands/utilities/price.ts
@@ -86,18 +86,18 @@ export default class PriceCommand extends BushCommand {
// if its a bazaar item then it there should not be any ah data
if (bazaar?.products?.[parsedItem]) {
- priceEmbed
- .setTitle(`Bazaar Information for ${util.format.input(parsedItem)}`)
- .addFields({ name: 'Sell Price', value: addBazaarInformation('sellPrice', 2, true) })
- .addFields({ name: 'Buy Price', value: addBazaarInformation('buyPrice', 2, true) })
- .addFields({
+ priceEmbed.setTitle(`Bazaar Information for ${util.format.input(parsedItem)}`).addFields([
+ { name: 'Sell Price', value: addBazaarInformation('sellPrice', 2, true) },
+ { name: 'Buy Price', value: addBazaarInformation('buyPrice', 2, true) },
+ {
name: 'Margin',
value: (
Number(addBazaarInformation('buyPrice', 2, false)) - Number(addBazaarInformation('sellPrice', 2, false))
).toLocaleString()
- })
- .addFields({ name: 'Current Sell Orders', value: addBazaarInformation('sellOrders', 0, true) })
- .addFields({ name: 'Current Buy Orders', value: addBazaarInformation('buyOrders', 0, true) });
+ },
+ { name: 'Current Sell Orders', value: addBazaarInformation('sellOrders', 0, true) },
+ { name: 'Current Buy Orders', value: addBazaarInformation('buyOrders', 0, true) }
+ ]);
return await message.util.reply({ embeds: [priceEmbed] });
}
@@ -140,10 +140,12 @@ export default class PriceCommand extends BushCommand {
}
function addPrice(name: string, price: number | undefined) {
if (price)
- priceEmbed.addFields({
- name: name,
- value: price.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })
- });
+ priceEmbed.addFields([
+ {
+ name: name,
+ value: price.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })
+ }
+ ]);
}
}
diff --git a/src/commands/utilities/suicide.ts b/src/commands/utilities/suicide.ts
index 136de78..2cc16f0 100644
--- a/src/commands/utilities/suicide.ts
+++ b/src/commands/utilities/suicide.ts
@@ -26,23 +26,25 @@ export default class SuicideCommand extends BushCommand {
iconURL:
'https://media.discordapp.net/attachments/770256340639416320/854689949193076737/Medical_31-60_974.jpg?width=523&height=523'
})
- .addFields({
- name: '**National Suicide Prevention Hotline (U.S.):**',
- value: [
- '**Call:** 1-800-273-8255, available 24/7 for emotional support',
- '**Text: HOME** to 741741',
- 'https://suicidepreventionlifeline.org/chat/',
- '',
- '**Outside the U.S:** Find a supportive resource on [this Wikipedia list of worldwide crisis hotlines](https://en.wikipedia.org/wiki/List_of_suicide_crisis_lines)'
- ].join('\n')
- })
- .addFields({
- name: '**More Support**',
- value: [
- 'For Substance Abuse Support, Eating Disorder Support & Child Abuse and Domestic Violence:',
- "[Click to go to Discord's Health & Safety Page](https://discord.com/safety/360044103771-Mental-health-on-Discord#h_01EGRGT08QSZ5BNCH2E9HN0NYV)"
- ].join('\n')
- });
+ .addFields([
+ {
+ name: '**National Suicide Prevention Hotline (U.S.):**',
+ value: [
+ '**Call:** 1-800-273-8255, available 24/7 for emotional support',
+ '**Text: HOME** to 741741',
+ 'https://suicidepreventionlifeline.org/chat/',
+ '',
+ '**Outside the U.S:** Find a supportive resource on [this Wikipedia list of worldwide crisis hotlines](https://en.wikipedia.org/wiki/List_of_suicide_crisis_lines)'
+ ].join('\n')
+ },
+ {
+ name: '**More Support**',
+ value: [
+ 'For Substance Abuse Support, Eating Disorder Support & Child Abuse and Domestic Violence:',
+ "[Click to go to Discord's Health & Safety Page](https://discord.com/safety/360044103771-Mental-health-on-Discord#h_01EGRGT08QSZ5BNCH2E9HN0NYV)"
+ ].join('\n')
+ }
+ ]);
return message.util.send({
embeds: [suicideEmbed],
diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts
index 95df5e8..0e1cb14 100644
--- a/src/commands/utilities/wolframAlpha.ts
+++ b/src/commands/utilities/wolframAlpha.ts
@@ -45,10 +45,12 @@ export default class WolframAlphaCommand extends BushCommand {
args.image && void message.util.reply({ content: `${util.emojis.loading} Loading...`, embeds: [] });
const waApi = WolframAlphaAPI(client.config.credentials.wolframAlphaAppId);
- const decodedEmbed = new EmbedBuilder().addFields({
- name: '📥 Input',
- value: await util.inspectCleanRedactCodeblock(args.expression)
- });
+ const decodedEmbed = new EmbedBuilder().addFields([
+ {
+ name: '📥 Input',
+ value: await util.inspectCleanRedactCodeblock(args.expression)
+ }
+ ]);
const sendOptions: MessageOptions = { content: null, allowedMentions: AllowedMentions.none() };
try {
const calculated = await (args.image
@@ -58,15 +60,17 @@ export default class WolframAlphaCommand extends BushCommand {
if (args.image) {
decodedEmbed.setImage(await util.uploadImageToImgur(calculated.split(',')[1]));
- decodedEmbed.addFields({ name: '📤 Output', value: '​' });
+ decodedEmbed.addFields([{ name: '📤 Output', value: '​' }]);
} else {
- decodedEmbed.addFields({ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(calculated.toString()) });
+ decodedEmbed.addFields([{ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(calculated.toString()) }]);
}
} catch (error) {
decodedEmbed
.setTitle(`${util.emojis.errorFull} Unable to Query Expression`)
.setColor(util.colors.error)
- .addFields({ name: `📤 Error`, value: await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') });
+ .addFields([
+ { name: `📤 Error`, value: await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') }
+ ]);
}
sendOptions.embeds = [decodedEmbed];