/[sudobot]/trunk/src/commands/settings/SystemCommand.ts
ViewVC logotype

Diff of /trunk/src/commands/settings/SystemCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/src/commands/testing/SystemCommand.ts revision 51 by rakin, Mon Jul 29 17:28:23 2024 UTC trunk/src/commands/settings/SystemCommand.ts revision 284 by rakin, Mon Jul 29 17:29:21 2024 UTC
# Line 5  import CommandOptions from '../../types/ Line 5  import CommandOptions from '../../types/
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 { timeProcess } from '../../utils/util';
9    import { formatDistanceStrict, formatDistanceToNowStrict, formatDuration, intervalToDuration } from 'date-fns';
10    
11  export default class SystemCommand extends BaseCommand {  export default class SystemCommand extends BaseCommand {
12      constructor() {      constructor() {
13          super('system', 'testing', []);          super('system', 'settings', []);
14          this.supportsInteractions = true;          this.supportsInteractions = true;
15      }      }
16    
# Line 53  export default class SystemCommand exten Line 55  export default class SystemCommand exten
55              apiLatencyIcon = '🟡';              apiLatencyIcon = '🟡';
56          }          }
57    
58          const memoryFree = Math.round(process.memoryUsage().heapUsed / 1024 / 1024 * 100) / 100;          const memoryFree = Math.round((process.memoryUsage().heapUsed / 1024 / 1024 * 100) / 100);
59    
60          const msgoptions: any = {          const msgoptions: any = {
61              embeds: [              embeds: [
# Line 65  export default class SystemCommand exten Line 67  export default class SystemCommand exten
67                  .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'))
68                  .addFields([                  .addFields([
69                      {                      {
70                          name: 'Type',                          name: 'Command Type',
71                          value: `${msg instanceof Message ? 'Legacy (Message-based)' : 'Slash Command'}`                          value: `${!options.isInteraction ? 'Legacy (Message-based)' : 'Slash Command'}`
72                        },
73                        {
74                            name: 'Uptime',
75                            value: `${formatDuration(intervalToDuration({
76                                start: 0,
77                                end: process.uptime() * 1000
78                            }))}`
79                      },                      },
80                      {                      {
81                          name: 'Latency',                          name: 'Latency',
# Line 78  export default class SystemCommand exten Line 87  export default class SystemCommand exten
87                      },                      },
88                      {                      {
89                          name: 'Available Memory',                          name: 'Available Memory',
90                          value: `${memoryFree}MB / 1.0GB`                          value: `${1024 - memoryFree}MB / 1.0GB`
91                      },                      },
92                      {                      {
93                          name: 'System Platform',                          name: 'System Platform',

Legend:
Removed from v.51  
changed lines
  Added in v.284

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26