Sorry if this is off topic.

Sorry if this is off topic, I would like to ask you to evaluate the code and, if possible, suggest what to work on.
const { EmbedBuilder } = require('discord.js');

const unPermissionEmb = (interaction) => new EmbedBuilder()
.setColor('#ff0000')
.setTitle('У вас недостаточно прав для использования этой команды!')
.setDescription('Если это баг сообщите кому-нибудь из персонала.')
.setThumbnail(interaction.user.displayAvatarURL().toString());

const CommandHandlerErrorEmb = (interaction) => new EmbedBuilder()
.setColor('#ff0000')
.setTitle('Ошибка при использовании этой команды!')
.addFields({ name: 'Команда: ', value: interaction.commandName, inline: true })
.setDescription ('Если это баг сообщите кому-нибудь из персонала.')
.setThumbnail(interaction.user.displayAvatarURL().toString());

module.exports = { unPermissionEmb, CommandHandlerErrorEmb };
const { EmbedBuilder } = require('discord.js');

const unPermissionEmb = (interaction) => new EmbedBuilder()
.setColor('#ff0000')
.setTitle('У вас недостаточно прав для использования этой команды!')
.setDescription('Если это баг сообщите кому-нибудь из персонала.')
.setThumbnail(interaction.user.displayAvatarURL().toString());

const CommandHandlerErrorEmb = (interaction) => new EmbedBuilder()
.setColor('#ff0000')
.setTitle('Ошибка при использовании этой команды!')
.addFields({ name: 'Команда: ', value: interaction.commandName, inline: true })
.setDescription ('Если это баг сообщите кому-нибудь из персонала.')
.setThumbnail(interaction.user.displayAvatarURL().toString());

module.exports = { unPermissionEmb, CommandHandlerErrorEmb };
const fs = require('node:fs');
const path = require('node:path');
const {Client, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, Events, SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ModalBuilder, ModalSubmitInteraction, TextInputBuilder, TextInputStyle } = require('discord.js');
const { PingEmb } = require('../../embeds/pingEmb.js');

const hierarchyPath = path.join(__dirname, '..', '..', 'configs', 'hierarchy.json');
const hierarchy = JSON.parse(fs.readFileSync(hierarchyPath, 'utf-8'));
const userRole = hierarchy.find(role => role.name === 'User');

module.exports = {
data: new SlashCommandBuilder()
.setName("ping")
.setDescription('Отправит "Понг!"')
.setNameLocalizations({
ru: 'пинг'
}),
hierarchy: userRole.permission,
async execute (interaction, client) {
interaction.reply({
embeds: [ PingEmb(interaction) ],
ephemeral: true
});
}
}
const fs = require('node:fs');
const path = require('node:path');
const {Client, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, Events, SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ModalBuilder, ModalSubmitInteraction, TextInputBuilder, TextInputStyle } = require('discord.js');
const { PingEmb } = require('../../embeds/pingEmb.js');

const hierarchyPath = path.join(__dirname, '..', '..', 'configs', 'hierarchy.json');
const hierarchy = JSON.parse(fs.readFileSync(hierarchyPath, 'utf-8'));
const userRole = hierarchy.find(role => role.name === 'User');

module.exports = {
data: new SlashCommandBuilder()
.setName("ping")
.setDescription('Отправит "Понг!"')
.setNameLocalizations({
ru: 'пинг'
}),
hierarchy: userRole.permission,
async execute (interaction, client) {
interaction.reply({
embeds: [ PingEmb(interaction) ],
ephemeral: true
});
}
}
At the moment I am training in code layering and structurization, I also try to optimize as much as possible, I know few functions, but they will tell you something.
1 Reply
d.js toolkit
d.js toolkit9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Want results from more Discord servers?
Add your server