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