pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 1 | import Discord, { CommandInteraction } from "discord.js"; |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 2 | import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 3 | |
| 4 | const command = (builder: SlashCommandSubcommandBuilder) => |
| 5 | builder |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 6 | .setName("rolemenu") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 7 | .setDescription("rolemenu") // TODO |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 8 | .addRoleOption((option) => option.setName("role").setDescription("The role to give after verifying")); // FIXME FOR FUCK SAKE |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 9 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 10 | const callback = async (interaction: CommandInteraction): Promise<void> => { |
| 11 | console.log("we changed the charger again because fuck you"); |
| 12 | await interaction.reply("You're mum"); |
| 13 | }; |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 14 | |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame^] | 15 | const check = (interaction: CommandInteraction) => { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 16 | const member = interaction.member as Discord.GuildMember; |
| 17 | if (!member.permissions.has("MANAGE_ROLES")) |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 18 | throw Error("You must have the *Manage Roles* permission to use this command"); |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 19 | return true; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 20 | }; |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 21 | |
| 22 | export { command }; |
| 23 | export { callback }; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 24 | export { check }; |