aboutsummaryrefslogtreecommitdiff
path: root/src/commands/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/utilities')
-rw-r--r--src/commands/utilities/activity.ts127
-rw-r--r--src/commands/utilities/calculator.ts25
-rw-r--r--src/commands/utilities/decode.ts56
-rw-r--r--src/commands/utilities/hash.ts16
-rw-r--r--src/commands/utilities/price.ts35
-rw-r--r--src/commands/utilities/steal.ts105
-rw-r--r--src/commands/utilities/suicide.ts8
-rw-r--r--src/commands/utilities/uuid.ts39
-rw-r--r--src/commands/utilities/viewRaw.ts78
-rw-r--r--src/commands/utilities/whoHasRole.ts26
-rw-r--r--src/commands/utilities/wolframAlpha.ts37
11 files changed, 260 insertions, 292 deletions
diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts
index 3fca2b6..6829757 100644
--- a/src/commands/utilities/activity.ts
+++ b/src/commands/utilities/activity.ts
@@ -2,29 +2,62 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { DiscordAPIError, Message, VoiceChannel } from 'discord.js';
const activityMap = {
- 'Poker Night': '755827207812677713',
- 'Betrayal.io': '773336526917861400',
- 'Fishington.io': '814288819477020702',
- 'YouTube Together': '755600276941176913',
- 'Chess in the Park': '832012774040141894',
- 'Watch Together': '880218394199220334',
- 'Doodle Crew': '878067389634314250',
- 'Wood Snacks': '879863976006127627',
- 'Letter Tile': '879863686565621790'
+ 'Poker Night': {
+ id: '755827207812677713',
+ aliases: ['poker']
+ },
+ 'Betrayal.io': {
+ id: '773336526917861400',
+ aliases: ['betrayal']
+ },
+ 'Fishington.io': {
+ id: '814288819477020702',
+ aliases: ['fish', 'fishing', 'fishington']
+ },
+ 'YouTube Together': {
+ id: '755600276941176913',
+ aliases: ['youtube-together']
+ },
+ 'Chess In The Park': {
+ id: '832012774040141894',
+ aliases: ['chess']
+ },
+ 'Watch Together': {
+ id: '880218394199220334',
+ aliases: ['watch-together', 'yt', 'youtube']
+ },
+ 'Doodle Crew': {
+ id: '878067389634314250',
+ aliases: ['doodle-crew', 'doodle']
+ },
+ 'Wood Snacks': {
+ id: '879863976006127627',
+ aliases: ['wood-snacks', 'wood']
+ },
+ 'Letter Tile': {
+ id: '879863686565621790',
+ aliases: ['letter-tile', 'letter']
+ },
+ 'Spell Cast': {
+ id: '852509694341283871',
+ aliases: ['spell-cast', 'spell', 'cast']
+ },
+ 'Checkers In The Park': {
+ id: '832013003968348200',
+ aliases: ['checkers']
+ }
};
function map(phase: string) {
if (client.consts.regex.snowflake.test(phase)) return phase;
- else if (Reflect.has(activityMap, phase)) return activityMap[phase as keyof typeof activityMap];
- else if (['yt', 'youtube'].includes(phase)) return activityMap['Watch Together'];
- else if (['chess', 'park'].includes(phase)) return activityMap['Chess in the Park'];
- else if (['poker'].includes(phase)) return activityMap['Poker Night'];
- else if (['fish', 'fishing', 'fishington'].includes(phase)) return activityMap['Fishington.io'];
- else if (['betrayal'].includes(phase)) return activityMap['Betrayal.io'];
- else if (['doodle-crew', 'doodle'].includes(phase)) return activityMap['Doodle Crew'];
- else if (['wood-snacks', 'wood'].includes(phase)) return activityMap['Wood Snacks'];
- else if (['letter-tile', 'letter'].includes(phase)) return activityMap['Letter Tile'];
- else return null;
+ else if (phase in activityMap) return activityMap[phase as keyof typeof activityMap];
+
+ for (const activity in activityMap) {
+ if (activityMap[activity as keyof typeof activityMap].aliases.includes(phase.toLowerCase()))
+ return activityMap[activity as keyof typeof activityMap].id;
+ }
+
+ return null;
}
const activityTypeCaster = (_message: Message | BushMessage | BushSlashMessage, phrase: string) => {
@@ -56,53 +89,43 @@ export default class YouTubeCommand extends BushCommand {
'letter'
],
category: 'utilities',
- description: {
- content: 'Allows you to play discord activities in voice channels.',
- usage: [
- 'activity <channel> <`yt`|`youtube`|`chess`|`park`|`poker`|`fish`|`fishing`|`fishington`|`betrayal`>',
- 'yt <channel>' // you do not need to specify the activity if you use its alias.
- ],
- examples: ['yt 785281831788216364', 'activity 785281831788216364 yt']
- },
+ description: 'Allows you to play discord activities in voice channels.',
+ usage: [
+ `activity <channel> <${Object.values(activityMap)
+ .flatMap((a) => a.aliases)
+ .map((a) => `'${a}'`)
+ .join('|')}>`,
+ 'yt <channel>' // you do not need to specify the activity if you use its alias.
+ ],
+ examples: ['yt 785281831788216364', 'activity 785281831788216364 yt'],
args: [
{
id: 'channel',
+ description: 'The channel to create the activity in.',
type: 'voiceChannel',
- prompt: {
- start: 'What channel would you like to use?',
- retry: '{error} Choose a valid voice channel'
- }
+ prompt: 'What channel would you like to use?',
+ retry: '{error} Choose a valid voice channel',
+ slashType: 'CHANNEL',
+ channelTypes: ['GUILD_VOICE']
},
{
id: 'activity',
+ description: 'The activity to create an invite for.',
match: 'rest',
customType: activityTypeCaster,
- prompt: {
- start: 'What activity would you like to play?',
- retry:
- '{error} You must choose one of the following options: `yt`, `youtube`, `chess`, `park`, `poker`, `fish`, `fishing`, `fishington`, or `betrayal`.'
- }
- }
- ],
- slash: true,
- slashOptions: [
- {
- name: 'channel',
- description: 'What channel would you like to use?',
- type: 'CHANNEL',
- required: true
- },
- {
- name: 'activity',
- description: 'What activity would you like to play?',
- type: 'STRING',
- required: true,
+ prompt: 'What activity would you like to play?',
+ retry: `{error} You must choose one of the following options: ${Object.values(activityMap)
+ .flatMap((a) => a.aliases)
+ .map((a) => `\`${a}\``)
+ .join(', ')}.`,
+ slashType: 'STRING',
choices: Object.keys(activityMap).map((key) => ({
name: key,
- value: activityMap[key as keyof typeof activityMap]
+ value: activityMap[key as keyof typeof activityMap].id
}))
}
],
+ slash: true,
clientPermissions: (m) => util.clientSendAndPermCheck(m),
userPermissions: []
});
diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts
index 277947b..2c70dcc 100644
--- a/src/commands/utilities/calculator.ts
+++ b/src/commands/utilities/calculator.ts
@@ -7,32 +7,21 @@ export default class CalculatorCommand extends BushCommand {
super('calculator', {
aliases: ['calculator', 'calc', 'math'],
category: 'utilities',
- description: {
- content: 'Calculates math expressions.',
- usage: ['calculator <expression>'],
- examples: ['calculator 9+10']
- },
+ description: 'Calculates math expressions.',
+ usage: ['calculator <expression>'],
+ examples: ['calculator 9+10'],
args: [
{
id: 'expression',
+ description: 'The expression to calculate.',
type: 'string',
match: 'rest',
- prompt: {
- start: 'What would you like to evaluate?',
- retry: '{error} Pick something to evaluate.',
- optional: false
- }
+ prompt: 'What would you like to calculate?',
+ retry: '{error} Pick something to calculate.',
+ slashType: 'STRING'
}
],
slash: true,
- slashOptions: [
- {
- name: 'expression',
- description: 'What would you like to evaluate?',
- type: 'STRING',
- required: true
- }
- ],
clientPermissions: (m) => util.clientSendAndPermCheck(m),
userPermissions: []
});
diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts
index 7f0c7d4..76f735b 100644
--- a/src/commands/utilities/decode.ts
+++ b/src/commands/utilities/decode.ts
@@ -10,61 +10,39 @@ export default class DecodeCommand extends BushCommand {
super('decode', {
aliases: ['decode', 'encode'],
category: 'utilities',
- description: {
- content: 'Decode / encode.',
- usage: ['decode <from> <to> <data>'],
- examples: ['decode base64 ascii TmVyZApJbWFnaW5lIGRlY29kaW5nIHRoaXMgbG1hbw==']
- },
+ description: 'Decode / encode.',
+ usage: ['decode <from> <to> <data>'],
+ examples: ['decode base64 ascii TmVyZApJbWFnaW5lIGRlY29kaW5nIHRoaXMgbG1hbw=='],
args: [
{
id: 'from',
+ description: 'The type of data you are inputting.',
customType: encodingTypesArray,
- prompt: {
- start: 'What is the encoding of the original data?',
- retry: `{error} Choose one of the following ${encodingTypesString} for the encoding of the original data.`
- }
+ prompt: 'What is the encoding of the original data?',
+ retry: `{error} Choose one of the following ${encodingTypesString} for the encoding of the original data.`,
+ slashType: 'STRING',
+ choices: encodingTypesArray.map((e) => ({ name: e, value: e }))
},
{
id: 'to',
+ description: 'The type of data you want the output to be.',
customType: encodingTypesArray,
- prompt: {
- start: 'What would you like the encoding of the resulting data to be?',
- retry: `{error} Choose one of the following ${encodingTypesString} for the encoding of the resulting data.`
- }
+ prompt: 'What would you like the encoding of the resulting data to be?',
+ retry: `{error} Choose one of the following ${encodingTypesString} for the encoding of the resulting data.`,
+ slashType: 'STRING',
+ choices: encodingTypesArray.map((e) => ({ name: e, value: e }))
},
{
id: 'data',
+ description: 'What you would like to decode.',
type: 'string',
match: 'restContent',
- prompt: {
- start: 'What would you to decode.',
- retry: '{error} Choose a valid string to decode.'
- }
+ prompt: 'What would you to decode.',
+ retry: '{error} Choose a valid string to decode.',
+ slashType: 'STRING'
}
],
slash: true,
- slashOptions: [
- {
- name: 'from',
- description: 'The type of data you are inputting.',
- type: 'STRING',
- choices: encodingTypesArray.map((e) => ({ name: e, value: e })),
- required: true
- },
- {
- name: 'to',
- description: 'The type of data you want the output to be.',
- type: 'STRING',
- choices: encodingTypesArray.map((e) => ({ name: e, value: e })),
- required: true
- },
- {
- name: 'data',
- description: 'What you would like to decode.',
- type: 'STRING',
- required: true
- }
- ],
clientPermissions: (m) => util.clientSendAndPermCheck(m),
userPermissions: []
});
diff --git a/src/commands/utilities/hash.ts b/src/commands/utilities/hash.ts
index 62791c9..7a1bfa7 100644
--- a/src/commands/utilities/hash.ts
+++ b/src/commands/utilities/hash.ts
@@ -7,19 +7,17 @@ export default class HashCommand extends BushCommand {
super('hash', {
aliases: ['hash'],
category: 'utilities',
- description: {
- content: 'Gets the file hash of the given discord link',
- usage: ['hash <fileUrl>'],
- examples: ['hash https://cdn.discordapp.com/emojis/782630946435366942.png?v=1'] //nice
- },
+ 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: {
- start: 'What url would you like to find the hash of?',
- retry: '{error} Enter a valid url.'
- }
+ prompt: 'What url would you like to find the hash of?',
+ retry: '{error} Enter a valid url.',
+ slashType: 'STRING'
}
],
clientPermissions: (m) => util.clientSendAndPermCheck(m),
diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts
index b852a53..d931dd2 100644
--- a/src/commands/utilities/price.ts
+++ b/src/commands/utilities/price.ts
@@ -8,43 +8,30 @@ export default class PriceCommand extends BushCommand {
super('price', {
aliases: ['price'],
category: 'utilities',
- description: {
- content: 'Finds the price information of an item.',
- usage: ['price <item id>'],
- examples: ['price ASPECT_OF_THE_END']
- },
+ description: 'Finds the price information of an item.',
+ usage: ['price <item id>'],
+ examples: ['price ASPECT_OF_THE_END'],
args: [
{
id: 'item',
+ description: 'The item that you would you like to find the price of.',
type: 'string',
match: 'content',
- prompt: {
- start: 'What item would you like to find the price of?',
- retry: '{error} Choose a valid item.'
- }
+ prompt: 'What item would you like to find the price of?',
+ retry: '{error} Choose a valid item.',
+ slashType: 'STRING'
},
{
id: 'strict',
+ description: 'Whether or not to bypass the fuzzy search.',
match: 'flag',
flag: '--strict',
- default: false
+ prompt: 'Would you like to bypass the fuzzy search?',
+ optional: true,
+ slashType: 'BOOLEAN'
}
],
slash: true,
- slashOptions: [
- {
- name: 'item',
- description: 'The item that you would you like to find the price of.',
- type: 'STRING',
- required: true
- },
- {
- name: 'strict',
- description: 'Whether or not to bypass the fuzzy search.',
- type: 'BOOLEAN',
- required: false
- }
- ],
clientPermissions: (m) => util.clientSendAndPermCheck(m, ['EMBED_LINKS'], true),
userPermissions: [],
typing: true
diff --git a/src/commands/utilities/steal.ts b/src/commands/utilities/steal.ts
index 3d230c5..190277a 100644
--- a/src/commands/utilities/steal.ts
+++ b/src/commands/utilities/steal.ts
@@ -1,65 +1,100 @@
-import { BushCommand, type BushMessage } from '#lib';
+import { BushCommand, BushSlashMessage, type BushMessage } from '#lib';
+import { ArgumentOptions, Flag } from 'discord-akairo';
import { type Snowflake } from 'discord.js';
+import _ from 'lodash';
export default class StealCommand extends BushCommand {
public constructor() {
super('steal', {
aliases: ['steal', 'copy-emoji'],
category: 'utilities',
- description: {
- content: 'Steal an emoji from another server and add it to your own.',
- usage: ['steal <emoji/emojiId/url> [name]'],
- examples: ['steal <:omegaclown:782630946435366942> ironm00n']
- },
+ description: 'Steal an emoji from another server and add it to your own.',
+ usage: ['steal <emoji/emojiId/url> [name]'],
+ examples: ['steal <:omegaclown:782630946435366942> ironm00n'],
args: [
{
- id: 'emojiOrName',
+ id: 'emoji',
+ description: 'The emoji to steal.',
customType: util.arg.union('discordEmoji', 'snowflake', 'url'),
- prompt: {
- start: 'What emoji would you like to steal?',
- retry: '{error} Pick a valid emoji, emoji id, or image url.',
- optional: true
- }
+ readableType: 'discordEmoji|snowflake|url',
+ prompt: 'What emoji would you like to steal?',
+ retry: '{error} Pick a valid emoji, emoji id, or image url.',
+ optional: true,
+ only: 'slash',
+ slashType: 'STRING'
},
{
- id: 'name2'
+ id: 'name',
+ description: 'The name to give the new emoji.',
+ prompt: 'What would you like to name the emoji?',
+ retry: '{error} Choose a valid name fore the emoji.',
+ optional: true,
+ only: 'slash',
+ slashType: 'STRING'
}
],
- slash: false,
+ slash: true,
channel: 'guild',
clientPermissions: (m) => util.clientSendAndPermCheck(m, ['MANAGE_EMOJIS_AND_STICKERS']),
userPermissions: ['MANAGE_EMOJIS_AND_STICKERS']
});
}
+
+ public override *args(message: BushMessage): Generator<ArgumentOptions | Flag> {
+ const hasImage = message.attachments.size && message.attachments.first()?.contentType?.includes('image/');
+
+ const emoji = hasImage
+ ? message.attachments.first()!.url
+ : yield {
+ id: 'emoji',
+ type: util.arg.union('discordEmoji', 'snowflake', 'url'),
+ prompt: {
+ start: 'What emoji would you like to steal?',
+ retry: '{error} Pick a valid emoji, emoji id, or image url.'
+ }
+ };
+
+ const name = yield {
+ id: 'name',
+ prompt: {
+ start: 'What would you like to name the emoji?',
+ retry: '{error} Choose a valid name fore the emoji.',
+ optional: true
+ },
+ default:
+ hasImage && message.attachments.first()?.name
+ ? _.camelCase(message.attachments.first()!.name ?? 'stolen_emoji')
+ : 'stolen_emoji'
+ };
+
+ return { emoji, name };
+ }
+
public override async exec(
- message: BushMessage,
- args?: { emojiOrName?: { name: string; id: Snowflake } | Snowflake | URL | string; name2: string }
+ message: BushMessage | BushSlashMessage,
+ args?: { emoji?: { name: string; id: Snowflake } | Snowflake | URL | string; name: string }
) {
- if ((!args || !args.emojiOrName) && !message.attachments.size)
- return await message.util.reply(`${util.emojis.error} You must provide an emoji to steal.`);
+ if (!args || !args.emoji) return await message.util.reply(`${util.emojis.error} You must provide an emoji to steal.`);
const image =
- message.attachments.size && message.attachments.first()?.contentType?.includes('image/')
- ? message.attachments.first()!.url
- : args?.emojiOrName instanceof URL
- ? args.emojiOrName.href
- : typeof args?.emojiOrName === 'object'
- ? `https://cdn.discordapp.com/emojis/${args.emojiOrName.id}`
- : client.consts.regex.snowflake.test(args?.emojiOrName ?? '')
- ? `https://cdn.discordapp.com/emojis/${args!.emojiOrName}`
+ args?.emoji instanceof URL
+ ? args.emoji.href
+ : typeof args?.emoji === 'object'
+ ? `https://cdn.discordapp.com/emojis/${args.emoji.id}`
+ : client.consts.regex.snowflake.test(args?.emoji ?? '')
+ ? `https://cdn.discordapp.com/emojis/${args!.emoji}`
+ : (args?.emoji ?? '').match(/https?:\/\//)
+ ? args?.emoji
: undefined;
if (image === undefined) return await message.util.reply(`${util.emojis.error} You must provide an emoji to steal.`);
- if (message.attachments.size && typeof args?.emojiOrName !== 'string')
- return await message.util.reply(`${util.emojis.error} You cannot attach an image and provide an argument.`);
- const emojiName = message.attachments.size
- ? (args?.emojiOrName as string) ?? 'stolen_emoji'
- : args?.emojiOrName instanceof URL
- ? args?.name2 ?? 'stolen_emoji'
- : typeof args?.emojiOrName === 'object'
- ? args?.name2 ?? args.emojiOrName.name ?? 'stolen_emoji'
- : 'stolen_emoji';
+ const emojiName =
+ args.name ?? args?.emoji instanceof URL
+ ? args?.name ?? 'stolen_emoji'
+ : typeof args?.emoji === 'object'
+ ? args?.name ?? args.emoji.name ?? 'stolen_emoji'
+ : 'stolen_emoji';
const creationSuccess = await message
.guild!.emojis.create(image, emojiName, {
diff --git a/src/commands/utilities/suicide.ts b/src/commands/utilities/suicide.ts
index 359f914..05f8d47 100644
--- a/src/commands/utilities/suicide.ts
+++ b/src/commands/utilities/suicide.ts
@@ -6,11 +6,9 @@ export default class TemplateCommand extends BushCommand {
super('suicide', {
aliases: ['suicide'],
category: 'utilities',
- description: {
- content: 'Mental Health Resources. Credit to https://github.com/dexbiobot/Zeppelin.',
- usage: ['suicide'],
- examples: ['suicide']
- },
+ description: 'Mental Health Resources. Credit to https://github.com/dexbiobot/Zeppelin.',
+ usage: ['suicide'],
+ examples: ['suicide'],
slash: true,
clientPermissions: (m) => util.clientSendAndPermCheck(m),
userPermissions: [],
diff --git a/src/commands/utilities/uuid.ts b/src/commands/utilities/uuid.ts
index 556a4de..e0f6b1c 100644
--- a/src/commands/utilities/uuid.ts
+++ b/src/commands/utilities/uuid.ts
@@ -5,41 +5,40 @@ export default class UuidCommand extends BushCommand {
super('uuid', {
aliases: ['uuid'],
category: 'utilities',
- description: {
- content: "Find someone's minecraft uuid",
- usage: ['uuid <ign>'],
- examples: ['uuid ironm00n']
- },
+ description: "Find someone's minecraft uuid",
+ usage: ['uuid <ign>'],
+ examples: ['uuid ironm00n'],
args: [
{
id: 'ign',
+ description: 'The ign to find the ign of.',
customType: /\w{1,16}/im,
- prompt: {
- start: 'What ign would you like to find the uuid of?',
- retry: '{error} Choose a valid ign.',
- optional: false
- }
- }
- ],
- slash: true,
- slashOptions: [
+ readableType: 'ign',
+ prompt: 'What ign would you like to find the uuid of?',
+ retry: '{error} Choose a valid ign.',
+ slashType: 'STRING'
+ },
{
- name: 'ign',
- description: 'What ign would you like to find the uuid of?',
- type: 'STRING',
- required: false
+ id: 'dashed',
+ description: 'Include dashes in the uuid.',
+ match: 'flag',
+ flag: '--dashed',
+ prompt: 'Would you like to include dashes in the uuid?',
+ slashType: 'BOOLEAN',
+ optional: true
}
],
+ slash: true,
clientPermissions: (m) => util.clientSendAndPermCheck(m),
userPermissions: []
});
}
- public override async exec(message: BushMessage, { ign }: { ign: { match: any[]; matches: any[] } }) {
+ public override async exec(message: BushMessage, { ign, dashed }: { ign: { match: any[]; matches: any[] }; dashed: boolean }) {
if (!ign) return await message.util.reply(`${util.emojis.error} Please enter a valid ign.`);
const readableIGN = ign.match[0];
try {
- const uuid = await util.findUUID(readableIGN);
+ const uuid = await util.mcUUID(readableIGN, dashed);
return await message.util.reply(`The uuid for \`${readableIGN}\` is \`${uuid}\``);
} catch (e) {
return await message.util.reply(`${util.emojis.error} Could not find an uuid for \`${readableIGN}\`.`);
diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts
index 4719da1..c934e2e 100644
--- a/src/commands/utilities/viewRaw.ts
+++ b/src/commands/utilities/viewRaw.ts
@@ -1,73 +1,54 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-import { MessageEmbed, type DMChannel, type NewsChannel, type Snowflake, type TextChannel } from 'discord.js';
+import { Message, MessageEmbed, type DMChannel, type NewsChannel, type Snowflake, type TextChannel } from 'discord.js';
export default class ViewRawCommand extends BushCommand {
public constructor() {
super('view-raw', {
aliases: ['view-raw', 'vr'],
category: 'utilities',
- description: {
- content: 'Shows raw information about a message.',
- usage: ['viewraw <message id> <channel>'],
- examples: ['viewraw 322862723090219008']
- },
+ description: 'Shows raw information about a message.',
+ usage: ['viewraw <message id> <channel>'],
+ examples: ['viewraw 322862723090219008'],
args: [
{
id: 'message',
- type: 'snowflake',
- prompt: {
- start: 'What message would you like to view?',
- retry: '{error} Choose a valid message.',
- optional: false
- }
+ description: 'The message to view the raw content of.',
+ customType: util.arg.union('guildMessage', 'messageLink'),
+ readableType: 'guildMessage|messageLink',
+ prompt: 'What message would you like to view?',
+ retry: '{error} Choose a valid message.',
+ slashType: 'STRING'
},
{
id: 'channel',
+ description: 'The channel that the message is in.',
type: 'channel',
- prompt: {
- start: 'What channel is the message in?',
- retry: '{error} Choose a valid channel.',
- optional: true
- }
+ prompt: 'What channel is the message in?',
+ retry: '{error} Choose a valid channel.',
+ optional: true,
+ slashType: 'CHANNEL',
+ channelTypes: util.discordConstants.TextBasedChannelTypes
},
{
id: 'json',
+ description: 'Whether or not to view the raw JSON message data.',
match: 'flag',
- flag: '--json'
+ flag: '--json',
+ prompt: 'Would you like to view the raw JSON message data?',
+ slashType: 'BOOLEAN',
+ optional: true
},
{
id: 'js',
+ description: 'Whether or not to view the raw message data.',
match: 'flag',
- flag: '--js'
+ flag: '--js',
+ prompt: 'Would you like to view the raw message data?',
+ slashType: 'BOOLEAN',
+ optional: true
}
],
slash: true,
- slashOptions: [
- {
- name: 'message',
- description: 'What message would you like to view?',
- type: 'STRING',
- required: true
- },
- {
- name: 'channel',
- description: 'What channel is the message in?',
- type: 'CHANNEL',
- required: false
- },
- {
- name: 'json',
- description: 'Would you like to view the raw JSON message data?',
- type: 'BOOLEAN',
- required: false
- },
- {
- name: 'js',
- description: 'Would you like to view the raw message data?',
- type: 'BOOLEAN',
- required: false
- }
- ],
channel: 'guild',
clientPermissions: (m) => util.clientSendAndPermCheck(m, ['EMBED_LINKS'], true),
userPermissions: []
@@ -76,10 +57,13 @@ export default class ViewRawCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- args: { message: Snowflake; channel: TextChannel | NewsChannel | DMChannel; json?: boolean; js: boolean }
+ args: { message: BushMessage | Snowflake; channel: TextChannel | NewsChannel | DMChannel; json?: boolean; js: boolean }
) {
if (!args.channel) args.channel = (message.channel as TextChannel | NewsChannel | DMChannel)!;
- const newMessage = await args.channel.messages.fetch(`${args.message}` as Snowflake).catch(() => null);
+ const newMessage =
+ args.message instanceof Message
+ ? args.message
+ : await args.channel.messages.fetch(`${args.message}` as Snowflake).catch(() => null);
if (!newMessage)
return await message.util.reply(
`${util.emojis.error} There was an error fetching that message, make sure that is a valid id and if the message is not in this channel, please provide a channel.`
diff --git a/src/commands/utilities/whoHasRole.ts b/src/commands/utilities/whoHasRole.ts
index a457756..45cf77f 100644
--- a/src/commands/utilities/whoHasRole.ts
+++ b/src/commands/utilities/whoHasRole.ts
@@ -6,31 +6,21 @@ export default class WhoHasRoleCommand extends BushCommand {
super('whoHasRole', {
aliases: ['who-has-role', 'whr', 'dump'],
category: 'utilities',
- description: {
- content: 'Allows you to view what users have a certain role.',
- usage: ['who-has-role <role>'],
- examples: ['who-has-role admin']
- },
+ description: 'Allows you to view what users have a certain role.',
+ usage: ['who-has-role <role>'],
+ examples: ['who-has-role admin'],
args: [
{
id: 'role',
+ description: 'The role to find the users of.',
type: 'role',
- prompt: {
- start: 'What role would you like to find the users of?',
- retry: '{error} Pick a valid role.',
- optional: false
- }
+ prompt: 'What role would you like to find the users of?',
+ retry: '{error} Pick a valid role.',
+ optional: false,
+ slashType: 'ROLE'
}
],
slash: true,
- slashOptions: [
- {
- name: 'role',
- description: 'What role would you like to find the users of?',
- type: 'ROLE',
- required: true
- }
- ],
channel: 'guild',
clientPermissions: (m) => util.clientSendAndPermCheck(m),
userPermissions: [],
diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts
index de00620..34b2b90 100644
--- a/src/commands/utilities/wolframAlpha.ts
+++ b/src/commands/utilities/wolframAlpha.ts
@@ -7,43 +7,30 @@ export default class WolframAlphaCommand extends BushCommand {
super('wolframAlpha', {
aliases: ['wolfram-alpha', 'wolfram', 'alpha', 'wolf', 'wa'],
category: 'utilities',
- description: {
- content: 'Queries Wolfram|Alpha for a result.',
- usage: ['wolfram-alpha <expression>'],
- examples: ['wolfram-alpha what is the population of france']
- },
+ description: 'Queries Wolfram|Alpha for a result.',
+ usage: ['wolfram-alpha <expression>'],
+ examples: ['wolfram-alpha what is the population of france'],
args: [
{
id: 'image',
+ description: 'Whether to use the Simple API instead of the Short Answers API.',
match: 'flag',
- flag: '--image'
+ flag: '--image',
+ prompt: 'Would you like to use the Simple API instead of the Short Answers API?',
+ slashType: 'BOOLEAN',
+ optional: true
},
{
id: 'expression',
+ description: 'The expression to query the Wolfram|Alpha api for.',
type: 'string',
match: 'rest',
- prompt: {
- start: 'What would you like to look up?',
- retry: '{error} Pick something to look up.',
- optional: false
- }
+ prompt: 'What would you like to look up?',
+ retry: '{error} Pick something to look up.',
+ slashType: 'STRING'
}
],
slash: true,
- slashOptions: [
- {
- name: 'expression',
- description: 'What would you like to look up?',
- type: 'STRING',
- required: true
- },
- {
- name: 'image',
- description: 'Would you like to use the Simple API instead of the Short Answers API?',
- type: 'BOOLEAN',
- required: false
- }
- ],
clientPermissions: (m) => util.clientSendAndPermCheck(m),
userPermissions: []
});