const { MessageEmbed } = require("discord.js"); const moment = require("moment"); const filterLevels = { DISABLED: "Off", MEMBERS_WITHOUT_ROLES: "No Role", ALL_MEMBERS: "Everyone", }; const verificationLevels = { NONE: "None", LOW: "Low", MEDIUM: "Medium", HIGH: "High", VERY_HIGH: "Very High", }; const regions = { brazil: "Brazil", europe: "Europe", hongkong: "Hong Kong", india: "India", japan: "Japan", russia: "Russia", singapore: "Singapore", southafrica: "South Africa", sydeny: "Sydeny", "us-central": "US Central", "us-east": "US East", "us-west": "US West", "us-south": "US South", }; module.exports = { name: "serverinfo", description: "Check the info of the server", category: "Information", type: "CHAT_INPUT", options: [ { type: 3, name: "server", description: "The server you want to see (Paste Server ID)", required: false, }, ], run: async (client, interaction, args, utils) => { try { const g = client.guilds.cache.get(args[0]) || interaction.guild; const vanityCode = g.vanityURLCode; let vanityInvite = `https://discord.gg/${vanityCode}`; if (vanityCode === null) vanityInvite = "No custom URL"; const members = g.members.cache; const roles = g.roles.cache .sort((a, b) => b.position - a.position) .map(role => role.toString()); const owner = await g.fetchOwner(); const voiceChannel = g.channels.cache.filter( ch => ch.type === "GUILD_VOICE" ).size; const textChannel = g.channels.cache.filter( ch => ch.type === "GUILD_TEXT" ).size; const categoryChannel = g.channels.cache.filter( ch => ch.type === "GUILD_CATEGORY" ).size; const embed = new MessageEmbed() .setTimestamp() .setTitle("**Server Information**") .setAuthor(`${g.name}`, g.iconURL({ dynamic: true })) .setColor(client.color) .setThumbnail(g.iconURL({ dynamic: true, size: 1024 })) .addField(`๐ŸŽซ Name of server:`, g.name, true) .addField(`๐Ÿ†” ID of server`, g.id, true) .addField(`๐Ÿ”— Vanity Link`, `${vanityInvite}`, true) .addField("๐Ÿ‘ฉโ€๐Ÿ’ป Owner", `${owner}`, true) .addField("๐Ÿ‘ฉโ€๐Ÿ’ป Owner ID", `\`${owner.id}\``, true) .addField(`๐Ÿ‘ฅ No. of Members`, g.memberCount.toString(), true) .addField( `๐Ÿค– No. of Bots:`, members.filter(member => member.user.bot).size.toString(), true ) .addField( `๐Ÿšถ Humans:`, members.filter(member => !member.user.bot).size.toString(), true ) .addField( "๐Ÿงท Channels", `#๏ธโƒฃ ${textChannel} **Text** Channels\n ๐Ÿ”Š ${voiceChannel} **Voice** Channels\n ๐Ÿ“ ${categoryChannel} **Categories**`, true ) .addField(`๐Ÿ˜— Emojis:`, g.emojis.cache.size.toString(), true) .addField( `๐Ÿ‘ป Animated Emoji\'s:`, g.emojis.cache.filter(emoji => emoji.animated).size.toString(), true ) .addField( `๐Ÿ‘” Roles [${roles.length}]`, roles.length < 10 ? roles.join(" **|** ") : roles.length > 10 ? `${roles.slice(0, 10).join(" **|** ")}\n+${ roles.length - 10 } roles...` : "None", true ) .addField(`๐Ÿ“ƒ Description`, g.description || "No Description", true) .addField( `โ™จ Boost`, `Tier: ${ g.premiumTier == "TIER_3" ? "3" : g.premiumTier == "TIER_2" ? "2" : g.premiumTier == "TIER_1" ? "1" : "0" }\nCount: ${g.premiumSubscriptionCount || "0"}`, true ) .addField( "๐Ÿ’ข Explicit Filter", filterLevels[g.explicitContentFilter], true ) .addField( `๐Ÿšง Verification Level`, verificationLevels[g.verificationLevel], true ) .addField( "๐Ÿ—บ Community Features", utils.fixFeatures(g.features) || "No Community Features", true ) .addField("๐Ÿ‘จ๐Ÿปโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿป Partnered", g.partnered ? "Yes" : "No", true) .addField("โœ… Verified", g.verified ? "Yes" : "No", true) .addField( `๐Ÿ“… Created at`, `${moment(g.createdTimestamp).format("LL")} ${moment( g.createdTimestamp ).format("LTS")} (${moment(g.createdTimestamp).fromNow()})`, true ) .setURL(client.web) .setFooter(`Made by ${client.author}`); await interaction.followUp({ embeds: [embed] }); } catch (e) { console.log(e); } }, };