aboutsummaryrefslogtreecommitdiff
path: root/src/commands/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/utilities')
-rw-r--r--src/commands/utilities/_poll.ts2
-rw-r--r--src/commands/utilities/activity.ts2
-rw-r--r--src/commands/utilities/calculator.ts14
-rw-r--r--src/commands/utilities/decode.ts9
-rw-r--r--src/commands/utilities/highlight-add.ts2
-rw-r--r--src/commands/utilities/highlight-clear.ts2
-rw-r--r--src/commands/utilities/highlight-matches.ts2
-rw-r--r--src/commands/utilities/highlight-remove.ts2
-rw-r--r--src/commands/utilities/highlight-show.ts2
-rw-r--r--src/commands/utilities/viewRaw.ts3
-rw-r--r--src/commands/utilities/wolframAlpha.ts19
11 files changed, 35 insertions, 24 deletions
diff --git a/src/commands/utilities/_poll.ts b/src/commands/utilities/_poll.ts
index fdf6381..1ceb13a 100644
--- a/src/commands/utilities/_poll.ts
+++ b/src/commands/utilities/_poll.ts
@@ -1,4 +1,4 @@
-// import { BushCommand, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
+// import { BushCommand, clientSendAndPermCheck, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
// import { ApplicationCommandOptionType, ComponentType } from 'discord.js';
// export default class PollCommand extends BushCommand {
diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts
index dfbccfb..e5c2cdd 100644
--- a/src/commands/utilities/activity.ts
+++ b/src/commands/utilities/activity.ts
@@ -171,7 +171,7 @@ export default class ActivityCommand extends BushCommand {
: activityTypeCaster(message, args.activity);
let response: string;
- const invite: any = await client.rest
+ const invite: any = await this.client.rest
.post(`/channels/${channel.id}/invites`, {
body: {
validate: null,
diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts
index 75d63a1..2204fe6 100644
--- a/src/commands/utilities/calculator.ts
+++ b/src/commands/utilities/calculator.ts
@@ -4,7 +4,6 @@ import {
clientSendAndPermCheck,
colors,
emojis,
- inspectCleanRedactCodeblock,
type CommandMessage,
type SlashMessage
} from '#lib';
@@ -43,7 +42,7 @@ export default class CalculatorCommand extends BushCommand {
const decodedEmbed = new EmbedBuilder().addFields([
{
name: '📥 Input',
- value: await inspectCleanRedactCodeblock(args.expression, 'mma')
+ value: await this.client.utils.inspectCleanRedactCodeblock(args.expression, 'mma')
}
]);
try {
@@ -51,12 +50,19 @@ export default class CalculatorCommand extends BushCommand {
decodedEmbed
.setTitle(`${emojis.successFull} Successfully Calculated Expression`)
.setColor(colors.success)
- .addFields([{ name: '📤 Output', value: await inspectCleanRedactCodeblock(calculated.toString(), 'mma') }]);
+ .addFields([
+ { name: '📤 Output', value: await this.client.utils.inspectCleanRedactCodeblock(calculated.toString(), 'mma') }
+ ]);
} catch (error) {
decodedEmbed
.setTitle(`${emojis.errorFull} Unable to Calculate Expression`)
.setColor(colors.error)
- .addFields([{ name: `📤 Error`, value: await inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') }]);
+ .addFields([
+ {
+ name: `📤 Error`,
+ value: await this.client.utils.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 cc742c8..6aabeac 100644
--- a/src/commands/utilities/decode.ts
+++ b/src/commands/utilities/decode.ts
@@ -5,7 +5,6 @@ import {
clientSendAndPermCheck,
colors,
formatError,
- inspectCleanRedactCodeblock,
type CommandMessage,
type SlashMessage
} from '#lib';
@@ -64,15 +63,17 @@ export default class DecodeCommand extends BushCommand {
const encodeOrDecode = capitalize(message?.util?.parsed?.alias ?? 'decoded');
const decodedEmbed = new EmbedBuilder()
.setTitle(`${encodeOrDecode} Information`)
- .addFields([{ name: '📥 Input', value: await inspectCleanRedactCodeblock(data) }]);
+ .addFields([{ name: '📥 Input', value: await this.client.utils.inspectCleanRedactCodeblock(data) }]);
try {
const decoded = Buffer.from(data, from).toString(to);
- decodedEmbed.setColor(colors.success).addFields([{ name: '📤 Output', value: await inspectCleanRedactCodeblock(decoded) }]);
+ decodedEmbed
+ .setColor(colors.success)
+ .addFields([{ name: '📤 Output', value: await this.client.utils.inspectCleanRedactCodeblock(decoded) }]);
} catch (error) {
decodedEmbed.setColor(colors.error).addFields([
{
name: `📤 Error ${encodeOrDecode.slice(1)}ing`,
- value: await inspectCleanRedactCodeblock(formatError(error))
+ value: await this.client.utils.inspectCleanRedactCodeblock(formatError(error))
}
]);
}
diff --git a/src/commands/utilities/highlight-add.ts b/src/commands/utilities/highlight-add.ts
index 9624a7e..3547c90 100644
--- a/src/commands/utilities/highlight-add.ts
+++ b/src/commands/utilities/highlight-add.ts
@@ -59,7 +59,7 @@ export default class HighlightAddCommand extends BushCommand {
}
}
- const res = await client.highlightManager.addHighlight(message.guild.id, message.author.id, {
+ const res = await this.client.highlightManager.addHighlight(message.guild.id, message.author.id, {
word: args.word,
regex: args.regex
});
diff --git a/src/commands/utilities/highlight-clear.ts b/src/commands/utilities/highlight-clear.ts
index df9f387..9e1ed62 100644
--- a/src/commands/utilities/highlight-clear.ts
+++ b/src/commands/utilities/highlight-clear.ts
@@ -23,7 +23,7 @@ export default class HighlightClearCommand extends BushCommand {
const confirm = await ConfirmationPrompt.send(message, { content: `Are you sure you want to clear your highlight list?` });
if (!confirm) return await message.util.reply(`${emojis.warn} You decided not to clear your highlight list.`);
- const success = await client.highlightManager.removeAllHighlights(message.guild.id, message.author.id);
+ const success = await this.client.highlightManager.removeAllHighlights(message.guild.id, message.author.id);
if (!success) return await message.util.reply(`${emojis.error} There was an error clearing your highlight list.`);
return await message.util.reply(`${emojis.success} Successfully cleared your highlight list.`);
diff --git a/src/commands/utilities/highlight-matches.ts b/src/commands/utilities/highlight-matches.ts
index b458550..7bf94fd 100644
--- a/src/commands/utilities/highlight-matches.ts
+++ b/src/commands/utilities/highlight-matches.ts
@@ -34,7 +34,7 @@ export default class HighlightMatchesCommand extends BushCommand {
public override async exec(message: CommandMessage | SlashMessage, args: { phrase: ArgType<'string'> }) {
assert(message.inGuild());
- const res = await client.highlightManager.checkPhrase(message.guild.id, message.author.id, args.phrase);
+ const res = await this.client.highlightManager.checkPhrase(message.guild.id, message.author.id, args.phrase);
if (!res.size) return await message.util.reply(`${emojis.error} You are not highlighting any words`);
diff --git a/src/commands/utilities/highlight-remove.ts b/src/commands/utilities/highlight-remove.ts
index bb1300a..4dddff6 100644
--- a/src/commands/utilities/highlight-remove.ts
+++ b/src/commands/utilities/highlight-remove.ts
@@ -31,7 +31,7 @@ export default class HighlightRemoveCommand extends BushCommand {
public override async exec(message: CommandMessage | SlashMessage, args: { word: ArgType<'string'> }) {
assert(message.inGuild());
- const res = await client.highlightManager.removeHighlight(message.guild.id, message.author.id, args.word);
+ const res = await this.client.highlightManager.removeHighlight(message.guild.id, message.author.id, args.word);
if (typeof res === 'string')
return await message.util.reply({ content: `${emojis.error} ${res}`, allowedMentions: AllowedMentions.none() });
diff --git a/src/commands/utilities/highlight-show.ts b/src/commands/utilities/highlight-show.ts
index d966f3a..0558005 100644
--- a/src/commands/utilities/highlight-show.ts
+++ b/src/commands/utilities/highlight-show.ts
@@ -23,7 +23,7 @@ export default class HighlightShowCommand extends BushCommand {
where: { guild: message.guild.id, user: message.author.id }
});
- void client.highlightManager.syncCache();
+ void this.client.highlightManager.syncCache();
if (!highlight.words.length) return message.util.reply(`${emojis.error} You are not highlighting any words.`);
diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts
index 8114cef..057d86d 100644
--- a/src/commands/utilities/viewRaw.ts
+++ b/src/commands/utilities/viewRaw.ts
@@ -2,7 +2,6 @@ import {
Arg,
BushCommand,
clientSendAndPermCheck,
- codeblock,
colors,
emojis,
inspect,
@@ -114,6 +113,6 @@ export default class ViewRawCommand extends BushCommand {
.setTimestamp(message.createdTimestamp)
.setColor(message.member?.roles?.color?.color ?? colors.default)
.setTitle('Raw Message Information')
- .setDescription(await codeblock(content, 2048, lang));
+ .setDescription(await message.client.utils.codeblock(content, 2048, lang));
}
}
diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts
index b682c85..baf764f 100644
--- a/src/commands/utilities/wolframAlpha.ts
+++ b/src/commands/utilities/wolframAlpha.ts
@@ -4,8 +4,6 @@ import {
clientSendAndPermCheck,
colors,
emojis,
- inspectCleanRedactCodeblock,
- uploadImageToImgur,
type ArgType,
type CommandMessage,
type SlashMessage
@@ -57,12 +55,12 @@ export default class WolframAlphaCommand extends BushCommand {
if (message.util.isSlashMessage(message)) await message.interaction.deferReply();
args.image && void message.util.reply({ content: `${emojis.loading} Loading...`, embeds: [] });
- const waApi = WolframAlphaAPI(client.config.credentials.wolframAlphaAppId);
+ const waApi = WolframAlphaAPI(this.client.config.credentials.wolframAlphaAppId);
const decodedEmbed = new EmbedBuilder().addFields([
{
name: '📥 Input',
- value: await inspectCleanRedactCodeblock(args.expression)
+ value: await this.client.utils.inspectCleanRedactCodeblock(args.expression)
}
]);
const sendOptions: MessageOptions = { content: null, allowedMentions: AllowedMentions.none() };
@@ -73,16 +71,23 @@ export default class WolframAlphaCommand extends BushCommand {
decodedEmbed.setTitle(`${emojis.successFull} Successfully Queried Expression`).setColor(colors.success);
if (args.image) {
- decodedEmbed.setImage(await uploadImageToImgur(calculated.split(',')[1]));
+ decodedEmbed.setImage(await this.client.utils.uploadImageToImgur(calculated.split(',')[1]));
decodedEmbed.addFields([{ name: '📤 Output', value: '​' }]);
} else {
- decodedEmbed.addFields([{ name: '📤 Output', value: await inspectCleanRedactCodeblock(calculated.toString()) }]);
+ decodedEmbed.addFields([
+ { name: '📤 Output', value: await this.client.utils.inspectCleanRedactCodeblock(calculated.toString()) }
+ ]);
}
} catch (error) {
decodedEmbed
.setTitle(`${emojis.errorFull} Unable to Query Expression`)
.setColor(colors.error)
- .addFields([{ name: `📤 Error`, value: await inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') }]);
+ .addFields([
+ {
+ name: `📤 Error`,
+ value: await this.client.utils.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js')
+ }
+ ]);
}
sendOptions.embeds = [decodedEmbed];