Utility: add more info to !server, prettify the embed a bit
This commit is contained in:
parent
244a523da1
commit
6cde008f36
1 changed files with 21 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
import { decorators as d } from "knub";
|
import { decorators as d } from "knub";
|
||||||
import { Channel, EmbedOptions, Member, Message, Role, TextChannel, User, VoiceChannel } from "eris";
|
import { CategoryChannel, Channel, EmbedOptions, Member, Message, Role, TextChannel, User, VoiceChannel } from "eris";
|
||||||
import {
|
import {
|
||||||
channelMentionRegex,
|
channelMentionRegex,
|
||||||
chunkArray,
|
chunkArray,
|
||||||
|
@ -508,6 +508,7 @@ export class UtilityPlugin extends ZeppelinPlugin {
|
||||||
|
|
||||||
const embed: EmbedOptions = {
|
const embed: EmbedOptions = {
|
||||||
fields: [],
|
fields: [],
|
||||||
|
color: parseInt("6b80cf", 16),
|
||||||
};
|
};
|
||||||
|
|
||||||
embed.thumbnail = { url: this.guild.iconURL };
|
embed.thumbnail = { url: this.guild.iconURL };
|
||||||
|
@ -518,26 +519,35 @@ export class UtilityPlugin extends ZeppelinPlugin {
|
||||||
round: true,
|
round: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const owner = this.bot.users.get(this.guild.ownerID);
|
||||||
|
const ownerName = owner ? `${owner.username}#${owner.discriminator}` : "Unknown#0000";
|
||||||
|
|
||||||
embed.fields.push({
|
embed.fields.push({
|
||||||
name: "Server information",
|
name: `Server information - ${this.guild.name}`,
|
||||||
value:
|
value:
|
||||||
trimLines(`
|
trimLines(`
|
||||||
Created: ${serverAge} ago (${createdAt.format("YYYY-MM-DD[T]HH:mm:ss")})
|
Created: **${serverAge} ago** (${createdAt.format("YYYY-MM-DD[T]HH:mm:ss")})
|
||||||
Members: ${this.guild.memberCount}
|
Owner: **${ownerName}** (${this.guild.ownerID})
|
||||||
|
Large: **${this.guild.large ? "yes" : "no"}**
|
||||||
|
Voice region: **${this.guild.region}**
|
||||||
${this.guild.features.length > 0 ? "Features: " + this.guild.features.join(", ") : ""}
|
${this.guild.features.length > 0 ? "Features: " + this.guild.features.join(", ") : ""}
|
||||||
`) + embedPadding,
|
`) + embedPadding,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const categories = this.guild.channels.filter(channel => channel instanceof CategoryChannel);
|
||||||
const textChannels = this.guild.channels.filter(channel => channel instanceof TextChannel);
|
const textChannels = this.guild.channels.filter(channel => channel instanceof TextChannel);
|
||||||
const voiceChannels = this.guild.channels.filter(channel => channel instanceof VoiceChannel);
|
const voiceChannels = this.guild.channels.filter(channel => channel instanceof VoiceChannel);
|
||||||
|
|
||||||
embed.fields.push({
|
embed.fields.push({
|
||||||
name: "Counts",
|
name: "Counts",
|
||||||
|
inline: true,
|
||||||
value:
|
value:
|
||||||
trimLines(`
|
trimLines(`
|
||||||
Roles: ${this.guild.roles.size}
|
Roles: **${this.guild.roles.size}**
|
||||||
Text channels: ${textChannels.length}
|
Categories: **${categories.length}**
|
||||||
Voice channels: ${voiceChannels.length}
|
Text channels: **${textChannels.length}**
|
||||||
|
Voice channels: **${voiceChannels.length}**
|
||||||
|
Emojis: **${this.guild.emojis.length}**
|
||||||
`) + embedPadding,
|
`) + embedPadding,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -545,14 +555,18 @@ export class UtilityPlugin extends ZeppelinPlugin {
|
||||||
const dndMembers = this.guild.members.filter(m => m.status === "dnd");
|
const dndMembers = this.guild.members.filter(m => m.status === "dnd");
|
||||||
const idleMembers = this.guild.members.filter(m => m.status === "idle");
|
const idleMembers = this.guild.members.filter(m => m.status === "idle");
|
||||||
const offlineMembers = this.guild.members.filter(m => m.status === "offline");
|
const offlineMembers = this.guild.members.filter(m => m.status === "offline");
|
||||||
|
const notOfflineMembers = this.guild.members.filter(m => m.status !== "offline");
|
||||||
|
|
||||||
embed.fields.push({
|
embed.fields.push({
|
||||||
name: "Members",
|
name: "Members",
|
||||||
|
inline: true,
|
||||||
value: trimLines(`
|
value: trimLines(`
|
||||||
|
Total: **${this.guild.memberCount}**
|
||||||
Online: **${onlineMembers.length}**
|
Online: **${onlineMembers.length}**
|
||||||
Idle: **${idleMembers.length}**
|
Idle: **${idleMembers.length}**
|
||||||
DND: **${dndMembers.length}**
|
DND: **${dndMembers.length}**
|
||||||
Offline: **${offlineMembers.length}**
|
Offline: **${offlineMembers.length}**
|
||||||
|
Not offline: **${notOfflineMembers.length}**
|
||||||
`),
|
`),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue