1 |
import { CommandInteraction, GuildMember, Interaction, Message } from 'discord.js'; |
import { CommandInteraction, Message } from 'discord.js'; |
2 |
import BaseCommand from '../../utils/structures/BaseCommand'; |
import BaseCommand from '../../utils/structures/BaseCommand'; |
3 |
import DiscordClient from '../../client/Client'; |
import DiscordClient from '../../client/Client'; |
4 |
import CommandOptions from '../../types/CommandOptions'; |
import CommandOptions from '../../types/CommandOptions'; |
5 |
import InteractionOptions from '../../types/InteractionOptions'; |
import InteractionOptions from '../../types/InteractionOptions'; |
6 |
import MessageEmbed from '../../client/MessageEmbed'; |
import MessageEmbed from '../../client/MessageEmbed'; |
7 |
import { fetchEmoji } from '../../utils/Emoji'; |
import { fetchEmoji } from '../../utils/Emoji'; |
8 |
|
import { formatDuration, intervalToDuration } from 'date-fns'; |
9 |
|
|
10 |
export default class SystemCommand extends BaseCommand { |
export default class SystemCommand extends BaseCommand { |
11 |
constructor() { |
constructor() { |
54 |
apiLatencyIcon = '🟡'; |
apiLatencyIcon = '🟡'; |
55 |
} |
} |
56 |
|
|
57 |
const memoryFree = Math.round(process.memoryUsage().heapUsed / 1024 / 1024 * 100) / 100; |
const memoryFree = Math.round((process.memoryUsage().heapUsed / 1024 / 1024 * 100) / 100); |
58 |
|
|
59 |
const msgoptions: any = { |
const msgoptions: any = { |
60 |
embeds: [ |
embeds: [ |
66 |
.setDescription((latencyIcon !== '🔴' ? (await fetchEmoji('check'))?.toString() + ' All systems operational' : ':x: Some systems are down/slow')) |
.setDescription((latencyIcon !== '🔴' ? (await fetchEmoji('check'))?.toString() + ' All systems operational' : ':x: Some systems are down/slow')) |
67 |
.addFields([ |
.addFields([ |
68 |
{ |
{ |
69 |
name: 'Type', |
name: 'Command Type', |
70 |
value: `${msg instanceof Message ? 'Legacy (Message-based)' : 'Slash Command'}` |
value: `${!options.isInteraction ? 'Legacy (Message-based)' : 'Slash Command'}` |
71 |
|
}, |
72 |
|
{ |
73 |
|
name: 'Uptime', |
74 |
|
value: `${formatDuration(intervalToDuration({ |
75 |
|
start: 0, |
76 |
|
end: process.uptime() * 1000 |
77 |
|
}))}` |
78 |
}, |
}, |
79 |
{ |
{ |
80 |
name: 'Latency', |
name: 'Latency', |
86 |
}, |
}, |
87 |
{ |
{ |
88 |
name: 'Available Memory', |
name: 'Available Memory', |
89 |
value: `${memoryFree}MB / 1.0GB` |
value: `${1024 - memoryFree}MB / 1.0GB` |
90 |
}, |
}, |
91 |
{ |
{ |
92 |
name: 'System Platform', |
name: 'System Platform', |