Skip to content

Commit

Permalink
Cleanup some api usage
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Dec 14, 2024
1 parent 6b08582 commit 53d7238
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions modules/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import {
ActionRowBuilder, ActionRowData,
ActionRowBuilder,
ActionRowData,
ApplicationCommandType,
Client,
ColorResolvable,
ComponentType,
ContextMenuCommandBuilder,
EmbedBuilder, MessageActionRowComponentData,
EmbedBuilder,
InteractionContextType,
MessageActionRowComponentData,
PermissionFlagsBits,
REST,
RESTPostAPIApplicationCommandsJSONBody,
Routes,
SlashCommandBuilder,
StringSelectMenuBuilder,
Expand All @@ -25,7 +29,7 @@ const commands: ConfigCommand[] = configCommands.sort((a, b) => {
return 0
})

const slashApiCommands: any[] = [
const slashApiCommands: RESTPostAPIApplicationCommandsJSONBody[] = [
new SlashCommandBuilder()
.setName('help')
.setDescription('Show Steward help')
Expand All @@ -43,7 +47,7 @@ const slashApiCommands: any[] = [
.setName('resolved')
.setDescription('Moderator command to mark a forum post as resolved')
.setDefaultMemberPermissions(PermissionFlagsBits.ManageThreads)
.setDMPermission(false)
.setContexts([InteractionContextType.Guild])
.toJSON()
]

Expand All @@ -59,11 +63,12 @@ for (const command of commands) {
slashApiCommands.push(slashCommand.toJSON())
}

const sendHelpContext = new ContextMenuCommandBuilder()
.setName("Send Help")
.setType(ApplicationCommandType.Message)

slashApiCommands.push(sendHelpContext.toJSON())
slashApiCommands.push(
new ContextMenuCommandBuilder()
.setName("Send Help")
.setType(ApplicationCommandType.Message)

Check failure on line 69 in modules/commands/index.ts

View workflow job for this annotation

GitHub Actions / build

Argument of type 'ApplicationCommandType.Message' is not assignable to parameter of type 'ContextMenuCommandType'.
.toJSON()
)

interface CommandData {
id: string
Expand Down Expand Up @@ -109,10 +114,10 @@ export default async (client: Client): Promise<void> => {
.setCustomId(customId)
.setPlaceholder('Choose a help type!')
.addOptions(commands.map(command => new StringSelectMenuOptionBuilder()
.setLabel(command.name)
.setValue(command.name)
.setDescription(command.cmdDescription)
))
.setLabel(command.name)
.setValue(command.name)
.setDescription(command.cmdDescription)
))

const row = new ActionRowBuilder()
.addComponents(select)
Expand Down

0 comments on commit 53d7238

Please sign in to comment.