TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 1 | import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js"; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 2 | import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; |
pineafan | 8b4b17f | 2022-02-27 20:42:52 +0000 | [diff] [blame] | 3 | import confirmationMessage from "../../utils/confirmationMessage.js"; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 4 | import EmojiEmbed from "../../utils/generateEmojiEmbed.js"; |
pineafan | 8b4b17f | 2022-02-27 20:42:52 +0000 | [diff] [blame] | 5 | import keyValueList from "../../utils/generateKeyValueList.js"; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 6 | import { create, areTicketsEnabled } from "../../actions/createModActionTicket.js"; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 7 | import client from "../../utils/client.js"; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 8 | |
| 9 | const command = (builder: SlashCommandSubcommandBuilder) => |
| 10 | builder |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 11 | .setName("warn") |
| 12 | .setDescription("Warns a user") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 13 | .addUserOption((option) => option.setName("user").setDescription("The user to warn").setRequired(true)); |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 14 | |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 15 | const callback = async (interaction: CommandInteraction): Promise<unknown> => { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 16 | const { log, NucleusColors, renderUser, entry } = client.logger; |
pineafan | 8b4b17f | 2022-02-27 20:42:52 +0000 | [diff] [blame] | 17 | // TODO:[Modals] Replace this with a modal |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 18 | let reason = null; |
pineafan | 02ba023 | 2022-07-24 22:16:15 +0100 | [diff] [blame] | 19 | let notify = true; |
| 20 | let createAppealTicket = false; |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 21 | let confirmation; |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 22 | let timedOut = false; |
| 23 | let success = false; |
pineafan | 62ce192 | 2022-08-25 20:34:45 +0100 | [diff] [blame] | 24 | do { |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 25 | confirmation = await new confirmationMessage(interaction) |
| 26 | .setEmoji("PUNISH.WARN.RED") |
| 27 | .setTitle("Warn") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 28 | .setDescription( |
| 29 | keyValueList({ |
| 30 | user: renderUser(interaction.options.getUser("user")), |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 31 | reason: reason ? "\n> " + reason.replaceAll("\n", "\n> ") : "*No reason provided*" |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 32 | }) + |
| 33 | `The user **will${notify ? "" : " not"}** be notified\n\n` + |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 34 | `Are you sure you want to warn <@!${(interaction.options.getMember("user") as GuildMember).id}>?` |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 35 | ) |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 36 | .setColor("Danger") |
| 37 | .addCustomBoolean( |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 38 | "appeal", |
| 39 | "Create appeal ticket", |
| 40 | !(await areTicketsEnabled(interaction.guild.id)), |
| 41 | async () => |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 42 | await create(interaction.guild, interaction.options.getUser("user"), interaction.user, reason), |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 43 | "An appeal ticket will be created when Confirm is clicked", |
| 44 | "CONTROL.TICKET", |
| 45 | createAppealTicket |
| 46 | ) |
| 47 | .addCustomBoolean( |
| 48 | "notify", |
| 49 | "Notify user", |
| 50 | false, |
| 51 | null, |
| 52 | null, |
| 53 | "ICONS.NOTIFY." + (notify ? "ON" : "OFF"), |
| 54 | notify |
| 55 | ) |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 56 | .addReasonButton(reason ?? "") |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 57 | .send(reason !== null); |
| 58 | reason = reason ?? ""; |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 59 | if (confirmation.cancelled) timedOut = true; |
pineafan | 62ce192 | 2022-08-25 20:34:45 +0100 | [diff] [blame] | 60 | else if (confirmation.success !== undefined) success = true; |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 61 | else if (confirmation.newReason) reason = confirmation.newReason; |
| 62 | else if (confirmation.components) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 63 | notify = confirmation.components.notify.active; |
| 64 | createAppealTicket = confirmation.components.appeal.active; |
pineafan | 02ba023 | 2022-07-24 22:16:15 +0100 | [diff] [blame] | 65 | } |
pineafan | 62ce192 | 2022-08-25 20:34:45 +0100 | [diff] [blame] | 66 | } while (!timedOut && !success) |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 67 | if (timedOut) return; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 68 | if (confirmation.success) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 69 | let dmd = false; |
pineafan | 8b4b17f | 2022-02-27 20:42:52 +0000 | [diff] [blame] | 70 | try { |
pineafan | 02ba023 | 2022-07-24 22:16:15 +0100 | [diff] [blame] | 71 | if (notify) { |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 72 | const config = await client.database.guilds.read(interaction.guild.id); |
| 73 | await (interaction.options.getMember("user") as GuildMember).send({ |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 74 | embeds: [ |
| 75 | new EmojiEmbed() |
| 76 | .setEmoji("PUNISH.WARN.RED") |
| 77 | .setTitle("Warned") |
| 78 | .setDescription( |
| 79 | `You have been warned in ${interaction.guild.name}` + |
| 80 | (reason ? ` for:\n> ${reason}` : ".") + |
| 81 | "\n\n" + |
| 82 | (confirmation.components.appeal.response |
| 83 | ? `You can appeal this here ticket: <#${confirmation.components.appeal.response}>` |
| 84 | : "") |
| 85 | ) |
| 86 | .setStatus("Danger") |
| 87 | .setFooter({ |
| 88 | text: config.moderation.warn.text |
| 89 | ? "The button below is set by the server admins. Do not enter any passwords or other account details on the linked site." |
| 90 | : "", |
| 91 | iconURL: |
| 92 | "https://cdn.discordapp.com/emojis/952295894370369587.webp?size=128&quality=lossless" |
| 93 | }) |
pineafan | 02ba023 | 2022-07-24 22:16:15 +0100 | [diff] [blame] | 94 | ], |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 95 | components: config.moderation.warn.text |
| 96 | ? [ |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 97 | new ActionRowBuilder().addComponents([ |
| 98 | new ButtonBuilder() |
| 99 | .setStyle(ButtonStyle.Link) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 100 | .setLabel(config.moderation.warn.text) |
| 101 | .setURL(config.moderation.warn.link) |
| 102 | ]) |
| 103 | ] |
| 104 | : [] |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 105 | }); |
| 106 | dmd = true; |
pineafan | 8b4b17f | 2022-02-27 20:42:52 +0000 | [diff] [blame] | 107 | } |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 108 | } catch { |
| 109 | dmd = false; |
| 110 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 111 | const data = { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 112 | meta: { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 113 | type: "memberWarn", |
| 114 | displayName: "Member warned", |
| 115 | calculateType: "guildMemberPunish", |
pineafan | 1dc1572 | 2022-03-14 21:27:34 +0000 | [diff] [blame] | 116 | color: NucleusColors.yellow, |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 117 | emoji: "PUNISH.WARN.YELLOW", |
pineafan | 1dc1572 | 2022-03-14 21:27:34 +0000 | [diff] [blame] | 118 | timestamp: new Date().getTime() |
| 119 | }, |
| 120 | list: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 121 | user: entry( |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 122 | (interaction.options.getMember("user") as GuildMember).user.id, |
| 123 | renderUser((interaction.options.getMember("user") as GuildMember).user) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 124 | ), |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 125 | warnedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)), |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 126 | reason: reason ? `\n> ${reason}` : "No reason provided" |
pineafan | 1dc1572 | 2022-03-14 21:27:34 +0000 | [diff] [blame] | 127 | }, |
| 128 | hidden: { |
| 129 | guild: interaction.guild.id |
| 130 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 131 | }; |
| 132 | await client.database.history.create( |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 133 | "warn", |
| 134 | interaction.guild.id, |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 135 | (interaction.options.getMember("user") as GuildMember).user, |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 136 | interaction.user, |
| 137 | reason |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 138 | ); |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 139 | log(data); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 140 | const failed = !dmd && notify; |
pineafan | 5d1908e | 2022-02-28 21:34:47 +0000 | [diff] [blame] | 141 | if (!failed) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 142 | await interaction.editReply({ |
| 143 | embeds: [ |
| 144 | new EmojiEmbed() |
| 145 | .setEmoji("PUNISH.WARN.GREEN") |
| 146 | .setTitle("Warn") |
| 147 | .setDescription( |
| 148 | "The user was warned" + |
| 149 | (confirmation.components.appeal.response |
| 150 | ? ` and an appeal ticket was opened in <#${confirmation.components.appeal.response}>` |
| 151 | : "") |
| 152 | ) |
| 153 | .setStatus("Success") |
| 154 | ], |
| 155 | components: [] |
| 156 | }); |
pineafan | 5d1908e | 2022-02-28 21:34:47 +0000 | [diff] [blame] | 157 | } else { |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 158 | const canSeeChannel = (interaction.options.getMember("user") as GuildMember) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 159 | .permissionsIn(interaction.channel as Discord.TextChannel) |
| 160 | .has("VIEW_CHANNEL"); |
| 161 | const m = (await interaction.editReply({ |
| 162 | embeds: [ |
| 163 | new EmojiEmbed() |
| 164 | .setEmoji("PUNISH.WARN.RED") |
| 165 | .setTitle("Warn") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 166 | .setDescription("The user's DMs are not open\n\nWhat would you like to do?") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 167 | .setStatus("Danger") |
| 168 | ], |
| 169 | components: [ |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 170 | new ActionRowBuilder().addComponents([ |
| 171 | new Discord.ButtonBuilder().setCustomId("log").setLabel("Ignore and log").setStyle(ButtonStyle.Secondary), |
| 172 | new Discord.ButtonBuilder() |
pineafan | 5d1908e | 2022-02-28 21:34:47 +0000 | [diff] [blame] | 173 | .setCustomId("here") |
| 174 | .setLabel("Warn here") |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 175 | .setStyle(canSeeChannel ? ButtonStyle.Primary : ButtonStyle.Secondary) |
pineafan | c1c1879 | 2022-08-03 21:41:36 +0100 | [diff] [blame] | 176 | .setDisabled(!canSeeChannel), |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 177 | new Discord.ButtonBuilder() |
pineafan | c1c1879 | 2022-08-03 21:41:36 +0100 | [diff] [blame] | 178 | .setCustomId("ticket") |
| 179 | .setLabel("Create ticket") |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 180 | .setStyle(canSeeChannel ? ButtonStyle.Primary : ButtonStyle.Secondary) |
pineafan | 5d1908e | 2022-02-28 21:34:47 +0000 | [diff] [blame] | 181 | ]) |
pineafan | 02ba023 | 2022-07-24 22:16:15 +0100 | [diff] [blame] | 182 | ] |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 183 | })) as Discord.Message; |
pineafan | 5d1908e | 2022-02-28 21:34:47 +0000 | [diff] [blame] | 184 | let component; |
| 185 | try { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 186 | component = await m.awaitMessageComponent({ |
| 187 | filter: (m) => m.user.id === interaction.user.id, |
| 188 | time: 300000 |
| 189 | }); |
pineafan | 5d1908e | 2022-02-28 21:34:47 +0000 | [diff] [blame] | 190 | } catch (e) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 191 | return await interaction.editReply({ |
| 192 | embeds: [ |
| 193 | new EmojiEmbed() |
| 194 | .setEmoji("PUNISH.WARN.GREEN") |
| 195 | .setTitle("Warn") |
| 196 | .setDescription("No changes were made") |
| 197 | .setStatus("Success") |
| 198 | ], |
| 199 | components: [] |
| 200 | }); |
| 201 | } |
| 202 | if (component.customId === "here") { |
| 203 | await interaction.channel.send({ |
| 204 | embeds: [ |
| 205 | new EmojiEmbed() |
| 206 | .setEmoji("PUNISH.WARN.RED") |
| 207 | .setTitle("Warn") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 208 | .setDescription("You have been warned" + (reason ? ` for:\n> ${reason}` : ".")) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 209 | .setStatus("Danger") |
| 210 | ], |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 211 | content: `<@!${(interaction.options.getMember("user") as GuildMember).id}>`, |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 212 | allowedMentions: { |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 213 | users: [(interaction.options.getMember("user") as GuildMember).id] |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 214 | } |
| 215 | }); |
| 216 | return await interaction.editReply({ |
| 217 | embeds: [ |
| 218 | new EmojiEmbed() |
| 219 | .setEmoji("PUNISH.WARN.GREEN") |
| 220 | .setTitle("Warn") |
| 221 | .setDescription( |
| 222 | "The user was warned" + |
| 223 | (confirmation.response |
| 224 | ? ` and an appeal ticket was opened in <#${confirmation.response}>` |
| 225 | : "") |
| 226 | ) |
| 227 | .setStatus("Success") |
| 228 | ], |
| 229 | components: [] |
| 230 | }); |
| 231 | } else if (component.customId === "log") { |
| 232 | await interaction.editReply({ |
| 233 | embeds: [ |
| 234 | new EmojiEmbed() |
| 235 | .setEmoji("PUNISH.WARN.GREEN") |
| 236 | .setTitle("Warn") |
| 237 | .setDescription("The warn was logged") |
| 238 | .setStatus("Success") |
| 239 | ], |
| 240 | components: [] |
| 241 | }); |
| 242 | } else if (component.customId === "ticket") { |
| 243 | const ticketChannel = await create( |
| 244 | interaction.guild, |
| 245 | interaction.options.getUser("user"), |
| 246 | interaction.user, |
| 247 | reason, |
| 248 | "Warn Notification" |
| 249 | ); |
| 250 | if (ticketChannel === null) { |
| 251 | return await interaction.editReply({ |
| 252 | embeds: [ |
| 253 | new EmojiEmbed() |
| 254 | .setEmoji("PUNISH.WARN.RED") |
| 255 | .setTitle("Warn") |
| 256 | .setDescription("A ticket could not be created") |
| 257 | .setStatus("Danger") |
| 258 | ], |
| 259 | components: [] |
| 260 | }); |
| 261 | } |
| 262 | await interaction.editReply({ |
| 263 | embeds: [ |
| 264 | new EmojiEmbed() |
| 265 | .setEmoji("PUNISH.WARN.GREEN") |
| 266 | .setTitle("Warn") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 267 | .setDescription(`A ticket was created in <#${ticketChannel}>`) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 268 | .setStatus("Success") |
| 269 | ], |
| 270 | components: [] |
| 271 | }); |
| 272 | } |
| 273 | } |
| 274 | } else { |
| 275 | await interaction.editReply({ |
| 276 | embeds: [ |
| 277 | new EmojiEmbed() |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 278 | .setEmoji("PUNISH.WARN.GREEN") |
| 279 | .setTitle("Warn") |
pineafan | 5d1908e | 2022-02-28 21:34:47 +0000 | [diff] [blame] | 280 | .setDescription("No changes were made") |
| 281 | .setStatus("Success") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 282 | ], |
| 283 | components: [] |
| 284 | }); |
pineafan | 8b4b17f | 2022-02-27 20:42:52 +0000 | [diff] [blame] | 285 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 286 | }; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 287 | |
pineafan | bd02b4a | 2022-08-05 22:01:38 +0100 | [diff] [blame] | 288 | const check = (interaction: CommandInteraction) => { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 289 | const member = interaction.member as GuildMember; |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 290 | const apply = interaction.options.getMember("user") as GuildMember | null; |
| 291 | if (apply === null) throw new Error("That member is not in the server"); |
| 292 | const memberPos = member.roles.cache.size ? member.roles.highest.position : 0; |
| 293 | const applyPos = apply.roles.cache.size ? apply.roles.highest.position : 0; |
pineafan | 8b4b17f | 2022-02-27 20:42:52 +0000 | [diff] [blame] | 294 | // Do not allow warning bots |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 295 | if (member.user.bot) throw new Error("I cannot warn bots"); |
pineafan | 8b4b17f | 2022-02-27 20:42:52 +0000 | [diff] [blame] | 296 | // Allow the owner to warn anyone |
pineafan | 62ce192 | 2022-08-25 20:34:45 +0100 | [diff] [blame] | 297 | if (member.id === interaction.guild!.ownerId) return true; |
pineafan | 8b4b17f | 2022-02-27 20:42:52 +0000 | [diff] [blame] | 298 | // Check if the user has moderate_members permission |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 299 | if (!member.permissions.has("MODERATE_MEMBERS")) |
| 300 | throw new Error("You do not have the *Moderate Members* permission"); |
pineafan | 8b4b17f | 2022-02-27 20:42:52 +0000 | [diff] [blame] | 301 | // Check if the user is below on the role list |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 302 | if (!(memberPos > applyPos)) throw new Error("You do not have a role higher than that member"); |
pineafan | 8b4b17f | 2022-02-27 20:42:52 +0000 | [diff] [blame] | 303 | // Allow warn |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 304 | return true; |
| 305 | }; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 306 | |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 307 | export { command, callback, check }; |