blob: 3467aeef0b8f4c77ee99c4b0ccac2cb9dd5b2b25 [file] [log] [blame]
PineaFan0d06edc2023-01-17 22:10:31 +00001import { LoadingEmbed } from "../../utils/defaults.js";
Skyler Grey75ea9172022-08-06 10:22:23 +01002import Discord, {
3 CommandInteraction,
pineafan3a02ea32022-08-11 21:35:04 +01004 Interaction,
Skyler Grey75ea9172022-08-06 10:22:23 +01005 Message,
TheCodedProf21c08592022-09-13 14:14:43 -04006 ActionRowBuilder,
TheCodedProf21c08592022-09-13 14:14:43 -04007 ButtonBuilder,
Skyler Grey75ea9172022-08-06 10:22:23 +01008 MessageComponentInteraction,
pineafan3a02ea32022-08-11 21:35:04 +01009 ModalSubmitInteraction,
Skyler Grey75ea9172022-08-06 10:22:23 +010010 Role,
TheCodedProf59772f82023-01-18 22:17:16 -050011 ButtonStyle,
12 StringSelectMenuBuilder,
TheCodedProf59772f82023-01-18 22:17:16 -050013 TextInputBuilder,
14 EmbedBuilder,
TheCodedProf59772f82023-01-18 22:17:16 -050015 ButtonComponent
Skyler Grey75ea9172022-08-06 10:22:23 +010016} from "discord.js";
pineafanda6e5342022-07-03 10:03:16 +010017import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
18import confirmationMessage from "../../utils/confirmationMessage.js";
19import getEmojiByName from "../../utils/getEmojiByName.js";
TheCodedProff86ba092023-01-27 17:10:07 -050020import type { SlashCommandSubcommandBuilder } from "discord.js";
pineafanda6e5342022-07-03 10:03:16 +010021import client from "../../utils/client.js";
pineafan63fc5e22022-08-04 22:04:10 +010022import { modalInteractionCollector } from "../../utils/dualCollector.js";
pineafan4f164f32022-02-26 22:07:12 +000023
24const command = (builder: SlashCommandSubcommandBuilder) =>
25 builder
pineafan63fc5e22022-08-04 22:04:10 +010026 .setName("verify")
27 .setDescription("Manage the role given after typing /verify")
Skyler Grey75ea9172022-08-06 10:22:23 +010028 .addRoleOption((option) =>
Skyler Grey11236ba2022-08-08 21:13:33 +010029 option.setName("role").setDescription("The role to give after verifying").setRequired(false)
Skyler Grey75ea9172022-08-06 10:22:23 +010030 );
pineafan4f164f32022-02-26 22:07:12 +000031
pineafan3a02ea32022-08-11 21:35:04 +010032const callback = async (interaction: CommandInteraction): Promise<unknown> => {
PineaFana00db1b2023-01-02 15:32:54 +000033 if (!interaction.guild) return;
Skyler Grey75ea9172022-08-06 10:22:23 +010034 const m = (await interaction.reply({
35 embeds: LoadingEmbed,
36 ephemeral: true,
37 fetchReply: true
38 })) as Message;
TheCodedProf59772f82023-01-18 22:17:16 -050039 if (interaction.options.get("role")?.role) {
Skyler Grey1a67e182022-08-04 23:05:44 +010040 let role: Role;
pineafan6702cef2022-06-13 17:52:37 +010041 try {
TheCodedProf59772f82023-01-18 22:17:16 -050042 role = interaction.options.get("role")?.role as Role;
pineafan6702cef2022-06-13 17:52:37 +010043 } catch {
Skyler Grey75ea9172022-08-06 10:22:23 +010044 return await interaction.editReply({
45 embeds: [
46 new EmojiEmbed()
47 .setEmoji("GUILD.ROLES.DELETE")
48 .setTitle("Verify Role")
Skyler Grey11236ba2022-08-08 21:13:33 +010049 .setDescription("The role you provided is not a valid role")
Skyler Grey75ea9172022-08-06 10:22:23 +010050 .setStatus("Danger")
51 ]
52 });
pineafan6702cef2022-06-13 17:52:37 +010053 }
pineafan63fc5e22022-08-04 22:04:10 +010054 role = role as Discord.Role;
PineaFana00db1b2023-01-02 15:32:54 +000055 if (role.guild.id !== interaction.guild.id) {
Skyler Grey75ea9172022-08-06 10:22:23 +010056 return interaction.editReply({
57 embeds: [
58 new EmojiEmbed()
59 .setTitle("Verify Role")
60 .setDescription("You must choose a role in this server")
61 .setStatus("Danger")
62 .setEmoji("GUILD.ROLES.DELETE")
63 ]
64 });
pineafan6702cef2022-06-13 17:52:37 +010065 }
pineafan63fc5e22022-08-04 22:04:10 +010066 const confirmation = await new confirmationMessage(interaction)
TheCodedProf59772f82023-01-18 22:17:16 -050067 .setEmoji("GUILD.ROLES.EDIT")
pineafan6702cef2022-06-13 17:52:37 +010068 .setTitle("Verify Role")
Skyler Grey11236ba2022-08-08 21:13:33 +010069 .setDescription(`Are you sure you want to set the verify role to <@&${role.id}>?`)
pineafan6702cef2022-06-13 17:52:37 +010070 .setColor("Warning")
TheCodedProf59772f82023-01-18 22:17:16 -050071 .setFailedMessage("No changes were made", "Warning", "GUILD.ROLES.DELETE")
pineafan6702cef2022-06-13 17:52:37 +010072 .setInverted(true)
pineafan63fc5e22022-08-04 22:04:10 +010073 .send(true);
74 if (confirmation.cancelled) return;
pineafan6702cef2022-06-13 17:52:37 +010075 if (confirmation.success) {
76 try {
PineaFana00db1b2023-01-02 15:32:54 +000077 await client.database.guilds.write(interaction.guild.id, {
Skyler Grey75ea9172022-08-06 10:22:23 +010078 "verify.role": role.id,
79 "verify.enabled": true
80 });
Skyler Grey11236ba2022-08-08 21:13:33 +010081 const { log, NucleusColors, entry, renderUser, renderRole } = client.logger;
pineafan63fc5e22022-08-04 22:04:10 +010082 const data = {
Skyler Grey75ea9172022-08-06 10:22:23 +010083 meta: {
pineafan63fc5e22022-08-04 22:04:10 +010084 type: "verifyRoleChanged",
85 displayName: "Verify Role Changed",
86 calculateType: "nucleusSettingsUpdated",
87 color: NucleusColors.green,
88 emoji: "CONTROL.BLOCKTICK",
89 timestamp: new Date().getTime()
90 },
91 list: {
Skyler Grey11236ba2022-08-08 21:13:33 +010092 memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
93 changedBy: entry(interaction.user.id, renderUser(interaction.user)),
pineafan63fc5e22022-08-04 22:04:10 +010094 role: entry(role.id, renderRole(role))
95 },
96 hidden: {
PineaFana00db1b2023-01-02 15:32:54 +000097 guild: interaction.guild.id
pineafanda6e5342022-07-03 10:03:16 +010098 }
pineafan63fc5e22022-08-04 22:04:10 +010099 };
100 log(data);
pineafan6702cef2022-06-13 17:52:37 +0100101 } catch (e) {
pineafan63fc5e22022-08-04 22:04:10 +0100102 console.log(e);
Skyler Grey75ea9172022-08-06 10:22:23 +0100103 return interaction.editReply({
104 embeds: [
105 new EmojiEmbed()
106 .setTitle("Verify Role")
Skyler Grey11236ba2022-08-08 21:13:33 +0100107 .setDescription("Something went wrong while setting the verify role")
Skyler Grey75ea9172022-08-06 10:22:23 +0100108 .setStatus("Danger")
109 .setEmoji("GUILD.ROLES.DELETE")
110 ],
111 components: []
112 });
pineafan6702cef2022-06-13 17:52:37 +0100113 }
114 } else {
Skyler Grey75ea9172022-08-06 10:22:23 +0100115 return interaction.editReply({
116 embeds: [
117 new EmojiEmbed()
118 .setTitle("Verify Role")
119 .setDescription("No changes were made")
120 .setStatus("Success")
121 .setEmoji("GUILD.ROLES.CREATE")
122 ],
123 components: []
124 });
pineafan6702cef2022-06-13 17:52:37 +0100125 }
126 }
127 let clicks = 0;
PineaFana00db1b2023-01-02 15:32:54 +0000128 const data = await client.database.guilds.read(interaction.guild.id);
pineafan6702cef2022-06-13 17:52:37 +0100129 let role = data.verify.role;
Skyler Greyad002172022-08-16 18:48:26 +0100130
131 let timedOut = false;
132 while (!timedOut) {
Skyler Grey75ea9172022-08-06 10:22:23 +0100133 await interaction.editReply({
134 embeds: [
135 new EmojiEmbed()
136 .setTitle("Verify Role")
137 .setDescription(
Skyler Grey11236ba2022-08-08 21:13:33 +0100138 role ? `Your verify role is currently set to <@&${role}>` : "You have not set a verify role"
Skyler Grey75ea9172022-08-06 10:22:23 +0100139 )
140 .setStatus("Success")
141 .setEmoji("GUILD.ROLES.CREATE")
142 ],
143 components: [
TheCodedProf59772f82023-01-18 22:17:16 -0500144 new ActionRowBuilder<ButtonBuilder>().addComponents([
TheCodedProf21c08592022-09-13 14:14:43 -0400145 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100146 .setCustomId("clear")
Skyler Grey11236ba2022-08-08 21:13:33 +0100147 .setLabel(clicks ? "Click again to confirm" : "Reset role")
148 .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400149 .setStyle(ButtonStyle.Danger)
Skyler Grey75ea9172022-08-06 10:22:23 +0100150 .setDisabled(!role),
TheCodedProf21c08592022-09-13 14:14:43 -0400151 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100152 .setCustomId("send")
153 .setLabel("Add verify button")
154 .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400155 .setStyle(ButtonStyle.Primary)
Skyler Grey75ea9172022-08-06 10:22:23 +0100156 ])
157 ]
158 });
Skyler Grey1a67e182022-08-04 23:05:44 +0100159 let i: MessageComponentInteraction;
pineafan6702cef2022-06-13 17:52:37 +0100160 try {
PineaFan0d06edc2023-01-17 22:10:31 +0000161 i = await m.awaitMessageComponent({
162 time: 300000,
TheCodedProf267563a2023-01-21 17:00:57 -0500163 filter: (i) => { return i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id && i.message.id === m.id }
PineaFan0d06edc2023-01-17 22:10:31 +0000164 });
Skyler Grey75ea9172022-08-06 10:22:23 +0100165 } catch (e) {
Skyler Greyad002172022-08-16 18:48:26 +0100166 timedOut = true;
167 continue;
Skyler Grey75ea9172022-08-06 10:22:23 +0100168 }
TheCodedProf267563a2023-01-21 17:00:57 -0500169 await i.deferUpdate();
TheCodedProf59772f82023-01-18 22:17:16 -0500170 if ((i.component as ButtonComponent).customId === "clear") {
TheCodedProf4a6d5712023-01-19 15:54:40 -0500171 clicks ++;
pineafane23c4ec2022-07-27 21:56:27 +0100172 if (clicks === 2) {
pineafan6702cef2022-06-13 17:52:37 +0100173 clicks = 0;
PineaFana00db1b2023-01-02 15:32:54 +0000174 await client.database.guilds.write(interaction.guild.id, null, ["verify.role", "verify.enabled"]);
TheCodedProf59772f82023-01-18 22:17:16 -0500175 role = null;
pineafan6702cef2022-06-13 17:52:37 +0100176 }
TheCodedProf59772f82023-01-18 22:17:16 -0500177 } else if ((i.component as ButtonComponent).customId === "send") {
pineafan41d93562022-07-30 22:10:15 +0100178 const verifyMessages = [
Skyler Grey75ea9172022-08-06 10:22:23 +0100179 {
180 label: "Verify",
181 description: "Click the button below to get verified"
182 },
183 {
184 label: "Get verified",
Skyler Grey11236ba2022-08-08 21:13:33 +0100185 description: "To get access to the rest of the server, click the button below"
Skyler Grey75ea9172022-08-06 10:22:23 +0100186 },
187 {
188 label: "Ready to verify?",
189 description: "Click the button below to verify yourself"
190 }
pineafan63fc5e22022-08-04 22:04:10 +0100191 ];
Skyler Greyad002172022-08-16 18:48:26 +0100192 let innerTimedOut = false;
193 let templateSelected = false;
194 while (!innerTimedOut && !templateSelected) {
Skyler Grey75ea9172022-08-06 10:22:23 +0100195 await interaction.editReply({
196 embeds: [
197 new EmojiEmbed()
198 .setTitle("Verify Button")
Skyler Grey11236ba2022-08-08 21:13:33 +0100199 .setDescription("Select a message template to send in this channel")
Skyler Grey75ea9172022-08-06 10:22:23 +0100200 .setFooter({
Skyler Grey11236ba2022-08-08 21:13:33 +0100201 text: role ? "" : "You do no have a verify role set so the button will not work."
Skyler Grey75ea9172022-08-06 10:22:23 +0100202 })
203 .setStatus(role ? "Success" : "Warning")
204 .setEmoji("GUILD.ROLES.CREATE")
205 ],
206 components: [
TheCodedProf59772f82023-01-18 22:17:16 -0500207 new ActionRowBuilder<StringSelectMenuBuilder>().addComponents([
208 new StringSelectMenuBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100209 .setOptions(
210 verifyMessages.map(
211 (
212 t: {
213 label: string;
214 description: string;
215 value?: string;
216 },
217 index
218 ) => {
219 t.value = index.toString();
220 return t as {
221 value: string;
222 label: string;
223 description: string;
224 };
225 }
226 )
227 )
228 .setCustomId("template")
229 .setMaxValues(1)
230 .setMinValues(1)
231 .setPlaceholder("Select a message template")
232 ]),
TheCodedProf59772f82023-01-18 22:17:16 -0500233 new ActionRowBuilder<ButtonBuilder>().addComponents([
TheCodedProf21c08592022-09-13 14:14:43 -0400234 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100235 .setCustomId("back")
236 .setLabel("Back")
237 .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400238 .setStyle(ButtonStyle.Danger),
239 new ButtonBuilder().setCustomId("blank").setLabel("Empty").setStyle(ButtonStyle.Secondary),
240 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100241 .setCustomId("custom")
242 .setLabel("Custom")
243 .setEmoji(getEmojiByName("TICKETS.OTHER", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400244 .setStyle(ButtonStyle.Primary)
Skyler Grey75ea9172022-08-06 10:22:23 +0100245 ])
246 ]
247 });
Skyler Grey1a67e182022-08-04 23:05:44 +0100248 let i: MessageComponentInteraction;
pineafan41d93562022-07-30 22:10:15 +0100249 try {
PineaFan0d06edc2023-01-17 22:10:31 +0000250 i = await m.awaitMessageComponent({
251 time: 300000,
TheCodedProf267563a2023-01-21 17:00:57 -0500252 filter: (i) => { return i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id && i.message.id === m.id }
PineaFan0d06edc2023-01-17 22:10:31 +0000253 });
Skyler Grey75ea9172022-08-06 10:22:23 +0100254 } catch (e) {
Skyler Greyad002172022-08-16 18:48:26 +0100255 innerTimedOut = true;
256 continue;
Skyler Grey75ea9172022-08-06 10:22:23 +0100257 }
TheCodedProf4a6d5712023-01-19 15:54:40 -0500258 if (i.isStringSelectMenu() && i.customId === "template") {
TheCodedProf267563a2023-01-21 17:00:57 -0500259 await i.deferUpdate();
pineafan3a02ea32022-08-11 21:35:04 +0100260 await interaction.channel!.send({
Skyler Grey75ea9172022-08-06 10:22:23 +0100261 embeds: [
262 new EmojiEmbed()
TheCodedProf4a6d5712023-01-19 15:54:40 -0500263 .setTitle(verifyMessages[parseInt(i.values[0]!)]!.label)
Skyler Grey75ea9172022-08-06 10:22:23 +0100264 .setDescription(
TheCodedProf4a6d5712023-01-19 15:54:40 -0500265 verifyMessages[parseInt(i.values[0]!)]!.description
Skyler Grey75ea9172022-08-06 10:22:23 +0100266 )
267 .setStatus("Success")
268 .setEmoji("CONTROL.BLOCKTICK")
269 ],
270 components: [
TheCodedProf59772f82023-01-18 22:17:16 -0500271 new ActionRowBuilder<ButtonBuilder>().addComponents([
TheCodedProf21c08592022-09-13 14:14:43 -0400272 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100273 .setLabel("Verify")
Skyler Grey11236ba2022-08-08 21:13:33 +0100274 .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400275 .setStyle(ButtonStyle.Success)
Skyler Grey75ea9172022-08-06 10:22:23 +0100276 .setCustomId("verifybutton")
277 ])
278 ]
279 });
Skyler Greyad002172022-08-16 18:48:26 +0100280 templateSelected = true;
281 continue;
TheCodedProf59772f82023-01-18 22:17:16 -0500282 } else if ((i.component as ButtonComponent).customId === "blank") {
TheCodedProf267563a2023-01-21 17:00:57 -0500283 await i.deferUpdate();
pineafan3a02ea32022-08-11 21:35:04 +0100284 await interaction.channel!.send({
Skyler Grey75ea9172022-08-06 10:22:23 +0100285 components: [
TheCodedProf59772f82023-01-18 22:17:16 -0500286 new ActionRowBuilder<ButtonBuilder>().addComponents([
TheCodedProf21c08592022-09-13 14:14:43 -0400287 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100288 .setLabel("Verify")
Skyler Grey11236ba2022-08-08 21:13:33 +0100289 .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400290 .setStyle(ButtonStyle.Success)
Skyler Grey75ea9172022-08-06 10:22:23 +0100291 .setCustomId("verifybutton")
292 ])
293 ]
294 });
Skyler Greyad002172022-08-16 18:48:26 +0100295 templateSelected = true;
296 continue;
TheCodedProf59772f82023-01-18 22:17:16 -0500297 } else if ((i.component as ButtonComponent).customId === "custom") {
Skyler Grey75ea9172022-08-06 10:22:23 +0100298 await i.showModal(
TheCodedProf59772f82023-01-18 22:17:16 -0500299 new Discord.ModalBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100300 .setCustomId("modal")
301 .setTitle("Enter embed details")
302 .addComponents(
TheCodedProf59772f82023-01-18 22:17:16 -0500303 new ActionRowBuilder<TextInputBuilder>().addComponents(
304 new TextInputBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100305 .setCustomId("title")
306 .setLabel("Title")
307 .setMaxLength(256)
308 .setRequired(true)
TheCodedProf59772f82023-01-18 22:17:16 -0500309 .setStyle(Discord.TextInputStyle.Short)
Skyler Grey75ea9172022-08-06 10:22:23 +0100310 ),
TheCodedProf59772f82023-01-18 22:17:16 -0500311 new ActionRowBuilder<TextInputBuilder>().addComponents(
312 new TextInputBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100313 .setCustomId("description")
314 .setLabel("Description")
315 .setMaxLength(4000)
316 .setRequired(true)
TheCodedProf59772f82023-01-18 22:17:16 -0500317 .setStyle(Discord.TextInputStyle.Paragraph)
Skyler Grey75ea9172022-08-06 10:22:23 +0100318 )
319 )
320 );
pineafan41d93562022-07-30 22:10:15 +0100321 await interaction.editReply({
Skyler Grey75ea9172022-08-06 10:22:23 +0100322 embeds: [
323 new EmojiEmbed()
324 .setTitle("Verify Button")
Skyler Grey11236ba2022-08-08 21:13:33 +0100325 .setDescription("Modal opened. If you can't see it, click back and try again.")
Skyler Grey75ea9172022-08-06 10:22:23 +0100326 .setStatus("Success")
327 .setEmoji("GUILD.TICKET.OPEN")
328 ],
329 components: [
TheCodedProf59772f82023-01-18 22:17:16 -0500330 new ActionRowBuilder<ButtonBuilder>().addComponents([
TheCodedProf21c08592022-09-13 14:14:43 -0400331 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100332 .setLabel("Back")
Skyler Grey11236ba2022-08-08 21:13:33 +0100333 .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400334 .setStyle(ButtonStyle.Primary)
Skyler Grey75ea9172022-08-06 10:22:23 +0100335 .setCustomId("back")
336 ])
337 ]
pineafan41d93562022-07-30 22:10:15 +0100338 });
339 let out;
340 try {
Skyler Grey75ea9172022-08-06 10:22:23 +0100341 out = await modalInteractionCollector(
342 m,
pineafan3a02ea32022-08-11 21:35:04 +0100343 (m: Interaction) =>
344 (m as MessageComponentInteraction | ModalSubmitInteraction).channelId ===
345 interaction.channelId,
Skyler Grey75ea9172022-08-06 10:22:23 +0100346 (m) => m.customId === "modify"
347 );
348 } catch (e) {
Skyler Greyad002172022-08-16 18:48:26 +0100349 innerTimedOut = true;
pineafan3a02ea32022-08-11 21:35:04 +0100350 continue;
Skyler Greyad002172022-08-16 18:48:26 +0100351 }
352 if (out !== null && out instanceof ModalSubmitInteraction) {
pineafan63fc5e22022-08-04 22:04:10 +0100353 const title = out.fields.getTextInputValue("title");
Skyler Grey11236ba2022-08-08 21:13:33 +0100354 const description = out.fields.getTextInputValue("description");
pineafan3a02ea32022-08-11 21:35:04 +0100355 await interaction.channel!.send({
Skyler Grey75ea9172022-08-06 10:22:23 +0100356 embeds: [
357 new EmojiEmbed()
358 .setTitle(title)
359 .setDescription(description)
360 .setStatus("Success")
361 .setEmoji("CONTROL.BLOCKTICK")
362 ],
363 components: [
TheCodedProf59772f82023-01-18 22:17:16 -0500364 new ActionRowBuilder<ButtonBuilder>().addComponents([
TheCodedProf21c08592022-09-13 14:14:43 -0400365 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100366 .setLabel("Verify")
Skyler Grey11236ba2022-08-08 21:13:33 +0100367 .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400368 .setStyle(ButtonStyle.Success)
Skyler Grey75ea9172022-08-06 10:22:23 +0100369 .setCustomId("verifybutton")
370 ])
371 ]
372 });
Skyler Greyad002172022-08-16 18:48:26 +0100373 templateSelected = true;
Skyler Grey75ea9172022-08-06 10:22:23 +0100374 }
pineafan41d93562022-07-30 22:10:15 +0100375 }
376 }
pineafan6702cef2022-06-13 17:52:37 +0100377 } else {
TheCodedProf267563a2023-01-21 17:00:57 -0500378 await i.deferUpdate();
pineafan41d93562022-07-30 22:10:15 +0100379 break;
pineafan6702cef2022-06-13 17:52:37 +0100380 }
381 }
Skyler Grey75ea9172022-08-06 10:22:23 +0100382 await interaction.editReply({
TheCodedProf59772f82023-01-18 22:17:16 -0500383 embeds: [new EmbedBuilder(m.embeds[0]!.data).setFooter({ text: "Message closed" })],
Skyler Grey75ea9172022-08-06 10:22:23 +0100384 components: []
385 });
pineafan63fc5e22022-08-04 22:04:10 +0100386};
pineafan4f164f32022-02-26 22:07:12 +0000387
TheCodedProff86ba092023-01-27 17:10:07 -0500388const check = (interaction: CommandInteraction, _partial: boolean = false) => {
Skyler Grey75ea9172022-08-06 10:22:23 +0100389 const member = interaction.member as Discord.GuildMember;
PineaFana00db1b2023-01-02 15:32:54 +0000390 if (!member.permissions.has("ManageGuild"))
PineaFan0d06edc2023-01-17 22:10:31 +0000391 return "You must have the *Manage Server* permission to use this command";
pineafan4f164f32022-02-26 22:07:12 +0000392 return true;
pineafan63fc5e22022-08-04 22:04:10 +0100393};
pineafan4f164f32022-02-26 22:07:12 +0000394
395export { command };
396export { callback };
pineafan6702cef2022-06-13 17:52:37 +0100397export { check };