diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-09-05 17:36:42 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-09-05 17:36:42 -0400 |
commit | 048f99752550c6e03d1990a03cad78f3ac7d73aa (patch) | |
tree | c238ac29b1b526e86bcbc4989036df981c860187 /src/commands/utilities/viewRaw.ts | |
parent | 6f8a4d13a490eda7a195d14833c83810f7b5a789 (diff) | |
download | tanzanite-048f99752550c6e03d1990a03cad78f3ac7d73aa.tar.gz tanzanite-048f99752550c6e03d1990a03cad78f3ac7d73aa.tar.bz2 tanzanite-048f99752550c6e03d1990a03cad78f3ac7d73aa.zip |
revamp command permissions, fix permission exploit for some command when used in forum channels, use enums more
Diffstat (limited to 'src/commands/utilities/viewRaw.ts')
-rw-r--r-- | src/commands/utilities/viewRaw.ts | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts index 63125c3..1220f0f 100644 --- a/src/commands/utilities/viewRaw.ts +++ b/src/commands/utilities/viewRaw.ts @@ -1,7 +1,6 @@ import { Arg, BotCommand, - clientSendAndPermCheck, colors, emojis, inspect, @@ -11,7 +10,7 @@ import { type SlashMessage } from '#lib'; import assert from 'assert/strict'; -import { ApplicationCommandOptionType, Constants, EmbedBuilder, Message, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, Constants, EmbedBuilder, Message } from 'discord.js'; export default class ViewRawCommand extends BotCommand { public constructor() { @@ -62,7 +61,8 @@ export default class ViewRawCommand extends BotCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + clientPermissions: ['EmbedLinks'], + clientCheckChannel: true, userPermissions: [] }); } @@ -87,24 +87,24 @@ export default class ViewRawCommand extends BotCommand { `${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 }); + const Embed = await getRawData(newMessage, { json: args.json, js: args.js }); return await message.util.reply({ embeds: [Embed] }); } +} - public static async getRawData(message: Message, options: { json?: boolean; js: boolean }): Promise<EmbedBuilder> { - const content = - options.json || options.js - ? options.json - ? JSON.stringify(message.toJSON(), undefined, 2) - : 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 ?? colors.default) - .setTitle('Raw Message Information') - .setDescription(await message.client.utils.codeblock(content, 2048, lang)); - } +export async function getRawData(message: Message, options: { json?: boolean; js: boolean }): Promise<EmbedBuilder> { + const content = + options.json || options.js + ? options.json + ? JSON.stringify(message.toJSON(), undefined, 2) + : 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 ?? colors.default) + .setTitle('Raw Message Information') + .setDescription(await message.client.utils.codeblock(content, 2048, lang)); } |