mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-14 03:09:59 +00:00
Formatted code and clean up
This commit is contained in:
+27
-19
@@ -1,14 +1,13 @@
|
||||
import DiscordModule, { HybridInteractionMessage } from "../utils/DiscordModule";
|
||||
import { Message, CommandInteraction, Interaction } from 'discord.js';
|
||||
import os from 'os-utils';
|
||||
|
||||
import { Message, CommandInteraction, Interaction } from "discord.js";
|
||||
import { sendHybridInteractionMessageResponse, makeInfoEmbed } from "../utils/DiscordMessage";
|
||||
import DiscordProvider from "../providers/Discord";
|
||||
import os from "os-utils";
|
||||
import DiscordProvider from '../providers/Discord';
|
||||
|
||||
import DiscordModule, { HybridInteractionMessage } from '../utils/DiscordModule';
|
||||
import { sendHybridInteractionMessageResponse, makeInfoEmbed } from '../utils/DiscordMessage';
|
||||
|
||||
const EMBEDS = {
|
||||
STATS_INFO: (data: Message | Interaction) => {
|
||||
let message;
|
||||
|
||||
return makeInfoEmbed({
|
||||
title: `Stats`,
|
||||
icon: '📊',
|
||||
@@ -16,35 +15,44 @@ const EMBEDS = {
|
||||
fields: [
|
||||
{
|
||||
name: '🌐 Users',
|
||||
value: `${DiscordProvider.client.guilds.cache.size} servers\n${DiscordProvider.client.guilds.cache.map((g) => g.memberCount).reduce((a, c) => a + c)} users`,
|
||||
value: `${
|
||||
DiscordProvider.client.guilds.cache.size
|
||||
} servers\n${DiscordProvider.client.guilds.cache
|
||||
.map((g) => g.memberCount)
|
||||
.reduce((a, c) => a + c)} users`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: '🟢 Uptime since',
|
||||
value: `System: <t:${(Math.round(new Date().getTime() / 1000)) - Math.round(os.sysUptime())}:R>\nProcess: <t:${(Math.round(new Date().getTime() / 1000)) - Math.round(os.processUptime())}:R>`,
|
||||
value: `System: <t:${
|
||||
Math.round(new Date().getTime() / 1000) - Math.round(os.sysUptime())
|
||||
}:R>\nProcess: <t:${
|
||||
Math.round(new Date().getTime() / 1000) - Math.round(os.processUptime())
|
||||
}:R>`,
|
||||
inline: true
|
||||
}
|
||||
],
|
||||
user: (data instanceof Interaction) ? data.user : data.author
|
||||
user: data instanceof Interaction ? data.user : data.author
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default class Stats extends DiscordModule {
|
||||
|
||||
public id = "Discord_Stats";
|
||||
public commands = ["stats"];
|
||||
public commandInteractionName = "stats";
|
||||
|
||||
public id = 'Discord_Stats';
|
||||
public commands = ['stats'];
|
||||
public commandInteractionName = 'stats';
|
||||
|
||||
async GuildOnModuleCommand(args: any, message: Message) {
|
||||
await this.run(new HybridInteractionMessage(message), args);
|
||||
}
|
||||
|
||||
async GuildModuleCommandInteractionCreate(interaction: CommandInteraction) {
|
||||
async GuildModuleCommandInteractionCreate(interaction: CommandInteraction) {
|
||||
await this.run(new HybridInteractionMessage(interaction), interaction.options);
|
||||
}
|
||||
|
||||
async run(data: HybridInteractionMessage, args: any) {
|
||||
return await sendHybridInteractionMessageResponse(data, { embeds:[EMBEDS.STATS_INFO(data.getRaw())] });
|
||||
return await sendHybridInteractionMessageResponse(data, {
|
||||
embeds: [EMBEDS.STATS_INFO(data.getRaw())]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user