aboutsummaryrefslogtreecommitdiff
path: root/src/commands/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/utilities')
-rw-r--r--src/commands/utilities/hash.ts82
-rw-r--r--src/commands/utilities/price.ts9
2 files changed, 44 insertions, 47 deletions
diff --git a/src/commands/utilities/hash.ts b/src/commands/utilities/hash.ts
index 6817f04..251d5e6 100644
--- a/src/commands/utilities/hash.ts
+++ b/src/commands/utilities/hash.ts
@@ -1,44 +1,44 @@
-import { BushCommand, clientSendAndPermCheck, type CommandMessage } from '#lib';
-import assert from 'assert/strict';
-import crypto from 'crypto';
-import { ApplicationCommandOptionType } from 'discord.js';
-import got from 'got';
+// import { BushCommand, clientSendAndPermCheck, type CommandMessage } from '#lib';
+// import assert from 'assert/strict';
+// import crypto from 'crypto';
+// import { ApplicationCommandOptionType } from 'discord.js';
+// import got from 'got';
-assert(crypto);
-assert(got);
+// assert(crypto);
+// assert(got);
-export default class HashCommand extends BushCommand {
- public constructor() {
- super('hash', {
- aliases: ['hash'],
- category: 'utilities',
- description: 'Gets the file hash of the given discord link',
- usage: ['hash <fileUrl>'],
- examples: ['hash https://cdn.discordapp.com/emojis/782630946435366942.png?v=1'], //nice
- args: [
- {
- id: 'url',
- description: 'The url of the discord link to find the hash of.',
- type: 'url',
- prompt: 'What url would you like to find the hash of?',
- retry: '{error} Enter a valid url.',
- slashType: ApplicationCommandOptionType.String
- }
- ],
- clientPermissions: (m) => clientSendAndPermCheck(m),
- userPermissions: []
- });
- }
+// export default class HashCommand extends BushCommand {
+// public constructor() {
+// super('hash', {
+// aliases: ['hash'],
+// category: 'utilities',
+// description: 'Gets the file hash of the given discord link',
+// usage: ['hash <fileUrl>'],
+// examples: ['hash https://cdn.discordapp.com/emojis/782630946435366942.png?v=1'], //nice
+// args: [
+// {
+// id: 'url',
+// description: 'The url of the discord link to find the hash of.',
+// type: 'url',
+// prompt: 'What url would you like to find the hash of?',
+// retry: '{error} Enter a valid url.',
+// slashType: ApplicationCommandOptionType.String
+// }
+// ],
+// clientPermissions: (m) => clientSendAndPermCheck(m),
+// userPermissions: []
+// });
+// }
- public override async exec(message: CommandMessage, { url }: { url: string }) {
- try {
- const req = await got.get(url);
- const rawHash = crypto.createHash('md5');
- rawHash.update(req.rawBody.toString('binary'));
- const hash = rawHash.digest('hex');
- await message.util.reply(`\`${hash}\``);
- } catch {
- await message.util.reply('Unable to calculate hash.');
- }
- }
-}
+// public override async exec(message: CommandMessage, { url }: { url: string }) {
+// try {
+// const req = await got.get(url);
+// const rawHash = crypto.createHash('md5');
+// rawHash.update(req.rawBody.toString('binary'));
+// const hash = rawHash.digest('hex');
+// await message.util.reply(`\`${hash}\``);
+// } catch {
+// await message.util.reply('Unable to calculate hash.');
+// }
+// }
+// }
diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts
index 8a3b5c6..bfe1f10 100644
--- a/src/commands/utilities/price.ts
+++ b/src/commands/utilities/price.ts
@@ -1,11 +1,9 @@
import { ArgType, BushCommand, clientSendAndPermCheck, colors, emojis, format, oxford, type CommandMessage } from '#lib';
import assert from 'assert/strict';
import { ApplicationCommandOptionType, AutocompleteInteraction, EmbedBuilder, PermissionFlagsBits } from 'discord.js';
-import Fuse from 'fuse.js';
-import got from 'got';
+import { default as Fuse } from 'fuse.js';
assert(Fuse);
-assert(got);
export default class PriceCommand extends BushCommand {
public static cachedItemList: string[] = [];
@@ -57,9 +55,8 @@ export default class PriceCommand extends BushCommand {
const [bazaar, currentLowestBIN, averageLowestBIN, auctionAverages] = (await Promise.all(
PriceCommand.urls.map(({ url, error }) =>
- got
- .get(url)
- .json()
+ fetch(url)
+ .then((p) => (p.ok ? p.json() : undefined))
.catch(() => (errors.push(error), undefined))
)
)) as [Bazaar?, LowestBIN?, LowestBIN?, AuctionAverages?];