diff options
Diffstat (limited to 'src/commands/utilities/viewRaw.ts')
-rw-r--r-- | src/commands/utilities/viewRaw.ts | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts index 5c2c146..8114cef 100644 --- a/src/commands/utilities/viewRaw.ts +++ b/src/commands/utilities/viewRaw.ts @@ -1,4 +1,16 @@ -import { BushCommand, type ArgType, type CommandMessage, type OptArgType, type SlashMessage } from '#lib'; +import { + Arg, + BushCommand, + clientSendAndPermCheck, + codeblock, + colors, + emojis, + inspect, + type ArgType, + type CommandMessage, + type OptArgType, + type SlashMessage +} from '#lib'; import assert from 'assert'; import { ApplicationCommandOptionType, ChannelType, EmbedBuilder, Message, PermissionFlagsBits } from 'discord.js'; @@ -14,7 +26,7 @@ export default class ViewRawCommand extends BushCommand { { id: 'message', description: 'The message to view the raw content of.', - type: util.arg.union('message', 'messageLink'), + type: Arg.union('message', 'messageLink'), readableType: 'message|messageLink', prompt: 'What message would you like to view?', retry: '{error} Choose a valid message.', @@ -23,7 +35,7 @@ export default class ViewRawCommand extends BushCommand { { id: 'channel', description: 'The channel that the message is in.', - type: util.arg.union('textChannel', 'newsChannel', 'threadChannel', 'voiceChannel'), + type: Arg.union('textChannel', 'newsChannel', 'threadChannel', 'voiceChannel'), prompt: 'What channel is the message in?', retry: '{error} Choose a valid channel.', optional: true, @@ -59,7 +71,7 @@ export default class ViewRawCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [] }); } @@ -81,7 +93,7 @@ export default class ViewRawCommand extends BushCommand { args.message instanceof Message ? args.message : await args.channel!.messages.fetch(`${args.message}`).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.` + `${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.` ); const Embed = await ViewRawCommand.getRawData(newMessage, { json: args.json, js: args.js }); @@ -94,14 +106,14 @@ export default class ViewRawCommand extends BushCommand { options.json || options.js ? options.json ? JSON.stringify(message.toJSON(), undefined, 2) - : util.inspect(message.toJSON()) || '[No Content]' + : inspect(message.toJSON()) || '[No Content]' : message.content || '[No Content]'; const lang = options.json ? 'json' : options.js ? 'js' : undefined; return new EmbedBuilder() .setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined }) .setTimestamp(message.createdTimestamp) - .setColor(message.member?.roles?.color?.color ?? util.colors.default) + .setColor(message.member?.roles?.color?.color ?? colors.default) .setTitle('Raw Message Information') - .setDescription(await util.codeblock(content, 2048, lang)); + .setDescription(await codeblock(content, 2048, lang)); } } |