Paginated Message not working

When I run this code, it says "This interaction failed" without any error.
const { PaginatedMessage } = require('@sapphire/discord.js-utilities');
const BeemoCommand = require('../../../lib/structures/commands/BeemoCommand');
const { EmbedBuilder } = require('discord.js');
const { color, emojis } = require('../../../config');
const Guild = require('../../../lib/schemas/blacklist');
const { PermissionLevels } = require('../../../lib/types/Enums');

class UserCommand extends BeemoCommand {
constructor(context, options) {
super(context, {
...options,
permissionLevel: PermissionLevels.BotOwner,
description: 'A command that uses paginated messages.',
});
}

/**
* @param {BeemoCommand.Registry} registry
*/
registerApplicationCommands(registry) {
registry.registerChatInputCommand((builder) =>
builder //
.setName('blacklist-list')
.setDescription(this.description))
}

async messageRun(interaction) {
const blacklistedGuilds = await Guild.find();

if (blacklistedGuilds.length === 0) {
return await interaction.reply(`${emojis.custom.fail} No servers have been **detected** in my blacklist!`);
}

const paginatedMessage = new PaginatedMessage({
template: new EmbedBuilder()
.setColor(`${color.default}`)
.setFooter({ text: 'Page 1/1' })
});

blacklistedGuilds.forEach(guild => {
paginatedMessage.addPageEmbed(embed =>
embed
.setTitle(`Blacklisted Server: ${guild.guildId}`)
.setDescription(`Reason: ${guild.reason}`)
);
});

await paginatedMessage.run(interaction);
}
}

module.exports = {
UserCommand
};
const { PaginatedMessage } = require('@sapphire/discord.js-utilities');
const BeemoCommand = require('../../../lib/structures/commands/BeemoCommand');
const { EmbedBuilder } = require('discord.js');
const { color, emojis } = require('../../../config');
const Guild = require('../../../lib/schemas/blacklist');
const { PermissionLevels } = require('../../../lib/types/Enums');

class UserCommand extends BeemoCommand {
constructor(context, options) {
super(context, {
...options,
permissionLevel: PermissionLevels.BotOwner,
description: 'A command that uses paginated messages.',
});
}

/**
* @param {BeemoCommand.Registry} registry
*/
registerApplicationCommands(registry) {
registry.registerChatInputCommand((builder) =>
builder //
.setName('blacklist-list')
.setDescription(this.description))
}

async messageRun(interaction) {
const blacklistedGuilds = await Guild.find();

if (blacklistedGuilds.length === 0) {
return await interaction.reply(`${emojis.custom.fail} No servers have been **detected** in my blacklist!`);
}

const paginatedMessage = new PaginatedMessage({
template: new EmbedBuilder()
.setColor(`${color.default}`)
.setFooter({ text: 'Page 1/1' })
});

blacklistedGuilds.forEach(guild => {
paginatedMessage.addPageEmbed(embed =>
embed
.setTitle(`Blacklisted Server: ${guild.guildId}`)
.setDescription(`Reason: ${guild.reason}`)
);
});

await paginatedMessage.run(interaction);
}
}

module.exports = {
UserCommand
};
What I am trying to do: Look, what I'm trying to do is to make it so there is more than 1 server in an embed and buttons that goes left and right. Here is an example of how the embeds should look like: šŸš« Blacklisted Servers (1st Server ID) (Reason of Blacklist) ----------------------- (2nd Server ID) (Reason of Blacklist) and so on.
Solution:
Change messageRun for chatInputRun. You're mixing message based and slash commands.
Jump to solution
4 Replies
Solution
Favna
Favnaā€¢8mo ago
Change messageRun for chatInputRun. You're mixing message based and slash commands.
Wxrning
Wxrningā€¢8mo ago
Thank you, one thing though. How can I mke it add buttons?
Wxrning
Wxrningā€¢8mo ago
šŸ‘šŸ½
Want results from more Discord servers?
Add your server