Skip to content
This repository has been archived by the owner on Dec 14, 2024. It is now read-only.

Commit

Permalink
feat(StatsCommand): mark the current shard with an asterisk (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceEEC authored Apr 26, 2020
1 parent 5fa417c commit 5e806d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/commands/common/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ class StatsCommand extends Command
let totalGuilds: number = 0;
let totalUsers: number = 0;
let totalRam: number = 0;
for (const { guilds, users, ram } of data)
for (const { guilds, users, ram, ids } of data)
{
if (ids.includes(message.guild.shardID))
{
ids[ids.length - 1] = `${ids[ids.length - 1]}*`;
}
totalGuilds += guilds;
totalUsers += users;
totalRam += ram;
Expand Down Expand Up @@ -86,7 +90,7 @@ class StatsCommand extends Command
{
let tmp: number;

tmp = ids.map((id: number) => id.toLocaleString()).join(', ').length;
tmp = ids.map(id => id.toLocaleString()).join(', ').length;
if (tmp > longestId) longestId = tmp;

tmp = guilds.toLocaleString().length;
Expand Down Expand Up @@ -125,7 +129,7 @@ class StatsCommand extends Command
for (const { guilds, ids, ram, users } of data)
{
shardInfo += [
'║', this._pad(ids.map((id: number) => id.toLocaleString()).join(', '), longestId),
'║', this._pad(ids.map(id => id.toLocaleString()).join(', '), longestId),
'|', this._pad(`${ram.toFixed(2)} MB`, longestRam),
'|', this._pad(guilds.toLocaleString(), longestGuild),
'|', this._pad(users.toLocaleString(), longestUser),
Expand Down
2 changes: 1 addition & 1 deletion src/types/IShardData.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface IShardData {
guilds: number;
ids: number[];
ids: (number | string)[];
ram: number;
users: number;
}

0 comments on commit 5e806d9

Please sign in to comment.