untitled.
untitled.
Explore posts from servers
SIASapphire - Imagine a framework
Created by untitled. on 5/26/2024 in #sapphire-support
What does this even mean
No description
21 replies
SIASapphire - Imagine a framework
Created by untitled. on 5/26/2024 in #sapphire-support
What does this even mean
No description
21 replies
SIASapphire - Imagine a framework
Created by untitled. on 5/26/2024 in #sapphire-support
What does this even mean
sorry caps
21 replies
SIASapphire - Imagine a framework
Created by untitled. on 5/26/2024 in #sapphire-support
What does this even mean
IT IS RETURNING
21 replies
SIASapphire - Imagine a framework
Created by untitled. on 5/26/2024 in #sapphire-support
What does this even mean
No description
21 replies
SIASapphire - Imagine a framework
Created by untitled. on 5/26/2024 in #sapphire-support
What does this even mean
@Boomeravna also how can i make my code register the slash command only in a single guild
21 replies
SIASapphire - Imagine a framework
Created by untitled. on 5/26/2024 in #sapphire-support
What does this even mean
i took my messaage command i made for this and used chatgpt to convert it to a slash command
21 replies
SIASapphire - Imagine a framework
Created by untitled. on 5/26/2024 in #sapphire-support
What does this even mean
wait what's wrong with my arrow function
21 replies
SIASapphire - Imagine a framework
Created by untitled. on 5/26/2024 in #sapphire-support
What does this even mean
the dude im coding this for wants
21 replies
SIASapphire - Imagine a framework
Created by untitled. on 5/26/2024 in #sapphire-support
What does this even mean
heres the code
21 replies
SIASapphire - Imagine a framework
Created by untitled. on 5/26/2024 in #sapphire-support
What does this even mean
import { Command, CommandOptions } from '@sapphire/framework';
import { CommandInteraction, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, MessageComponentInteraction, ComponentType } from 'discord.js';
import { SlashCommandBuilder } from '@discordjs/builders';

export class HelpCommand extends Command {
public constructor(context: Command.LoaderContext, options: CommandOptions) {
super(context, {
...options
});
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) => {
builder.setName('help')
});
}

public async chatInputRun(interaction: CommandInteraction) {
const cmds = this.container.stores.get('commands');
const categories = new Map<string, Command[]>();

cmds.forEach(cmd => {
const category: string = (cmd as any).category || 'Uncategorized';
const list = categories.get(category) || [];
list.push(cmd);
categories.set(category, list);
});

const selectMenu = new StringSelectMenuBuilder()
.setCustomId('select-help')
.setPlaceholder('Choose a category')
.addOptions(
Array.from(categories.keys()).map(category => ({
label: category,
description: `Commands from the ${category} category`,
value: category
}))
);

const row = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(selectMenu);
const emb = new EmbedBuilder()
.setDescription("Choose a category from the list.");

await interaction.reply({
components: [row],
embeds: [emb],
ephemeral: true
});

const filter = (i: MessageComponentInteraction) =>
i.isStringSelectMenu() &&
i.customId === 'select-help' &&
i.user.id === interaction.user.id;

const collector = interaction.channel?.createMessageComponentCollector({
filter,
componentType: ComponentType.StringSelect,
time: 60000
});

collector?.on('collect', async (i: MessageComponentInteraction) => {
if (!i.isStringSelectMenu()) return;

const selectedCategory = i.values[0];
const commands = categories.get(selectedCategory);
if (commands) {
const embed = new EmbedBuilder()
.setTimestamp()
.setTitle(`Help - ${selectedCategory}`)
.setDescription(`<> - required argument\n[] - optional argument`)
.setFooter({ text: `Requested by ${interaction.user.username}`, iconURL: interaction.user.displayAvatarURL() })
.setColor(0x0099ff);

commands.forEach(cmd => {
embed.addFields({ name: `\`>\` ${cmd.name}`, value: cmd.description || 'No description' });
});

await i.update({ embeds: [embed], components: [row] });
}
});

collector?.on('end', () => {
interaction.deleteReply();
});
}
}
import { Command, CommandOptions } from '@sapphire/framework';
import { CommandInteraction, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, MessageComponentInteraction, ComponentType } from 'discord.js';
import { SlashCommandBuilder } from '@discordjs/builders';

export class HelpCommand extends Command {
public constructor(context: Command.LoaderContext, options: CommandOptions) {
super(context, {
...options
});
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) => {
builder.setName('help')
});
}

public async chatInputRun(interaction: CommandInteraction) {
const cmds = this.container.stores.get('commands');
const categories = new Map<string, Command[]>();

cmds.forEach(cmd => {
const category: string = (cmd as any).category || 'Uncategorized';
const list = categories.get(category) || [];
list.push(cmd);
categories.set(category, list);
});

const selectMenu = new StringSelectMenuBuilder()
.setCustomId('select-help')
.setPlaceholder('Choose a category')
.addOptions(
Array.from(categories.keys()).map(category => ({
label: category,
description: `Commands from the ${category} category`,
value: category
}))
);

const row = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(selectMenu);
const emb = new EmbedBuilder()
.setDescription("Choose a category from the list.");

await interaction.reply({
components: [row],
embeds: [emb],
ephemeral: true
});

const filter = (i: MessageComponentInteraction) =>
i.isStringSelectMenu() &&
i.customId === 'select-help' &&
i.user.id === interaction.user.id;

const collector = interaction.channel?.createMessageComponentCollector({
filter,
componentType: ComponentType.StringSelect,
time: 60000
});

collector?.on('collect', async (i: MessageComponentInteraction) => {
if (!i.isStringSelectMenu()) return;

const selectedCategory = i.values[0];
const commands = categories.get(selectedCategory);
if (commands) {
const embed = new EmbedBuilder()
.setTimestamp()
.setTitle(`Help - ${selectedCategory}`)
.setDescription(`<> - required argument\n[] - optional argument`)
.setFooter({ text: `Requested by ${interaction.user.username}`, iconURL: interaction.user.displayAvatarURL() })
.setColor(0x0099ff);

commands.forEach(cmd => {
embed.addFields({ name: `\`>\` ${cmd.name}`, value: cmd.description || 'No description' });
});

await i.update({ embeds: [embed], components: [row] });
}
});

collector?.on('end', () => {
interaction.deleteReply();
});
}
}
21 replies
SIASapphire - Imagine a framework
Created by untitled. on 12/20/2023 in #sapphire-support
What is the event name for when vanity gets updated?
will try
36 replies
SIASapphire - Imagine a framework
Created by untitled. on 12/20/2023 in #sapphire-support
What is the event name for when vanity gets updated?
that one antiraid bot
36 replies
SIASapphire - Imagine a framework
Created by untitled. on 12/20/2023 in #sapphire-support
What is the event name for when vanity gets updated?
if i'm not wrong
36 replies
SIASapphire - Imagine a framework
Created by untitled. on 12/20/2023 in #sapphire-support
What is the event name for when vanity gets updated?
they have a system where you update something they strip your roles and stuff
36 replies
SIASapphire - Imagine a framework
Created by untitled. on 12/20/2023 in #sapphire-support
What is the event name for when vanity gets updated?
how do wick do it tho
36 replies
SIASapphire - Imagine a framework
Created by untitled. on 12/20/2023 in #sapphire-support
What is the event name for when vanity gets updated?
can i see who updated the guild?
36 replies
SIASapphire - Imagine a framework
Created by untitled. on 12/20/2023 in #sapphire-support
What is the event name for when vanity gets updated?
yea
36 replies
SIASapphire - Imagine a framework
Created by untitled. on 12/20/2023 in #sapphire-support
What is the event name for when vanity gets updated?
oh yea
36 replies
SIASapphire - Imagine a framework
Created by untitled. on 12/20/2023 in #sapphire-support
What is the event name for when vanity gets updated?
import { Listener } from '@sapphire/framework';
import { ActivityType, Guild, type Client } from 'discord.js';

export class guildUpdate extends Listener {
public run(client: Client, guild: Guild, newGuild: Guild) {
console.log(guild)
console.log(newGuild)
}
}
import { Listener } from '@sapphire/framework';
import { ActivityType, Guild, type Client } from 'discord.js';

export class guildUpdate extends Listener {
public run(client: Client, guild: Guild, newGuild: Guild) {
console.log(guild)
console.log(newGuild)
}
}
36 replies