aboutsummaryrefslogtreecommitdiff
path: root/src/context-menu-commands/message/viewRaw.ts
blob: 6cfe5525e31f6f6ee02a46a954bec2ad2c21f33d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { ViewRawCommand } from '#commands';
import { ContextMenuCommand } from 'discord-akairo';
import { ApplicationCommandType, type ContextMenuCommandInteraction, type Message } from 'discord.js';

export default class ViewRawContextMenuCommand extends ContextMenuCommand {
	public constructor() {
		super('viewRaw', {
			name: 'View Raw',
			type: ApplicationCommandType.Message,
			category: 'message'
		});
	}

	public override async exec(interaction: ContextMenuCommandInteraction) {
		await interaction.deferReply({ ephemeral: true });
		const embed = await ViewRawCommand.getRawData(interaction.options.getMessage('message') as Message, {
			json: false,
			js: false
		});
		return await interaction.editReply({ embeds: [embed] });
	}
}