Skip to content

Better serverinfo command #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions improved-commands/serverinfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const Discord = require("discord.js");

module.exports.run = async (bot, message, args) => {
function checkDays(date) {
let now = new Date();
let diff = now.getTime() - date.getTime();
let days = Math.floor(diff / 86400000);
return days + (days == 1 ? " day" : " days") + " ago";
};
let verifLevels = ["None", "Low", "Medium", "(╯°□°)╯︵ ┻━┻", "┻━┻ミヽ(ಠ益ಠ)ノ彡┻━┻"];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Epic

let region = {
Comment on lines +1 to +11

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cood

"brazil": ":flag_br: Brazil",
"eu-central": ":flag_eu: Central Europe",
"singapore": ":flag_sg: Singapore",
"us-central": ":flag_us: U.S. Central",
"sydney": ":flag_au: Sydney",
"us-east": ":flag_us: U.S. East",
"us-south": ":flag_us: U.S. South",
"us-west": ":flag_us: U.S. West",
"eu-west": ":flag_eu: Western Europe",
"vip-us-east": ":flag_us: VIP U.S. East",
"london": ":flag_gb: London",
"amsterdam": ":flag_nl: Amsterdam",
"hongkong": ":flag_hk: Hong Kong",
"russia": ":flag_ru: Russia",
"southafrica": ":flag_za: South Africa"
};
const embed = new Discord.RichEmbed()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const embed = new Discord.MessageEmbed() // Discord V12

.setAuthor(message.guild.name, message.guild.iconURL)
.addField("Name", message.guild.name, true)
.addField("ID", message.guild.id, true)
.addField("Owner", `${message.guild.owner.user.username}#${message.guild.owner.user.discriminator}`, true)
.addField("Region", region[message.guild.region], true)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.addField('Server region', message.guild.region, true)

.addField("Total | Humans | Bots", `${message.guild.members.size} | ${message.guild.members.filter(member => !member.user.bot).size} | ${message.guild.members.filter(member => member.user.bot).size}`, true)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.addField("Total | Humans | Bots", `${message.guild.members.size} | ${message.guild.members.filter(member => !member.user.bot).size} | ${message.guild.members.filter(member => member.user.bot).size}`, true)
.addField("Total | Humans | Bots", `${message.guild.members.cache.size} | ${message.guild.members.cache.filter(member => !member.user.bot).size} | ${message.guild.members.cache.filter(member => member.user.bot).size}`, true)

For Discord.js V12

.addField("Verification Level", verifLevels[message.guild.verificationLevel], true)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.addField("Verification Level", verifLevels[message.guild.verificationLevel], true)
.addField("Verification Level", message.guild.verificationLevel, true)

For Discord.js V12

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

گوزززز

.addField("Channels", message.guild.channels.size, true)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.addField("Channels", message.guild.channels.size, true)
.addField("Channels", message.guild.channels.cache.size, true)

For Discord.js V12

.addField("Roles", message.guild.roles.size, true)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.addField("Roles", message.guild.roles.size, true)
.addField("Roles", message.guild.roles.cache.size, true)

For Discord.js V12

.addField("Creation Date", `${message.channel.guild.createdAt.toUTCString().substr(0, 16)} (${checkDays(message.channel.guild.createdAt)})`, true)
.setThumbnail(message.guild.iconURL)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.setThumbnail(message.guild.iconURL)
.setThumbnail(message.guild.iconURL())

For Discord.js V12

message.channel.send({embed});
}

module.exports.help = {
name:"serverinfo"
}