paulandrew
paulandrew
SIASapphire - Imagine a framework
Created by paulandrew on 2/5/2024 in #sapphire-support
Error when using @sapphire/type
Error: Cannot find module '/workspaces/shim/node_modules/@sapphire/type/prebuild/type-node-v115-linux-x64-glibc-2.31/type.node'
Error: Cannot find module '/workspaces/shim/node_modules/@sapphire/type/prebuild/type-node-v115-linux-x64-glibc-2.31/type.node'
8 replies
SIASapphire - Imagine a framework
Created by paulandrew on 12/10/2023 in #discordjs-support
Problem with ChannelSelectMenuBuilder
THis are my options for it:
new ChannelSelectMenuBuilder()
.setCustomId('select-ticket-category-dropdown')
.setPlaceholder('Select a category')
.setMinValues(1)
.setMaxValues(1)
.setChannelTypes(ChannelType.GuildCategory)
new ChannelSelectMenuBuilder()
.setCustomId('select-ticket-category-dropdown')
.setPlaceholder('Select a category')
.setMinValues(1)
.setMaxValues(1)
.setChannelTypes(ChannelType.GuildCategory)
so when i click the select menu and pic a category, it just returns an error this error below:
2023-12-10 13:15:02 - ERROR - Encountered error on event listener "CoreInteractionCreate" for event "interactionCreate" at path "::virtual::" TypeError: Cannot read properties of undefined (reading 'match')
2023-12-10 13:15:02 - ERROR - at Object.ok (/workspaces/saber-chan/node_modules/@sapphire/framework/dist/cjs/lib/structures/InteractionHandlerStore.cjs:26:18)
2023-12-10 13:15:02 - ERROR - at _ResultOk.match (/workspaces/saber-chan/node_modules/@sapphire/result/dist/cjs/index.cjs:151:21)
2023-12-10 13:15:02 - ERROR - at _InteractionHandlerStore.run (/workspaces/saber-chan/node_modules/@sapphire/framework/dist/cjs/lib/structures/InteractionHandlerStore.cjs:23:16)
2023-12-10 13:15:02 - ERROR - at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-12-10 13:15:02 - ERROR - at async _CoreListener.run (/workspaces/saber-chan/node_modules/@sapphire/framework/dist/cjs/listeners/CoreInteractionCreate.cjs:21:7)
2023-12-10 13:15:02 - ERROR - at async Object.fromAsync (/workspaces/saber-chan/node_modules/@sapphire/result/dist/cjs/index.cjs:619:22)
2023-12-10 13:15:02 - ERROR - at async _CoreListener._run (/workspaces/saber-chan/node_modules/@sapphire/framework/dist/cjs/lib/structures/Listener.cjs:27:22)
2023-12-10 13:15:02 - ERROR - Encountered error on event listener "CoreInteractionCreate" for event "interactionCreate" at path "::virtual::" TypeError: Cannot read properties of undefined (reading 'match')
2023-12-10 13:15:02 - ERROR - at Object.ok (/workspaces/saber-chan/node_modules/@sapphire/framework/dist/cjs/lib/structures/InteractionHandlerStore.cjs:26:18)
2023-12-10 13:15:02 - ERROR - at _ResultOk.match (/workspaces/saber-chan/node_modules/@sapphire/result/dist/cjs/index.cjs:151:21)
2023-12-10 13:15:02 - ERROR - at _InteractionHandlerStore.run (/workspaces/saber-chan/node_modules/@sapphire/framework/dist/cjs/lib/structures/InteractionHandlerStore.cjs:23:16)
2023-12-10 13:15:02 - ERROR - at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-12-10 13:15:02 - ERROR - at async _CoreListener.run (/workspaces/saber-chan/node_modules/@sapphire/framework/dist/cjs/listeners/CoreInteractionCreate.cjs:21:7)
2023-12-10 13:15:02 - ERROR - at async Object.fromAsync (/workspaces/saber-chan/node_modules/@sapphire/result/dist/cjs/index.cjs:619:22)
2023-12-10 13:15:02 - ERROR - at async _CoreListener._run (/workspaces/saber-chan/node_modules/@sapphire/framework/dist/cjs/lib/structures/Listener.cjs:27:22)
5 replies
SIASapphire - Imagine a framework
Created by paulandrew on 12/3/2023 in #sapphire-support
Error when creating a modal
Can someone help me figure the cause of this error, heres my code below and the error. Code:
const { InteractionHandler, InteractionHandlerTypes } = require('@sapphire/framework');
const { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');

module.exports = class CreateEmbed extends InteractionHandler {
constructor(ctx, options) {
super(ctx, {
...options,
interactionHandlerType: InteractionHandlerTypes.Button
});
};

async run(interaction, result) {
await interaction.showModal(result);
}

async parse(interaction) {

if (interaction.customId !== 'setupEmbedBtn') {
console.log(interaction.customId)
this.none();
}

try {
const modal = new ModalBuilder()
.setCustomId('setupEmbedMdl')
.setTitle('Setup Embed')

const embedGeneratorInput = new TextInputBuilder()
.setCustomId('embedGeneratorInput')
.setLabel('Pase the json code here or the url')
.setMaxLength(4000)
.setStyle(TextInputStyle.Paragraph)
.setRequired(true);

const firstActionRow = new ActionRowBuilder()
.addComponents(embedGeneratorInput);

modal.addComponents(firstActionRow);
this.some(modal)
} catch (err) {
console.log(err)
}

}
}
const { InteractionHandler, InteractionHandlerTypes } = require('@sapphire/framework');
const { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');

module.exports = class CreateEmbed extends InteractionHandler {
constructor(ctx, options) {
super(ctx, {
...options,
interactionHandlerType: InteractionHandlerTypes.Button
});
};

async run(interaction, result) {
await interaction.showModal(result);
}

async parse(interaction) {

if (interaction.customId !== 'setupEmbedBtn') {
console.log(interaction.customId)
this.none();
}

try {
const modal = new ModalBuilder()
.setCustomId('setupEmbedMdl')
.setTitle('Setup Embed')

const embedGeneratorInput = new TextInputBuilder()
.setCustomId('embedGeneratorInput')
.setLabel('Pase the json code here or the url')
.setMaxLength(4000)
.setStyle(TextInputStyle.Paragraph)
.setRequired(true);

const firstActionRow = new ActionRowBuilder()
.addComponents(embedGeneratorInput);

modal.addComponents(firstActionRow);
this.some(modal)
} catch (err) {
console.log(err)
}

}
}
Error:
14 replies
SIASapphire - Imagine a framework
Created by paulandrew on 12/1/2023 in #sapphire-support
Fetch reply from a command to button interaction
How can i fetch a reply from x command so i can edit the reply in y button interaction
8 replies
SIASapphire - Imagine a framework
Created by paulandrew on 11/10/2023 in #sapphire-support
Slash command not working
Idk whats wrong with it, theres no error in console or anything its just doesnt work. My code:
const { Command } = require('@sapphire/framework');
const { EmbedBuilder } = require('discord.js');
const { isMessageInstance } = require('@sapphire/discord.js-utilities');

module.exports = class PingCommand extends Command {
constructor(context, options) {
super(context, { ...options, });
}

registerApplicationCommands(registry) {
registry.registerChatInputCommand((builder) => {
builder
.setName('ping')
.setDescription(`Check the bot's response time with a quick ping command.`)
})
}

async chatInputRun(interaction) {
const msg = await interaction.reply({ content: 'Pinging...', ephemeral: true, fetchReply: true });

if (isMessageInstance(msg)) {
const restLatency = Math.floor(interaction.client.rest.ping)
const gatewayLatency = Math.floor(interaction.client.ws.ping)
const botLatency = Math.floor(msg.createdTimestamp - interaction.createdTimestamp)

return interaction.editReply({
content: `:ping_pong: **| Pong! Bot Latency:** \`\`\`${botLatency}ms\`\`\`\n:stopwatch: **| Gateway Latency:** \`\`\`${gatewayLatency}ms\`\`\`\n:zap: **| Rest Latency: \`\`\`${restLatency}ms\`\`\`**`
})
}

return interaction.editReply({
content: `Failed to retrieve ping :(`
})
}
}
const { Command } = require('@sapphire/framework');
const { EmbedBuilder } = require('discord.js');
const { isMessageInstance } = require('@sapphire/discord.js-utilities');

module.exports = class PingCommand extends Command {
constructor(context, options) {
super(context, { ...options, });
}

registerApplicationCommands(registry) {
registry.registerChatInputCommand((builder) => {
builder
.setName('ping')
.setDescription(`Check the bot's response time with a quick ping command.`)
})
}

async chatInputRun(interaction) {
const msg = await interaction.reply({ content: 'Pinging...', ephemeral: true, fetchReply: true });

if (isMessageInstance(msg)) {
const restLatency = Math.floor(interaction.client.rest.ping)
const gatewayLatency = Math.floor(interaction.client.ws.ping)
const botLatency = Math.floor(msg.createdTimestamp - interaction.createdTimestamp)

return interaction.editReply({
content: `:ping_pong: **| Pong! Bot Latency:** \`\`\`${botLatency}ms\`\`\`\n:stopwatch: **| Gateway Latency:** \`\`\`${gatewayLatency}ms\`\`\`\n:zap: **| Rest Latency: \`\`\`${restLatency}ms\`\`\`**`
})
}

return interaction.editReply({
content: `Failed to retrieve ping :(`
})
}
}
8 replies