summary refs log tree commit diff
path: root/src-slowcord/bot/src/commands/instance.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src-slowcord/bot/src/commands/instance.ts')
-rw-r--r--src-slowcord/bot/src/commands/instance.ts50
1 files changed, 35 insertions, 15 deletions
diff --git a/src-slowcord/bot/src/commands/instance.ts b/src-slowcord/bot/src/commands/instance.ts

index ac0c9b2d..170d8f76 100644 --- a/src-slowcord/bot/src/commands/instance.ts +++ b/src-slowcord/bot/src/commands/instance.ts
@@ -1,7 +1,7 @@ import { Command } from "./index.js"; import { User, Guild, Message } from "@fosscord/util"; -const cache: { [key: string]: number; } = { +const cache: { [key: string]: number } = { users: 0, guilds: 0, messages: 0, @@ -11,7 +11,10 @@ const cache: { [key: string]: number; } = { export default { name: "instance", exec: async ({ message }) => { - if (Date.now() > cache.lastChecked + parseInt(process.env.CACHE_TTL as string)) { + if ( + Date.now() > + cache.lastChecked + parseInt(process.env.CACHE_TTL as string) + ) { cache.users = await User.count(); cache.guilds = await Guild.count(); cache.messages = await Message.count(); @@ -19,18 +22,35 @@ export default { } return message.reply({ - embeds: [{ - title: "Instance Stats", - description: "For more indepth information, check out https://grafana.understars.dev", - footer: { - text: `Last checked: ${Math.floor((Date.now() - cache.lastChecked) / (1000 * 60))} minutes ago`, + embeds: [ + { + title: "Instance Stats", + description: + "For more indepth information, check out https://grafana.understars.dev", + footer: { + text: `Last checked: ${Math.floor( + (Date.now() - cache.lastChecked) / (1000 * 60), + )} minutes ago`, + }, + fields: [ + { + inline: true, + name: "Total Users", + value: cache.users.toString(), + }, + { + inline: true, + name: "Total Guilds", + value: cache.guilds.toString(), + }, + { + inline: true, + name: "Total Messages", + value: cache.messages.toString(), + }, + ], }, - fields: [ - { inline: true, name: "Total Users", value: cache.users.toString() }, - { inline: true, name: "Total Guilds", value: cache.guilds.toString() }, - { inline: true, name: "Total Messages", value: cache.messages.toString() }, - ] - }] + ], }); - } -} as Command; \ No newline at end of file + }, +} as Command;