aboutsummaryrefslogtreecommitdiff
path: root/src/commands/utilities/hash.ts
blob: 251d5e67c89ec6bb17072054822742e39fe78aa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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';

// 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: []
// 		});
// 	}

// 	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.');
// 		}
// 	}
// }