mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-24 14:14:59 +05:00
update info
This commit is contained in:
parent
3898cbcf2d
commit
1aa2c7bd22
1 changed files with 27 additions and 25 deletions
|
@ -60,13 +60,13 @@ class Info extends BaseCommand {
|
|||
|
||||
if (command === "user") {
|
||||
const member = interaction.options.getMember("user") || interaction.member;
|
||||
const embed = getUserInfo(interaction, member);
|
||||
const embed = getUserInfo(client, interaction, member);
|
||||
|
||||
return interaction.editReply({
|
||||
embeds: [embed],
|
||||
});
|
||||
} else {
|
||||
const embed = await getServerInfo(interaction);
|
||||
const embed = await getServerInfo(client, interaction);
|
||||
|
||||
return interaction.editReply({
|
||||
embeds: [embed],
|
||||
|
@ -77,40 +77,41 @@ class Info extends BaseCommand {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/Client")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @returns {Promise<import("discord.js").Embed>} Embed containing information about the guild
|
||||
*/
|
||||
async function getServerInfo(interaction) {
|
||||
async function getServerInfo(client, interaction) {
|
||||
const { guild } = interaction;
|
||||
|
||||
await guild.members.fetch();
|
||||
const owner = await guild.fetchOwner();
|
||||
|
||||
const embed = interaction.client.embed({
|
||||
const embed = client.embed({
|
||||
author: guild.name,
|
||||
thumbnail: guild.iconURL(),
|
||||
fields: [
|
||||
{
|
||||
name: interaction.client.customEmojis.title + interaction.translate("common:NAME"),
|
||||
name: client.customEmojis.title + interaction.translate("common:NAME"),
|
||||
value: guild.name,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: interaction.client.customEmojis.calendar + interaction.translate("common:CREATION"),
|
||||
name: client.customEmojis.calendar + interaction.translate("common:CREATION"),
|
||||
value: `<t:${Math.floor(guild.createdTimestamp / 1000)}:D>`,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: interaction.client.customEmojis.users + interaction.translate("common:MEMBERS"),
|
||||
name: client.customEmojis.users + interaction.translate("common:MEMBERS"),
|
||||
value:
|
||||
`${guild.members.cache.filter(m => !m.user.bot).size} ${interaction.client.functions.getNoun(
|
||||
`${guild.members.cache.filter(m => !m.user.bot).size} ${client.functions.getNoun(
|
||||
guild.members.cache.filter(m => !m.user.bot).size,
|
||||
interaction.translate("misc:NOUNS:MEMBERS:1"),
|
||||
interaction.translate("misc:NOUNS:MEMBERS:2"),
|
||||
interaction.translate("misc:NOUNS:MEMBERS:5"),
|
||||
)}` +
|
||||
"\n" +
|
||||
`${guild.members.cache.filter(m => m.user.bot).size} ${interaction.client.functions.getNoun(
|
||||
`${guild.members.cache.filter(m => m.user.bot).size} ${client.functions.getNoun(
|
||||
guild.members.cache.filter(m => m.user.bot).size,
|
||||
interaction.translate("misc:NOUNS:BOTS:1"),
|
||||
interaction.translate("misc:NOUNS:BOTS:2"),
|
||||
|
@ -119,43 +120,43 @@ async function getServerInfo(interaction) {
|
|||
inline: true,
|
||||
},
|
||||
{
|
||||
name: interaction.client.customEmojis.afk + interaction.translate("general/serverinfo:AFK_CHANNEL"),
|
||||
name: client.customEmojis.afk + interaction.translate("general/serverinfo:AFK_CHANNEL"),
|
||||
value: guild.afkChannel?.toString() || interaction.translate("common:MISSING"),
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: interaction.client.customEmojis.id + interaction.translate("common:SERVER_ID"),
|
||||
name: client.customEmojis.id + interaction.translate("common:SERVER_ID"),
|
||||
value: guild.id,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: interaction.client.customEmojis.crown + interaction.translate("common:OWNER"),
|
||||
name: client.customEmojis.crown + interaction.translate("common:OWNER"),
|
||||
value: owner.toString(),
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: interaction.client.customEmojis.boost + interaction.translate("general/serverinfo:BOOSTS"),
|
||||
name: client.customEmojis.boost + interaction.translate("general/serverinfo:BOOSTS"),
|
||||
value: guild.premiumSubscriptionCount?.toString() || "0",
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: interaction.client.customEmojis.channels + interaction.translate("common:CHANNELS"),
|
||||
name: client.customEmojis.channels + interaction.translate("common:CHANNELS"),
|
||||
value:
|
||||
`${guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size} ${interaction.client.functions.getNoun(
|
||||
`${guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size} ${client.functions.getNoun(
|
||||
guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size,
|
||||
interaction.translate("misc:NOUNS:TEXT:1"),
|
||||
interaction.translate("misc:NOUNS:TEXT:2"),
|
||||
interaction.translate("misc:NOUNS:TEXT:5"),
|
||||
)}` +
|
||||
"\n" +
|
||||
`${guild.channels.cache.filter(c => c.type === ChannelType.GuildVoice).size} ${interaction.client.functions.getNoun(
|
||||
`${guild.channels.cache.filter(c => c.type === ChannelType.GuildVoice).size} ${client.functions.getNoun(
|
||||
guild.channels.cache.filter(c => c.type === ChannelType.GuildVoice).size,
|
||||
interaction.translate("misc:NOUNS:VOICE:1"),
|
||||
interaction.translate("misc:NOUNS:VOICE:2"),
|
||||
interaction.translate("misc:NOUNS:VOICE:5"),
|
||||
)}` +
|
||||
"\n" +
|
||||
`${guild.channels.cache.filter(c => c.type === ChannelType.GuildCategory).size} ${interaction.client.functions.getNoun(
|
||||
`${guild.channels.cache.filter(c => c.type === ChannelType.GuildCategory).size} ${client.functions.getNoun(
|
||||
guild.channels.cache.filter(c => c.type === ChannelType.GuildCategory).size,
|
||||
interaction.translate("misc:NOUNS:CATEGORY:1"),
|
||||
interaction.translate("misc:NOUNS:CATEGORY:2"),
|
||||
|
@ -171,12 +172,13 @@ async function getServerInfo(interaction) {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/Client")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {import("discord.js").Member} member
|
||||
* @returns {import("discord.js").Embed} Embed containing information about the user
|
||||
*/
|
||||
function getUserInfo(interaction, member) {
|
||||
const embed = interaction.client.embed({
|
||||
function getUserInfo(client, interaction, member) {
|
||||
const embed = client.embed({
|
||||
author: {
|
||||
name: `${member.user.getUsername()} (${member.id})`,
|
||||
iconURL: member.displayAvatarURL(),
|
||||
|
@ -189,32 +191,32 @@ function getUserInfo(interaction, member) {
|
|||
inline: true,
|
||||
},
|
||||
{
|
||||
name: interaction.client.customEmojis.pencil + " " + interaction.translate("common:NICKNAME"),
|
||||
name: client.customEmojis.pencil + " " + interaction.translate("common:NICKNAME"),
|
||||
value: member.nickname || interaction.translate("general/userinfo:NO_NICKNAME"),
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: interaction.client.customEmojis.bot + " " + interaction.translate("common:ROBOT"),
|
||||
name: client.customEmojis.bot + " " + interaction.translate("common:ROBOT"),
|
||||
value: member.user.bot ? interaction.translate("common:YES") : interaction.translate("common:NO"),
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: interaction.client.customEmojis.calendar + " " + interaction.translate("common:CREATION"),
|
||||
name: client.customEmojis.calendar + " " + interaction.translate("common:CREATION"),
|
||||
value: `<t:${Math.floor(member.user.createdTimestamp / 1000)}:D>`,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: interaction.client.customEmojis.calendar2 + " " + interaction.translate("common:JOINED"),
|
||||
name: client.customEmojis.calendar2 + " " + interaction.translate("common:JOINED"),
|
||||
value: `<t:${Math.floor(member.joinedTimestamp / 1000)}:D>`,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: interaction.client.customEmojis.color + " " + interaction.translate("common:COLOR"),
|
||||
name: client.customEmojis.color + " " + interaction.translate("common:COLOR"),
|
||||
value: member.displayHexColor,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: interaction.client.customEmojis.roles + " " + interaction.translate("common:ROLES"),
|
||||
name: client.customEmojis.roles + " " + interaction.translate("common:ROLES"),
|
||||
value:
|
||||
member.roles.size > 10
|
||||
? member.roles.cache.map(r => r).filter(r => r.id !== interaction.guild.roles.everyone.id).slice(0, 10).join(", ") + " " +
|
||||
|
|
Loading…
Reference in a new issue