-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathecho.ts
36 lines (33 loc) · 999 Bytes
/
echo.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import {
ActionRowBuilder,
ApplicationCommandType,
ButtonBuilder,
ButtonStyle,
type MessageContextMenuCommandInteraction,
} from "discord.js";
import { formatMessageToEmbed } from "../../misc/util.js";
import type { Command } from "../../structures/command.js";
export default {
data: {
name: "echo",
type: ApplicationCommandType.Message,
},
opt: {
userPermissions: ["SendMessages"],
botPermissions: ["SendMessages"],
category: "Context",
cooldown: 5,
},
async execute(interaction: MessageContextMenuCommandInteraction<"cached">) {
const message = await interaction.targetMessage.fetch();
await interaction.deferReply();
await interaction.editReply({
embeds: [formatMessageToEmbed(message)],
components: [
new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder().setLabel("Original Message").setStyle(ButtonStyle.Link).setURL(message.url),
),
],
});
},
} satisfies Command;