From 610c79e70ed03e27314580354d63f51af56f2602 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Wed, 3 Mar 2021 16:53:07 -0700 Subject: [PATCH] add to n?ui and add n?si --- commands/misc/serverinfo.js | 31 +++++++++++++++++++++++++++++++ commands/misc/userinfo.js | 14 ++++++++------ 2 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 commands/misc/serverinfo.js diff --git a/commands/misc/serverinfo.js b/commands/misc/serverinfo.js new file mode 100644 index 0000000..8e865bb --- /dev/null +++ b/commands/misc/serverinfo.js @@ -0,0 +1,31 @@ +const Discord = require("discord.js"); +const moment = require('moment'); + +module.exports = { + name: "serverinfo", + aliases: ['si'], + help: "Displays your server's information", + meta: { + category: 'Misc', + description: "Displays your server's information", + syntax: '`serverinfo`', + extra: null, + guildOnly: true + }, + execute(message, msg, args, cmd, prefix, mention, client) { + let now = new Date(); + return message.channel.send(new Discord.MessageEmbed() + .setAuthor("Server info", message.author.avatarURL()) + .setTitle(message.guild.name) + .setThumbnail(message.guild.iconURL({size: 2048})) + .setDescription(`Name: \`${message.guild.name}\`\n\nOwner: <@${message.guild.ownerID}>\nRegion: ${message.guild.region}\nIcon: [URL](${message.guild.iconURL({size: 2048})})`) + .addField("Members", `${message.guild.members.cache.size}\n[${message.guild.members.cache.filter(m => !client.users.cache.get(m.id).bot).size} Humans | ${message.guild.members.cache.filter(m => client.users.cache.get(m.id).bot).size} Bots]\n\nOnline: ${message.guild.members.cache.filter(m => client.users.cache.get(m.id).presence.status === "online").size} | Idle: ${message.guild.members.cache.filter(m => client.users.cache.get(m.id).presence.status === "idle").size} | Do not Disturb: ${message.guild.members.cache.filter(m => client.users.cache.get(m.id).presence.status === "dnd").size}`) + .addField("Channels", `${message.guild.channels.cache.size}\n[${message.guild.channels.cache.filter(ch => ch.type === "text").size} Text | ${message.guild.channels.cache.filter(ch => ch.type === "voice").size} Voice]`, true) + .addField("Roles", `${message.guild.roles.cache.size} (you have ${message.member.roles.cache.size})\nYour highest is <@&${message.member.roles.highest.id}>`, true) + .addField("Other Info", `Server created roughly **${moment(message.guild.createdAt).fromNow()}**\n\nYou joined ${moment(message.member.joinedAt).fromNow()} (Member for **${Math.round(((now.getTime() - new Date(message.member.joinedAt.getTime()).getTime()) / (new Date(message.guild.createdAt).getTime() - now.getTime())) * -100)}%** of server lifetime)`) + .setColor('c375f0') + .setFooter("Natsuki") + .setTimestamp() + ); + } +}; \ No newline at end of file diff --git a/commands/misc/userinfo.js b/commands/misc/userinfo.js index d9c59b9..df73b00 100644 --- a/commands/misc/userinfo.js +++ b/commands/misc/userinfo.js @@ -17,8 +17,8 @@ module.exports = { let person = message.guild ? mention ? message.guild.members.cache.get(mention.id) : args[0] ? message.guild.members.cache.has(args[0]) ? message.guild.members.cache.get(args[0]) : message.member : message.member : message.author; let name = message.guild ? person.displayName : person.username; let tu = await UserData.findOne({uid: person.id}); - if (!tu) {return message.channel.send("I don't have any data on that user yet.");} - let infoembed= new Discord.MessageEmbed() + let now = new Date(); + let infoembed = new Discord.MessageEmbed() .setTitle(`User Info for ${name}`) .setDescription(`Requested by ${message.guild ? message.member.displayName : message.author.username}`) .setThumbnail(client.users.cache.get(person.id).avatarURL({size: 2048})) @@ -29,14 +29,16 @@ module.exports = { .setTimestamp(); if (message.guild) { - infoembed.addField('In Server Since', moment(person.joinedAt).fromNow(), true) - .addField('Highest Role in Server', `<@&${person.roles.highest.id}>`, true) + infoembed.addField('In Server Since', `${moment(person.joinedAt).fromNow()}${!moment(person.joinedAt).fromNow().includes('days') ? ` | ${Math.floor((new Date().getTime() - person.joinedAt.getTime()) / (60 * 60 * 24 * 1000))} days` : ''}\nMember for **${Math.round(((now.getTime() - new Date(message.member.joinedAt.getTime()).getTime()) / (new Date(message.guild.createdAt).getTime() - now.getTime())) * -100)}%** of server lifetime`, false) + .addField('Roles', `**${person.roles.cache.size}** roles | [${person.roles.cache.size}/${message.guild.roles.cache.size}] - ${Math.round((person.roles.cache.size / message.guild.roles.cache.size) * 100)}%\nHighest: ${person.roles.highest ? `<@&${person.roles.highest.id}>` : 'No roles!'}`, true) + if (message.guild.ownerId === person.id) {infoembed.addField("Extra", "User is the server's owner!");} + else if (person.permissions.has("ADMINISTRATOR")) {infoembed.addField("Extra", "User is an admin! Watch out :eyes:");} } if (tu) { infoembed.addField('Natsuki Commands Executed', tu.commands) - .addField('Natsuki Staff Level', tu.support ? 'Support; Answers tickets and help queries' : tu.staff ? 'Staff; Support but with maintenance permissions' : tu.admin ? 'Admin; Audit access to the bot' : tu.developer ? 'Developer' : 'Member; Does not have a staff rank.') - .addField('Donator?', tu.developer ? `Well, ${name} makes me work, so they're a supporter in my book!` : tu.donator ? 'Yes! They have donated or supported me in the past!' : 'No'); + .addField('Donator?', tu.developer ? `Well, ${name} makes me work, so they're a supporter in my book!` : tu.donator ? 'Yes! They have donated or supported me in the past!' : 'No', true) + .addField('Natsuki Staff Level', tu.developer ? 'Developer' : tu.admin ? 'Admin; Audit access to the bot' : tu.staff ? 'Staff; Support but with maintenance permissions' : tu.support ? 'Support; Answers tickets and help queries' : 'Member; Does not have a staff rank.', true); } return message.channel.send(infoembed); }