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
};