ender
ender
SIASapphire - Imagine a framework
Created by ender on 11/12/2023 in #sapphire-support
Check if command is a slash command
categories.forEach((category) => {
const dir = commands.filter((c) => c.category === category);
const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1);

embed.addFields({ name: `${capitalise} [${dir.size}]`, value: dir.map((c) => `\`${c.name}\``).join(', ') });
});
categories.forEach((category) => {
const dir = commands.filter((c) => c.category === category);
const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1);

embed.addFields({ name: `${capitalise} [${dir.size}]`, value: dir.map((c) => `\`${c.name}\``).join(', ') });
});
Currently making a help command, below is code I use to add fields, how do I add a slash in front of the c.name if the command is a slash command?
10 replies
SIASapphire - Imagine a framework
Created by ender on 11/10/2023 in #sapphire-support
command failing, no errors
const { Command } = require("@sapphire/framework");
const { EmbedBuilder } = require("discord.js");

class SettingsCommand extends Command {
constructor(context, options) {
super(context, {
...options,
description: "Edit or view server-specific settings.",
subcommands: [
{
name: "view",
chatInputRun: "chatInputView",
}
]
});
}

registerApplicationCommands(registry) {
registry.registerChatInputCommand((builder) =>
builder
.setName(this.name)
.setDescription(this.description)
.addSubcommand((command) =>
command
.setName("view")
.setDescription("View your current settings."))
);
}

async chatInputView(interaction) {
const embed = new EmbedBuilder()
.setDescription(`**Panel URL:** link\n**Panel API Key:** ||api key||`)

return interaction.reply({ embeds: [embed] });
}
}

module.exports = {
SettingsCommand
};
const { Command } = require("@sapphire/framework");
const { EmbedBuilder } = require("discord.js");

class SettingsCommand extends Command {
constructor(context, options) {
super(context, {
...options,
description: "Edit or view server-specific settings.",
subcommands: [
{
name: "view",
chatInputRun: "chatInputView",
}
]
});
}

registerApplicationCommands(registry) {
registry.registerChatInputCommand((builder) =>
builder
.setName(this.name)
.setDescription(this.description)
.addSubcommand((command) =>
command
.setName("view")
.setDescription("View your current settings."))
);
}

async chatInputView(interaction) {
const embed = new EmbedBuilder()
.setDescription(`**Panel URL:** link\n**Panel API Key:** ||api key||`)

return interaction.reply({ embeds: [embed] });
}
}

module.exports = {
SettingsCommand
};
this is the code for my command, and for some odd reason it just fails without giving me an errors
13 replies