Встраиваемая информация о сервере не отображается на сервере discord, только говорит, что взаимодействие не удалось и в терминале нет ошибки, как исправить?

#javascript #discord #discord.js #bots #embed

Вопрос:

Я пытался создать команду встраивания информации с помощью подкоманды «пользователь информации» и «информационный сервер». Когда я пытаюсь показать тег пользователя владельца во встраиваемых файлах , он отображается неопределенным, поэтому мне было предложено изменить get(ownerId) fetch его, но затем мне было предложено выполнить обещание. То же самое касается участника, где я пытался узнать, сколько ботов на сервере, он всегда показывает 1, тогда как их было 5. Теперь терминал не показывает ошибку, когда я выполняю команду info server, но в канале discord он показывает, что взаимодействие не удалось. Команда info user работает идеально. Как мне это исправить?

 const { SlashCommandBuilder } = require('@discordjs/builders'); const { MessageEmbed } = require("discord.js"); const moment = require("moment");  module.exports = {  data: new SlashCommandBuilder()  .setName('info')  .setDescription('returns info based on input')  .addSubcommand(subcommand =gt;  subcommand  .setName("user")  .setDescription("get the information of a member mentioned")  .addUserOption(option =gt; option.setName("member").setDescription("Tag a member")))  .addSubcommand(subcommand =gt;  subcommand  .setName("server")  .setDescription("info about this server")),  async execute(interaction, client, user, members) {  if (interaction.options.getSubcommand() === "user") {  const user = interaction.options.getUser("member");  if (user) {  const member = interaction.guild.members.cache.get(user.id)  const userEmbed = new MessageEmbed()  .setTitle(`${user.username}'s Information:`)  .setDescription(`This is a member in ${interaction.guild.name} :raised_hands:`)  .setAuthor(user.username, user.displayAvatarURL())  .setThumbnail(client.user.displayAvatarURL())  .addFields(  { name: `Username`, value: `This member's username is ${user.username}`, inline: true },   { name: `Tag`, value: `This member's tag is #${user.discriminator}`, inline: true },   { name: `Joined Discord`, value: new Date(user.createdTimestamp).toDateString(), inline: true },   { name: `Joined server`, value: new Date(member.joinedTimestamp).toDateString(), inline: true },   { name: `Is this member a bot?`, value: `${user.bot}`, inline: true },   { name: `Nickname`, value: member.nickname || "None", inline: true },   { name: `Role count`, value: `${member.roles.cache.size - 1}`, inline: true },   )  .setImage(user.displayAvatarURL())  .setTimestamp()  .setColor("#F2A4D3")  .setFooter(client.user.tag, client.user.displayAvatarURL());   if (interaction.guild.members.cache.get(user.id).roles.cache.has("869759848747786262")) {  userEmbed.addFields({ name: `Boost status`, value: `This member has been boosting our server since ${new Date(member.premiumSinceTimestamp).toDateString()} :grin:`, inline: true }, { name: `u200B`, value: `u200B`, inline: true })  } else {  userEmbed.addFields({ name: `Boost status`, value: `This noob isn't boosting our server :neutral_face:`, inline: true }, { name: `u200B`, value: `u200B`, inline: true })  }  await interaction.reply({ embeds: [userEmbed] });  } else {  const user = interaction.user  const member = interaction.guild.members.cache.get(user.id)  const selfEmbed = new MessageEmbed()  .setTitle(`Your User Information (narcissistic much??):`)  .setDescription(`You're in ${interaction.guild.name} :raised_hands:`)  .setAuthor(user.username, user.displayAvatarURL())  .setThumbnail(client.user.displayAvatarURL())  .addFields(  { name: `Username`, value: `Your username is ${user.username}`, inline: true },   { name: `Tag`, value: `Your tag is #${user.discriminator}`, inline: true },   { name: `Joined Discord`, value: `You joined discord on ${new Date(user.createdTimestamp).toDateString()}`, inline: true },   { name: `Joined server`, value: `You joined this server on ${new Date(member.joinedTimestamp).toDateString()}`, inline: true },   { name: `Are you a bot?`, value: `${user.bot}`, inline: true },   { name: `Nickname`, value: member.nickname || "None", inline: true },   { name: `Role count`, value: `${member.roles.cache.size - 1}`, inline: true },   )  .setImage(user.displayAvatarURL())  .setTimestamp()  .setColor("#F2A4D3")  .setFooter(client.user.tag, client.user.displayAvatarURL());   if (interaction.guild.members.cache.get(user.id).roles.cache.has("869759848747786262")) {  selfEmbed.addFields({ name: `Boost status`, value: `OOO you've been boosting our server since ${new Date(member.premiumSinceTimestamp).toDateString()}, so swag :grin:`, inline: true }, { name: `u200B`, value: `u200B`, inline: true })  } else {  selfEmbed.addFields({ name: `Boost status`, value: `You're not boosting our server, get nitro and boost it right now you idiot :neutral_face:`, inline: true }, { name: `u200B`, value: `u200B`, inline: true })  }  await interaction.reply({ embeds: [selfEmbed] });  //await interaction.reply(`Username: ${user.username}nYour ID: ${user.id}`);  }  } else if (interaction.options.getSubcommand() === "server") {  const server = interaction.guild;  const user = await client.users.fetch(interaction.guild.ownerId);  const members = await interaction.guild.members.fetch();  const channels = interaction.guild.channels.cache;  const emojis = interaction.guild.emojis.cache;  const date = new Date(interaction.guild.createdTimestamp).toDateString();   const serverEmbed = new MessageEmbed()  .setTitle(`${server.name}'s Information`)  .setAuthor(server.name, server.iconURL())  .setThumbnail(client.user.displayAvatarURL())  .addFields(  { name: `Owner`, value: `lt;@${interaction.guild.ownerId}gt;, ${user.tag}` },  { name: `Server ID`, value: `${server.id}`, inline: true },  { name: `Total Members`, value: `${server.memberCount}`, inline: true },  //{ name: `Online`, value: `${server.members.cache.filter(member =gt; member.user.presence.status = "online").size}`, inline: true},  { name: `Time created`, value: `${moment(interaction.guild.createdTimestamp).format("LT")}, ${moment(interaction.guild.createdTimestamp).format("LL")}, ${moment(interaction.guild.createdTimestamp).fromNow()}`},  //{ name: `Time created`, value: `${moment(interaction.guild.createdTimestamp.toLocale()).format("LT)")}, ${moment(date).format("LL")}`},  { name: `Emojis`, value: `${emojis.size}`},  {name: `Regular emojis`, value: `${emojis.filter(emoji =gt; !emoji.animated).size}`},  {name: `Animated emojis`, value: `${emojis.filter(emoji =gt; emoji.animated).size}`},  {name: `Human`, value: `${members.filter(member =gt; !member.user.bot).size}`},  {name: `Bots`, value: `${members.filter(member =gt; member.user.bot).size}`},  {name: `Text channels`, value: `${channels.filter(channel =gt; channel.type === "text").size}`},  {name: `Voice channels`, value: `${channels.filter(channel =gt; channel.type === "voice").size}`},  {name: `Boost`, value: `${interaction.guild.premiumSubscriptionCount || "0"}`},  {name: `Online`, value: `${members.filter(member =gt; member.presence.status === "online")}`},  )  .setImage(server.iconURL())  .setTimestamp()  .setColor("#F2A4D3")  .setFooter(client.user.tag, client.user.displayAvatarURL());  await interaction.reply({ embeds: [serverEmbed] });  } else {  await interaction.reply("No sub command was used.");  }  }, };