blob: 0f9f4a0c02b700e1ab1ebd0a0bd1d987988268d8 [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,
13 StringSelectMenuComponent,
14 TextInputBuilder,
15 EmbedBuilder,
16 StringSelectMenuInteraction,
17 ButtonComponent
Skyler Grey75ea9172022-08-06 10:22:23 +010018} from "discord.js";
pineafanda6e5342022-07-03 10:03:16 +010019import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
20import confirmationMessage from "../../utils/confirmationMessage.js";
21import getEmojiByName from "../../utils/getEmojiByName.js";
pineafan3a02ea32022-08-11 21:35:04 +010022import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
pineafanda6e5342022-07-03 10:03:16 +010023import client from "../../utils/client.js";
pineafan63fc5e22022-08-04 22:04:10 +010024import { modalInteractionCollector } from "../../utils/dualCollector.js";
pineafan4f164f32022-02-26 22:07:12 +000025
26const command = (builder: SlashCommandSubcommandBuilder) =>
27 builder
pineafan63fc5e22022-08-04 22:04:10 +010028 .setName("verify")
29 .setDescription("Manage the role given after typing /verify")
Skyler Grey75ea9172022-08-06 10:22:23 +010030 .addRoleOption((option) =>
Skyler Grey11236ba2022-08-08 21:13:33 +010031 option.setName("role").setDescription("The role to give after verifying").setRequired(false)
Skyler Grey75ea9172022-08-06 10:22:23 +010032 );
pineafan4f164f32022-02-26 22:07:12 +000033
pineafan3a02ea32022-08-11 21:35:04 +010034const callback = async (interaction: CommandInteraction): Promise<unknown> => {
PineaFana00db1b2023-01-02 15:32:54 +000035 if (!interaction.guild) return;
Skyler Grey75ea9172022-08-06 10:22:23 +010036 const m = (await interaction.reply({
37 embeds: LoadingEmbed,
38 ephemeral: true,
39 fetchReply: true
40 })) as Message;
TheCodedProf59772f82023-01-18 22:17:16 -050041 if (interaction.options.get("role")?.role) {
Skyler Grey1a67e182022-08-04 23:05:44 +010042 let role: Role;
pineafan6702cef2022-06-13 17:52:37 +010043 try {
TheCodedProf59772f82023-01-18 22:17:16 -050044 role = interaction.options.get("role")?.role as Role;
pineafan6702cef2022-06-13 17:52:37 +010045 } catch {
Skyler Grey75ea9172022-08-06 10:22:23 +010046 return await interaction.editReply({
47 embeds: [
48 new EmojiEmbed()
49 .setEmoji("GUILD.ROLES.DELETE")
50 .setTitle("Verify Role")
Skyler Grey11236ba2022-08-08 21:13:33 +010051 .setDescription("The role you provided is not a valid role")
Skyler Grey75ea9172022-08-06 10:22:23 +010052 .setStatus("Danger")
53 ]
54 });
pineafan6702cef2022-06-13 17:52:37 +010055 }
pineafan63fc5e22022-08-04 22:04:10 +010056 role = role as Discord.Role;
PineaFana00db1b2023-01-02 15:32:54 +000057 if (role.guild.id !== interaction.guild.id) {
Skyler Grey75ea9172022-08-06 10:22:23 +010058 return interaction.editReply({
59 embeds: [
60 new EmojiEmbed()
61 .setTitle("Verify Role")
62 .setDescription("You must choose a role in this server")
63 .setStatus("Danger")
64 .setEmoji("GUILD.ROLES.DELETE")
65 ]
66 });
pineafan6702cef2022-06-13 17:52:37 +010067 }
pineafan63fc5e22022-08-04 22:04:10 +010068 const confirmation = await new confirmationMessage(interaction)
TheCodedProf59772f82023-01-18 22:17:16 -050069 .setEmoji("GUILD.ROLES.EDIT")
pineafan6702cef2022-06-13 17:52:37 +010070 .setTitle("Verify Role")
Skyler Grey11236ba2022-08-08 21:13:33 +010071 .setDescription(`Are you sure you want to set the verify role to <@&${role.id}>?`)
pineafan6702cef2022-06-13 17:52:37 +010072 .setColor("Warning")
TheCodedProf59772f82023-01-18 22:17:16 -050073 .setFailedMessage("No changes were made", "Warning", "GUILD.ROLES.DELETE")
pineafan6702cef2022-06-13 17:52:37 +010074 .setInverted(true)
pineafan63fc5e22022-08-04 22:04:10 +010075 .send(true);
76 if (confirmation.cancelled) return;
pineafan6702cef2022-06-13 17:52:37 +010077 if (confirmation.success) {
78 try {
PineaFana00db1b2023-01-02 15:32:54 +000079 await client.database.guilds.write(interaction.guild.id, {
Skyler Grey75ea9172022-08-06 10:22:23 +010080 "verify.role": role.id,
81 "verify.enabled": true
82 });
Skyler Grey11236ba2022-08-08 21:13:33 +010083 const { log, NucleusColors, entry, renderUser, renderRole } = client.logger;
pineafan63fc5e22022-08-04 22:04:10 +010084 const data = {
Skyler Grey75ea9172022-08-06 10:22:23 +010085 meta: {
pineafan63fc5e22022-08-04 22:04:10 +010086 type: "verifyRoleChanged",
87 displayName: "Verify Role Changed",
88 calculateType: "nucleusSettingsUpdated",
89 color: NucleusColors.green,
90 emoji: "CONTROL.BLOCKTICK",
91 timestamp: new Date().getTime()
92 },
93 list: {
Skyler Grey11236ba2022-08-08 21:13:33 +010094 memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
95 changedBy: entry(interaction.user.id, renderUser(interaction.user)),
pineafan63fc5e22022-08-04 22:04:10 +010096 role: entry(role.id, renderRole(role))
97 },
98 hidden: {
PineaFana00db1b2023-01-02 15:32:54 +000099 guild: interaction.guild.id
pineafanda6e5342022-07-03 10:03:16 +0100100 }
pineafan63fc5e22022-08-04 22:04:10 +0100101 };
102 log(data);
pineafan6702cef2022-06-13 17:52:37 +0100103 } catch (e) {
pineafan63fc5e22022-08-04 22:04:10 +0100104 console.log(e);
Skyler Grey75ea9172022-08-06 10:22:23 +0100105 return interaction.editReply({
106 embeds: [
107 new EmojiEmbed()
108 .setTitle("Verify Role")
Skyler Grey11236ba2022-08-08 21:13:33 +0100109 .setDescription("Something went wrong while setting the verify role")
Skyler Grey75ea9172022-08-06 10:22:23 +0100110 .setStatus("Danger")
111 .setEmoji("GUILD.ROLES.DELETE")
112 ],
113 components: []
114 });
pineafan6702cef2022-06-13 17:52:37 +0100115 }
116 } else {
Skyler Grey75ea9172022-08-06 10:22:23 +0100117 return interaction.editReply({
118 embeds: [
119 new EmojiEmbed()
120 .setTitle("Verify Role")
121 .setDescription("No changes were made")
122 .setStatus("Success")
123 .setEmoji("GUILD.ROLES.CREATE")
124 ],
125 components: []
126 });
pineafan6702cef2022-06-13 17:52:37 +0100127 }
128 }
129 let clicks = 0;
PineaFana00db1b2023-01-02 15:32:54 +0000130 const data = await client.database.guilds.read(interaction.guild.id);
pineafan6702cef2022-06-13 17:52:37 +0100131 let role = data.verify.role;
Skyler Greyad002172022-08-16 18:48:26 +0100132
133 let timedOut = false;
134 while (!timedOut) {
Skyler Grey75ea9172022-08-06 10:22:23 +0100135 await interaction.editReply({
136 embeds: [
137 new EmojiEmbed()
138 .setTitle("Verify Role")
139 .setDescription(
Skyler Grey11236ba2022-08-08 21:13:33 +0100140 role ? `Your verify role is currently set to <@&${role}>` : "You have not set a verify role"
Skyler Grey75ea9172022-08-06 10:22:23 +0100141 )
142 .setStatus("Success")
143 .setEmoji("GUILD.ROLES.CREATE")
144 ],
145 components: [
TheCodedProf59772f82023-01-18 22:17:16 -0500146 new ActionRowBuilder<ButtonBuilder>().addComponents([
TheCodedProf21c08592022-09-13 14:14:43 -0400147 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100148 .setCustomId("clear")
Skyler Grey11236ba2022-08-08 21:13:33 +0100149 .setLabel(clicks ? "Click again to confirm" : "Reset role")
150 .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400151 .setStyle(ButtonStyle.Danger)
Skyler Grey75ea9172022-08-06 10:22:23 +0100152 .setDisabled(!role),
TheCodedProf21c08592022-09-13 14:14:43 -0400153 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100154 .setCustomId("send")
155 .setLabel("Add verify button")
156 .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400157 .setStyle(ButtonStyle.Primary)
Skyler Grey75ea9172022-08-06 10:22:23 +0100158 ])
159 ]
160 });
Skyler Grey1a67e182022-08-04 23:05:44 +0100161 let i: MessageComponentInteraction;
pineafan6702cef2022-06-13 17:52:37 +0100162 try {
PineaFan0d06edc2023-01-17 22:10:31 +0000163 i = await m.awaitMessageComponent({
164 time: 300000,
165 filter: (i) => { return i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id }
166 });
Skyler Grey75ea9172022-08-06 10:22:23 +0100167 } catch (e) {
Skyler Greyad002172022-08-16 18:48:26 +0100168 timedOut = true;
169 continue;
Skyler Grey75ea9172022-08-06 10:22:23 +0100170 }
pineafan63fc5e22022-08-04 22:04:10 +0100171 i.deferUpdate();
TheCodedProf59772f82023-01-18 22:17:16 -0500172 if ((i.component as ButtonComponent).customId === "clear") {
pineafan6702cef2022-06-13 17:52:37 +0100173 clicks += 1;
pineafane23c4ec2022-07-27 21:56:27 +0100174 if (clicks === 2) {
pineafan6702cef2022-06-13 17:52:37 +0100175 clicks = 0;
PineaFana00db1b2023-01-02 15:32:54 +0000176 await client.database.guilds.write(interaction.guild.id, null, ["verify.role", "verify.enabled"]);
TheCodedProf59772f82023-01-18 22:17:16 -0500177 role = null;
pineafan6702cef2022-06-13 17:52:37 +0100178 }
TheCodedProf59772f82023-01-18 22:17:16 -0500179 } else if ((i.component as ButtonComponent).customId === "send") {
pineafan41d93562022-07-30 22:10:15 +0100180 const verifyMessages = [
Skyler Grey75ea9172022-08-06 10:22:23 +0100181 {
182 label: "Verify",
183 description: "Click the button below to get verified"
184 },
185 {
186 label: "Get verified",
Skyler Grey11236ba2022-08-08 21:13:33 +0100187 description: "To get access to the rest of the server, click the button below"
Skyler Grey75ea9172022-08-06 10:22:23 +0100188 },
189 {
190 label: "Ready to verify?",
191 description: "Click the button below to verify yourself"
192 }
pineafan63fc5e22022-08-04 22:04:10 +0100193 ];
Skyler Greyad002172022-08-16 18:48:26 +0100194 let innerTimedOut = false;
195 let templateSelected = false;
196 while (!innerTimedOut && !templateSelected) {
Skyler Grey75ea9172022-08-06 10:22:23 +0100197 await interaction.editReply({
198 embeds: [
199 new EmojiEmbed()
200 .setTitle("Verify Button")
Skyler Grey11236ba2022-08-08 21:13:33 +0100201 .setDescription("Select a message template to send in this channel")
Skyler Grey75ea9172022-08-06 10:22:23 +0100202 .setFooter({
Skyler Grey11236ba2022-08-08 21:13:33 +0100203 text: role ? "" : "You do no have a verify role set so the button will not work."
Skyler Grey75ea9172022-08-06 10:22:23 +0100204 })
205 .setStatus(role ? "Success" : "Warning")
206 .setEmoji("GUILD.ROLES.CREATE")
207 ],
208 components: [
TheCodedProf59772f82023-01-18 22:17:16 -0500209 new ActionRowBuilder<StringSelectMenuBuilder>().addComponents([
210 new StringSelectMenuBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100211 .setOptions(
212 verifyMessages.map(
213 (
214 t: {
215 label: string;
216 description: string;
217 value?: string;
218 },
219 index
220 ) => {
221 t.value = index.toString();
222 return t as {
223 value: string;
224 label: string;
225 description: string;
226 };
227 }
228 )
229 )
230 .setCustomId("template")
231 .setMaxValues(1)
232 .setMinValues(1)
233 .setPlaceholder("Select a message template")
234 ]),
TheCodedProf59772f82023-01-18 22:17:16 -0500235 new ActionRowBuilder<ButtonBuilder>().addComponents([
TheCodedProf21c08592022-09-13 14:14:43 -0400236 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100237 .setCustomId("back")
238 .setLabel("Back")
239 .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400240 .setStyle(ButtonStyle.Danger),
241 new ButtonBuilder().setCustomId("blank").setLabel("Empty").setStyle(ButtonStyle.Secondary),
242 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100243 .setCustomId("custom")
244 .setLabel("Custom")
245 .setEmoji(getEmojiByName("TICKETS.OTHER", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400246 .setStyle(ButtonStyle.Primary)
Skyler Grey75ea9172022-08-06 10:22:23 +0100247 ])
248 ]
249 });
Skyler Grey1a67e182022-08-04 23:05:44 +0100250 let i: MessageComponentInteraction;
pineafan41d93562022-07-30 22:10:15 +0100251 try {
PineaFan0d06edc2023-01-17 22:10:31 +0000252 i = await m.awaitMessageComponent({
253 time: 300000,
254 filter: (i) => { return i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id }
255 });
Skyler Grey75ea9172022-08-06 10:22:23 +0100256 } catch (e) {
Skyler Greyad002172022-08-16 18:48:26 +0100257 innerTimedOut = true;
258 continue;
Skyler Grey75ea9172022-08-06 10:22:23 +0100259 }
TheCodedProf59772f82023-01-18 22:17:16 -0500260 if ((i.component as StringSelectMenuComponent).customId === "template") {
pineafan63fc5e22022-08-04 22:04:10 +0100261 i.deferUpdate();
pineafan3a02ea32022-08-11 21:35:04 +0100262 await interaction.channel!.send({
Skyler Grey75ea9172022-08-06 10:22:23 +0100263 embeds: [
264 new EmojiEmbed()
TheCodedProf59772f82023-01-18 22:17:16 -0500265 .setTitle(verifyMessages[parseInt((i as StringSelectMenuInteraction).values[0]!)]!.label)
Skyler Grey75ea9172022-08-06 10:22:23 +0100266 .setDescription(
TheCodedProf59772f82023-01-18 22:17:16 -0500267 verifyMessages[parseInt((i as StringSelectMenuInteraction).values[0]!)]!.description
Skyler Grey75ea9172022-08-06 10:22:23 +0100268 )
269 .setStatus("Success")
270 .setEmoji("CONTROL.BLOCKTICK")
271 ],
272 components: [
TheCodedProf59772f82023-01-18 22:17:16 -0500273 new ActionRowBuilder<ButtonBuilder>().addComponents([
TheCodedProf21c08592022-09-13 14:14:43 -0400274 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100275 .setLabel("Verify")
Skyler Grey11236ba2022-08-08 21:13:33 +0100276 .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400277 .setStyle(ButtonStyle.Success)
Skyler Grey75ea9172022-08-06 10:22:23 +0100278 .setCustomId("verifybutton")
279 ])
280 ]
281 });
Skyler Greyad002172022-08-16 18:48:26 +0100282 templateSelected = true;
283 continue;
TheCodedProf59772f82023-01-18 22:17:16 -0500284 } else if ((i.component as ButtonComponent).customId === "blank") {
Skyler Grey75ea9172022-08-06 10:22:23 +0100285 i.deferUpdate();
pineafan3a02ea32022-08-11 21:35:04 +0100286 await interaction.channel!.send({
Skyler Grey75ea9172022-08-06 10:22:23 +0100287 components: [
TheCodedProf59772f82023-01-18 22:17:16 -0500288 new ActionRowBuilder<ButtonBuilder>().addComponents([
TheCodedProf21c08592022-09-13 14:14:43 -0400289 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100290 .setLabel("Verify")
Skyler Grey11236ba2022-08-08 21:13:33 +0100291 .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400292 .setStyle(ButtonStyle.Success)
Skyler Grey75ea9172022-08-06 10:22:23 +0100293 .setCustomId("verifybutton")
294 ])
295 ]
296 });
Skyler Greyad002172022-08-16 18:48:26 +0100297 templateSelected = true;
298 continue;
TheCodedProf59772f82023-01-18 22:17:16 -0500299 } else if ((i.component as ButtonComponent).customId === "custom") {
Skyler Grey75ea9172022-08-06 10:22:23 +0100300 await i.showModal(
TheCodedProf59772f82023-01-18 22:17:16 -0500301 new Discord.ModalBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100302 .setCustomId("modal")
303 .setTitle("Enter embed details")
304 .addComponents(
TheCodedProf59772f82023-01-18 22:17:16 -0500305 new ActionRowBuilder<TextInputBuilder>().addComponents(
306 new TextInputBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100307 .setCustomId("title")
308 .setLabel("Title")
309 .setMaxLength(256)
310 .setRequired(true)
TheCodedProf59772f82023-01-18 22:17:16 -0500311 .setStyle(Discord.TextInputStyle.Short)
Skyler Grey75ea9172022-08-06 10:22:23 +0100312 ),
TheCodedProf59772f82023-01-18 22:17:16 -0500313 new ActionRowBuilder<TextInputBuilder>().addComponents(
314 new TextInputBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100315 .setCustomId("description")
316 .setLabel("Description")
317 .setMaxLength(4000)
318 .setRequired(true)
TheCodedProf59772f82023-01-18 22:17:16 -0500319 .setStyle(Discord.TextInputStyle.Paragraph)
Skyler Grey75ea9172022-08-06 10:22:23 +0100320 )
321 )
322 );
pineafan41d93562022-07-30 22:10:15 +0100323 await interaction.editReply({
Skyler Grey75ea9172022-08-06 10:22:23 +0100324 embeds: [
325 new EmojiEmbed()
326 .setTitle("Verify Button")
Skyler Grey11236ba2022-08-08 21:13:33 +0100327 .setDescription("Modal opened. If you can't see it, click back and try again.")
Skyler Grey75ea9172022-08-06 10:22:23 +0100328 .setStatus("Success")
329 .setEmoji("GUILD.TICKET.OPEN")
330 ],
331 components: [
TheCodedProf59772f82023-01-18 22:17:16 -0500332 new ActionRowBuilder<ButtonBuilder>().addComponents([
TheCodedProf21c08592022-09-13 14:14:43 -0400333 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100334 .setLabel("Back")
Skyler Grey11236ba2022-08-08 21:13:33 +0100335 .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400336 .setStyle(ButtonStyle.Primary)
Skyler Grey75ea9172022-08-06 10:22:23 +0100337 .setCustomId("back")
338 ])
339 ]
pineafan41d93562022-07-30 22:10:15 +0100340 });
341 let out;
342 try {
Skyler Grey75ea9172022-08-06 10:22:23 +0100343 out = await modalInteractionCollector(
344 m,
pineafan3a02ea32022-08-11 21:35:04 +0100345 (m: Interaction) =>
346 (m as MessageComponentInteraction | ModalSubmitInteraction).channelId ===
347 interaction.channelId,
Skyler Grey75ea9172022-08-06 10:22:23 +0100348 (m) => m.customId === "modify"
349 );
350 } catch (e) {
Skyler Greyad002172022-08-16 18:48:26 +0100351 innerTimedOut = true;
pineafan3a02ea32022-08-11 21:35:04 +0100352 continue;
Skyler Greyad002172022-08-16 18:48:26 +0100353 }
354 if (out !== null && out instanceof ModalSubmitInteraction) {
pineafan63fc5e22022-08-04 22:04:10 +0100355 const title = out.fields.getTextInputValue("title");
Skyler Grey11236ba2022-08-08 21:13:33 +0100356 const description = out.fields.getTextInputValue("description");
pineafan3a02ea32022-08-11 21:35:04 +0100357 await interaction.channel!.send({
Skyler Grey75ea9172022-08-06 10:22:23 +0100358 embeds: [
359 new EmojiEmbed()
360 .setTitle(title)
361 .setDescription(description)
362 .setStatus("Success")
363 .setEmoji("CONTROL.BLOCKTICK")
364 ],
365 components: [
TheCodedProf59772f82023-01-18 22:17:16 -0500366 new ActionRowBuilder<ButtonBuilder>().addComponents([
TheCodedProf21c08592022-09-13 14:14:43 -0400367 new ButtonBuilder()
Skyler Grey75ea9172022-08-06 10:22:23 +0100368 .setLabel("Verify")
Skyler Grey11236ba2022-08-08 21:13:33 +0100369 .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
TheCodedProf21c08592022-09-13 14:14:43 -0400370 .setStyle(ButtonStyle.Success)
Skyler Grey75ea9172022-08-06 10:22:23 +0100371 .setCustomId("verifybutton")
372 ])
373 ]
374 });
Skyler Greyad002172022-08-16 18:48:26 +0100375 templateSelected = true;
Skyler Grey75ea9172022-08-06 10:22:23 +0100376 }
pineafan41d93562022-07-30 22:10:15 +0100377 }
378 }
pineafan6702cef2022-06-13 17:52:37 +0100379 } else {
pineafan63fc5e22022-08-04 22:04:10 +0100380 i.deferUpdate();
pineafan41d93562022-07-30 22:10:15 +0100381 break;
pineafan6702cef2022-06-13 17:52:37 +0100382 }
383 }
Skyler Grey75ea9172022-08-06 10:22:23 +0100384 await interaction.editReply({
TheCodedProf59772f82023-01-18 22:17:16 -0500385 embeds: [new EmbedBuilder(m.embeds[0]!.data).setFooter({ text: "Message closed" })],
Skyler Grey75ea9172022-08-06 10:22:23 +0100386 components: []
387 });
pineafan63fc5e22022-08-04 22:04:10 +0100388};
pineafan4f164f32022-02-26 22:07:12 +0000389
Skyler Grey1a67e182022-08-04 23:05:44 +0100390const check = (interaction: CommandInteraction) => {
Skyler Grey75ea9172022-08-06 10:22:23 +0100391 const member = interaction.member as Discord.GuildMember;
PineaFana00db1b2023-01-02 15:32:54 +0000392 if (!member.permissions.has("ManageGuild"))
PineaFan0d06edc2023-01-17 22:10:31 +0000393 return "You must have the *Manage Server* permission to use this command";
pineafan4f164f32022-02-26 22:07:12 +0000394 return true;
pineafan63fc5e22022-08-04 22:04:10 +0100395};
pineafan4f164f32022-02-26 22:07:12 +0000396
397export { command };
398export { callback };
pineafan6702cef2022-06-13 17:52:37 +0100399export { check };