diff options
Diffstat (limited to 'src/commands/utilities')
-rw-r--r-- | src/commands/utilities/activity.ts | 5 | ||||
-rw-r--r-- | src/commands/utilities/calculator.ts | 4 | ||||
-rw-r--r-- | src/commands/utilities/decode.ts | 4 | ||||
-rw-r--r-- | src/commands/utilities/hash.ts | 4 | ||||
-rw-r--r-- | src/commands/utilities/price.ts | 94 | ||||
-rw-r--r-- | src/commands/utilities/steal.ts | 4 | ||||
-rw-r--r-- | src/commands/utilities/suicide.ts | 4 | ||||
-rw-r--r-- | src/commands/utilities/uuid.ts | 13 | ||||
-rw-r--r-- | src/commands/utilities/viewRaw.ts | 8 | ||||
-rw-r--r-- | src/commands/utilities/whoHasRole.ts | 6 | ||||
-rw-r--r-- | src/commands/utilities/wolframAlpha.ts | 13 |
11 files changed, 83 insertions, 76 deletions
diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts index 4066934..a2ca3e2 100644 --- a/src/commands/utilities/activity.ts +++ b/src/commands/utilities/activity.ts @@ -105,10 +105,7 @@ export default class YouTubeCommand extends BushCommand { }); } - public override async exec( - message: BushMessage | BushSlashMessage, - args: { channel: VoiceChannel; activity: string } - ): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { channel: VoiceChannel; activity: string }) { const channel = typeof args.channel === 'string' ? message.guild?.channels.cache.get(args.channel) : args.channel; if (!channel || channel.type !== 'GUILD_VOICE') return await message.util.reply(`${util.emojis.error} Choose a valid voice channel`); diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts index 743e9b2..861a356 100644 --- a/src/commands/utilities/calculator.ts +++ b/src/commands/utilities/calculator.ts @@ -9,7 +9,7 @@ export default class CalculatorCommand extends BushCommand { category: 'utilities', description: { content: 'Calculates math expressions.', - usage: 'calculator <expression>', + usage: ['calculator <expression>'], examples: ['calculator 9+10'] }, args: [ @@ -37,7 +37,7 @@ export default class CalculatorCommand extends BushCommand { userPermissions: [] }); } - public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string }): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string }) { const decodedEmbed = new MessageEmbed().addField( '📥 Input', await util.inspectCleanRedactCodeblock(args.expression, 'mma') diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts index c497183..6812d91 100644 --- a/src/commands/utilities/decode.ts +++ b/src/commands/utilities/decode.ts @@ -12,7 +12,7 @@ export default class DecodeCommand extends BushCommand { category: 'utilities', description: { content: 'Decode / encode.', - usage: 'decode <from> <to> <data>', + usage: ['decode <from> <to> <data>'], examples: ['decode base64 ascii TmVyZApJbWFnaW5lIGRlY29kaW5nIHRoaXMgbG1hbw=='] }, args: [ @@ -73,7 +73,7 @@ export default class DecodeCommand extends BushCommand { public override async exec( message: BushMessage | AkairoMessage, { from, to, data }: { from: BufferEncoding; to: BufferEncoding; data: string } - ): Promise<unknown> { + ) { const encodeOrDecode = util.capitalizeFirstLetter(message?.util?.parsed?.alias ?? 'decoded'); const decodedEmbed = new MessageEmbed() .setTitle(`${encodeOrDecode} Information`) diff --git a/src/commands/utilities/hash.ts b/src/commands/utilities/hash.ts index a8fdee1..646ed28 100644 --- a/src/commands/utilities/hash.ts +++ b/src/commands/utilities/hash.ts @@ -9,7 +9,7 @@ export default class HashCommand extends BushCommand { category: 'utilities', description: { content: 'Gets the file hash of the given discord link', - usage: 'hash <file url>', + usage: ['hash <fileUrl>'], examples: ['hash https://cdn.discordapp.com/emojis/782630946435366942.png?v=1'] //nice }, args: [ @@ -27,7 +27,7 @@ export default class HashCommand extends BushCommand { }); } - public override async exec(message: BushMessage, { url }: { url: string }): Promise<void> { + public override async exec(message: BushMessage, { url }: { url: string }) { try { const req = await got.get(url); const rawHash = crypto.createHash('md5'); diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index 059533b..a232e56 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -3,58 +3,15 @@ import { MessageEmbed } from 'discord.js'; import Fuse from 'fuse.js'; import got from 'got'; -interface Summary { - amount: number; - pricePerUnit: number; - orders: number; -} - -interface Bazaar { - success: boolean; - lastUpdated: number; - products: { - [key: string]: { - product_id: string; - sell_summary: Summary[]; - buy_summary: Summary[]; - quick_status: { - productId: string; - sellPrice: number; - sellVolume: number; - sellMovingWeek: number; - sellOrders: number; - buyPrice: number; - buyVolume: number; - buyMovingWeek: number; - buyOrders: number; - }; - }; - }; -} - -interface LowestBIN { - [key: string]: number; -} - -interface AuctionAverages { - [key: string]: { - price?: number; - count?: number; - sales?: number; - clean_price?: number; - clean_sales?: number; - }; -} - export default class PriceCommand extends BushCommand { public constructor() { super('price', { aliases: ['price'], category: 'utilities', description: { - usage: 'price <item id>', - examples: ['price ASPECT_OF_THE_END'], - content: 'Finds the price information of an item.' + content: 'Finds the price information of an item.', + usage: ['price <item id>'], + examples: ['price ASPECT_OF_THE_END'] }, args: [ { @@ -94,7 +51,7 @@ export default class PriceCommand extends BushCommand { }); } - public override async exec(message: BushMessage, { item, strict }: { item: string; strict: boolean }): Promise<unknown> { + public override async exec(message: BushMessage, { item, strict }: { item: string; strict: boolean }) { if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); const errors = new Array<string>(); @@ -189,3 +146,46 @@ export default class PriceCommand extends BushCommand { } } } + +interface Summary { + amount: number; + pricePerUnit: number; + orders: number; +} + +interface Bazaar { + success: boolean; + lastUpdated: number; + products: { + [key: string]: { + product_id: string; + sell_summary: Summary[]; + buy_summary: Summary[]; + quick_status: { + productId: string; + sellPrice: number; + sellVolume: number; + sellMovingWeek: number; + sellOrders: number; + buyPrice: number; + buyVolume: number; + buyMovingWeek: number; + buyOrders: number; + }; + }; + }; +} + +interface LowestBIN { + [key: string]: number; +} + +interface AuctionAverages { + [key: string]: { + price?: number; + count?: number; + sales?: number; + clean_price?: number; + clean_sales?: number; + }; +} diff --git a/src/commands/utilities/steal.ts b/src/commands/utilities/steal.ts index 767534e..b92a2da 100644 --- a/src/commands/utilities/steal.ts +++ b/src/commands/utilities/steal.ts @@ -8,7 +8,7 @@ export default class StealCommand extends BushCommand { category: 'utilities', description: { content: 'Steal an emoji from another server and add it to your own.', - usage: 'steal <emoji/emoji id/url> [name]', + usage: ['steal <emoji/emojiId/url> [name]'], examples: ['steal <:omegaclown:782630946435366942> ironm00n'] }, args: [ @@ -34,7 +34,7 @@ export default class StealCommand extends BushCommand { public override async exec( message: BushMessage, args?: { emojiOrName?: { name: string; id: Snowflake } | Snowflake | URL | string; name2: string } - ): Promise<unknown> { + ) { if ((!args || !args.emojiOrName) && !message.attachments.size) return await message.util.reply(`${util.emojis.error} You must provide an emoji to steal.`); diff --git a/src/commands/utilities/suicide.ts b/src/commands/utilities/suicide.ts index 31bdca0..3709e37 100644 --- a/src/commands/utilities/suicide.ts +++ b/src/commands/utilities/suicide.ts @@ -8,7 +8,7 @@ export default class TemplateCommand extends BushCommand { category: 'utilities', description: { content: 'Mental Health Resources. Credit to https://github.com/dexbiobot/Zeppelin.', - usage: 'suicide', + usage: ['suicide'], examples: ['suicide'] }, slash: true, @@ -18,7 +18,7 @@ export default class TemplateCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage) { // stolen from https://github.com/dexbiobot/Zeppelin const suicideEmbed = new MessageEmbed() .setTitle('Mental Health Resources') diff --git a/src/commands/utilities/uuid.ts b/src/commands/utilities/uuid.ts index 823d1ff..56566d4 100644 --- a/src/commands/utilities/uuid.ts +++ b/src/commands/utilities/uuid.ts @@ -7,7 +7,7 @@ export default class UuidCommand extends BushCommand { category: 'utilities', description: { content: "Find someone's minecraft uuid", - usage: 'uuid <ign>', + usage: ['uuid <ign>'], examples: ['uuid ironm00n'] }, args: [ @@ -21,12 +21,21 @@ export default class UuidCommand extends BushCommand { } } ], + slash: true, + slashOptions: [ + { + name: 'ign', + description: 'What ign would you like to find the uuid of?', + type: 'STRING', + required: false + } + ], clientPermissions: (m) => util.clientSendAndPermCheck(m), userPermissions: [] }); } - public override async exec(message: BushMessage, { ign }: { ign: { match: any[]; matches: any[] } }): Promise<unknown> { + public override async exec(message: BushMessage, { ign }: { ign: { match: any[]; matches: any[] } }) { if (!ign) return await message.util.reply(`${util.emojis.error} Please enter a valid ign.`); const readableIGN = ign.match[0]; try { diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts index 60529c5..3667d40 100644 --- a/src/commands/utilities/viewRaw.ts +++ b/src/commands/utilities/viewRaw.ts @@ -7,9 +7,9 @@ export default class ViewRawCommand extends BushCommand { aliases: ['view-raw', 'vr'], category: 'utilities', description: { - usage: 'viewraw <message id> <channel>', - examples: ['viewraw 322862723090219008'], - content: 'Shows raw information about a message.' + content: 'Shows raw information about a message.', + usage: ['viewraw <message id> <channel>'], + examples: ['viewraw 322862723090219008'] }, args: [ { @@ -77,7 +77,7 @@ export default class ViewRawCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, args: { message: Snowflake; channel: TextChannel | NewsChannel | DMChannel; json?: boolean; js: boolean } - ): Promise<unknown> { + ) { if (!args.channel) args.channel = (message.channel as TextChannel | NewsChannel | DMChannel)!; const newMessage = await args.channel.messages.fetch(`${args.message}` as Snowflake).catch(() => null); if (!newMessage) diff --git a/src/commands/utilities/whoHasRole.ts b/src/commands/utilities/whoHasRole.ts index be27c7c..ce7a70e 100644 --- a/src/commands/utilities/whoHasRole.ts +++ b/src/commands/utilities/whoHasRole.ts @@ -8,8 +8,8 @@ export default class WhoHasRoleCommand extends BushCommand { category: 'utilities', description: { content: 'Allows you to view what users have a certain role.', - usage: 'template <requiredArg> [optionalArg]', - examples: ['template 1 2'] + usage: ['who-has-role <role>'], + examples: ['who-has-role admin'] }, args: [ { @@ -37,7 +37,7 @@ export default class WhoHasRoleCommand extends BushCommand { typing: true }); } - public override async exec(message: BushMessage | BushSlashMessage, args: { role: Role }): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { role: Role }) { if (message.util.isSlash) await (message.interaction as CommandInteraction).deferReply(); const roleMembers = args.role.members.map((member) => `${member.user} (${Util.escapeMarkdown(member.user.tag)})`); diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts index 426a0c7..ea055e8 100644 --- a/src/commands/utilities/wolframAlpha.ts +++ b/src/commands/utilities/wolframAlpha.ts @@ -9,11 +9,15 @@ export default class WolframAlphaCommand extends BushCommand { category: 'utilities', description: { content: 'Queries Wolfram|Alpha for a result.', - usage: 'wolfram-alpha <expression>', + usage: ['wolfram-alpha <expression>'], examples: ['wolfram-alpha what is the population of france'] }, args: [ - { id: 'image', match: 'flag', flag: '--image' }, + { + id: 'image', + match: 'flag', + flag: '--image' + }, { id: 'expression', type: 'string', @@ -44,10 +48,7 @@ export default class WolframAlphaCommand extends BushCommand { userPermissions: [] }); } - public override async exec( - message: BushMessage | BushSlashMessage, - args: { expression: string; image: boolean } - ): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string; image: boolean }) { if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); args.image && void message.util.reply({ content: `${util.emojis.loading} Loading...`, embeds: [] }); |