mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 10:49:20 +00:00
Added Stats Command
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import { Message, CommandInteraction, Interaction } from "discord.js";
|
||||
import { getEmotes, makeSuccessEmbed, makeProcessingEmbed, sendMessage, sendMessageOrInteractionResponse, makeInfoEmbed } from "../utils/DiscordMessage";
|
||||
import DiscordProvider from "../providers/Discord";
|
||||
import Users from "../services/Users"
|
||||
import Environment from "../providers/Environment";
|
||||
|
||||
const EMBEDS = {
|
||||
STATS_INFO: (data: Message | Interaction) => {
|
||||
let message;
|
||||
|
||||
return makeInfoEmbed({
|
||||
title: `Stats`,
|
||||
icon: '📊',
|
||||
description: `Serving in ${DiscordProvider.client.guilds.cache.size} servers\n${DiscordProvider.client.guilds.cache.map((g) => g.memberCount).reduce((a, c) => a + c)} users`,
|
||||
user: (data instanceof Interaction) ? data.user : data.author
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default class Stats {
|
||||
|
||||
async onCommand(command: string, args: any, message: Message) {
|
||||
if(command.toLowerCase() !== 'stats') return;
|
||||
await this.process(message, args);
|
||||
}
|
||||
|
||||
async interactionCreate(interaction: CommandInteraction) {
|
||||
if(interaction.isCommand()) {
|
||||
if(typeof interaction.commandName === 'undefined') return;
|
||||
if((interaction.commandName).toLowerCase() !== 'stats') return;
|
||||
await this.process(interaction, interaction.options);
|
||||
}
|
||||
}
|
||||
|
||||
async process(data: Interaction | Message, args: any) {
|
||||
const isSlashCommand = data instanceof CommandInteraction && data.isCommand();
|
||||
const isMessage = data instanceof Message;
|
||||
|
||||
if(!isSlashCommand && !isMessage) return;
|
||||
|
||||
return await sendMessageOrInteractionResponse(data, { embeds:[EMBEDS.STATS_INFO(data)] });
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ import Discord_InteractionManager from "../discord/InteractionManager";
|
||||
import Discord_MembershipScreening from "../discord/MembershipScreening";
|
||||
import Discord_osu from "../discord/osu";
|
||||
import Discord_UserInfo from "../discord/UserInfo";
|
||||
import Discord_Stats from "../discord/Stats";
|
||||
|
||||
import Discord_MusicPlayer_Play from "../discord/MusicPlayer/Play";
|
||||
import Discord_MusicPlayer_Skip from "../discord/MusicPlayer/Skip";
|
||||
import Discord_MusicPlayer_Join from "../discord/MusicPlayer/Join";
|
||||
@@ -53,6 +55,7 @@ class Discord {
|
||||
this.loaded_module["Discord_Say"] = new Discord_Say();
|
||||
this.loaded_module["Discord_osu"] = new Discord_osu();
|
||||
this.loaded_module["Discord_UserInfo"] = new Discord_UserInfo();
|
||||
this.loaded_module["Discord_Stats"] = new Discord_Stats();
|
||||
|
||||
this.loaded_module["Discord_MusicPlayer_Play"] = new Discord_MusicPlayer_Play();
|
||||
this.loaded_module["Discord_MusicPlayer_Skip"] = new Discord_MusicPlayer_Skip();
|
||||
|
||||
Reference in New Issue
Block a user