|
1 | 1 | import { |
2 | | - ActionRowBuilder, |
3 | | - ButtonStyle, |
4 | | - ChatInputCommandInteraction, |
5 | | - MessageFlags, |
6 | | - ModalBuilder, |
7 | | - PermissionFlagsBits, |
8 | | - TextInputBuilder, |
9 | | - TextInputStyle |
| 2 | + ActionRowBuilder, |
| 3 | + ButtonStyle, |
| 4 | + ChatInputCommandInteraction, |
| 5 | + MessageFlags, |
| 6 | + ModalBuilder, |
| 7 | + PermissionFlagsBits, |
| 8 | + TextInputBuilder, |
| 9 | + TextInputStyle |
10 | 10 | } from "discord.js"; |
11 | | -import { ExtendedClient } from "../../../../types/client.js"; |
12 | | -import { PermissionType } from "../../../../enums/permissionType.js"; |
| 11 | +import {ExtendedClient} from "../../../../types/client.js"; |
| 12 | +import {PermissionType} from "../../../../enums/permissionType.js"; |
13 | 13 |
|
14 | 14 | export default { |
15 | | - subCommand: "leave.message", |
16 | | - options: { |
17 | | - once: false, |
18 | | - permission: PermissionType.LeaveWelcome, |
19 | | - cooldown: 3000, |
20 | | - botPermissions: [PermissionFlagsBits.SendMessages], |
21 | | - userPermissions: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.ManageGuild], |
22 | | - userHasOnePermission: true, |
23 | | - isGuildOwner: false, |
24 | | - }, |
25 | | - /** |
26 | | - * |
27 | | - * @param {ChatInputCommandInteraction} interaction |
28 | | - * @param {ExtendedClient} client |
29 | | - */ |
30 | | - async execute( |
31 | | - interaction: ChatInputCommandInteraction, |
32 | | - client: ExtendedClient |
33 | | - ) { |
34 | | - |
35 | | - if (!client.user) throw new Error("Client user not found"); |
36 | | - if (!interaction.guild) throw new Error("Guild not found"); |
37 | | - if (!interaction.member) throw new Error("Member not found"); |
38 | | - |
39 | | - const modal = new ModalBuilder(); |
40 | | - |
41 | | - const message = new TextInputBuilder(); |
42 | | - const channel = new TextInputBuilder(); |
43 | | - |
44 | | - modal.setTitle("Create a Message").setCustomId("leave-message-create"); |
45 | | - |
46 | | - message |
47 | | - .setLabel("Message Template") |
48 | | - .setCustomId("leave-message-create-name") |
49 | | - .setStyle(TextInputStyle.Paragraph) |
50 | | - .setRequired(true); |
51 | | - channel |
52 | | - .setLabel("Channel ID") |
53 | | - .setCustomId("leave-message-create-channel") |
54 | | - .setStyle(TextInputStyle.Short) |
55 | | - .setPlaceholder("NOT CHANGE") |
56 | | - .setValue(`${interaction.options.getChannel("channel")?.id}`) |
57 | | - .setRequired(false); |
58 | | - |
59 | | - modal.addComponents( |
60 | | - new ActionRowBuilder<TextInputBuilder>().addComponents(message), |
61 | | - new ActionRowBuilder<TextInputBuilder>().addComponents(channel) |
62 | | - ); |
63 | | - |
64 | | - interaction.showModal(modal); |
65 | | - } |
| 15 | + subCommand: "leave.message", |
| 16 | + options: { |
| 17 | + once: false, |
| 18 | + permission: PermissionType.LeaveWelcome, |
| 19 | + cooldown: 3000, |
| 20 | + botPermissions: [PermissionFlagsBits.SendMessages], |
| 21 | + userPermissions: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.ManageGuild], |
| 22 | + userHasOnePermission: true, |
| 23 | + isGuildOwner: false, |
| 24 | + }, |
| 25 | + /** |
| 26 | + * |
| 27 | + * @param {ChatInputCommandInteraction} interaction |
| 28 | + * @param {ExtendedClient} client |
| 29 | + */ |
| 30 | + async execute( |
| 31 | + interaction: ChatInputCommandInteraction, |
| 32 | + client: ExtendedClient |
| 33 | + ) { |
| 34 | + |
| 35 | + if (!client.user) throw new Error("Client user not found"); |
| 36 | + if (!interaction.guild) throw new Error("Guild not found"); |
| 37 | + if (!interaction.member) throw new Error("Member not found"); |
| 38 | + |
| 39 | + const modal = new ModalBuilder(); |
| 40 | + |
| 41 | + const message = new TextInputBuilder(); |
| 42 | + |
| 43 | + modal.setTitle("Create a Message").setCustomId("leave-message-create"); |
| 44 | + |
| 45 | + message |
| 46 | + .setLabel("Message Template") |
| 47 | + .setCustomId("leave-message-create-name") |
| 48 | + .setStyle(TextInputStyle.Short) |
| 49 | + .setRequired(true); |
| 50 | + |
| 51 | + |
| 52 | + modal.addComponents( |
| 53 | + new ActionRowBuilder<TextInputBuilder>().addComponents(message), |
| 54 | + ); |
| 55 | + |
| 56 | + await interaction.showModal(modal); |
| 57 | + } |
66 | 58 | }; |
0 commit comments