diff --git a/bot/src/Reader.ts b/bot/src/Reader.ts index ccda1a4..2583ee7 100644 --- a/bot/src/Reader.ts +++ b/bot/src/Reader.ts @@ -2,6 +2,7 @@ import { ReaderClient } from "reader-framework"; import * as Config from "../../config/config.json"; const client = new ReaderClient(Config.BOT.TOKEN, { + defaultImageFormat: "png", intents: [ "guilds", "guildMessages", diff --git a/framework/lib/Commands/Modules/StatsCommand.ts b/framework/lib/Commands/Modules/StatsCommand.ts index fb3d6fc..532d375 100644 --- a/framework/lib/Commands/Modules/StatsCommand.ts +++ b/framework/lib/Commands/Modules/StatsCommand.ts @@ -1,33 +1,35 @@ import { ReaderClient } from "../../Client"; -import { CommandInteraction, Constants, TextableChannel, VERSION } from "eris"; +import { CommandInteraction, TextableChannel, VERSION } from "eris"; import { Utils } from "givies-framework"; import { Util } from "../../Utils"; import osUtils from "os-utils"; export async function statsCommand(client: ReaderClient, interaction: CommandInteraction) { - const memory: number = process.memoryUsage().rss - const totalMemory: string = `${Util.bytesToSize(memory).value}${Util.bytesToSize(memory).unit} / ${Util.bytesToSize(require("os").totalmem()).value}${Util.bytesToSize(require("os").totalmem()).unit}`; - /* @ts-ignore */ - const totalMem = Util.bytesToSize(require("os").totalmem()).value * 1000; + const memory: number = process.memoryUsage().rss; + + /* eslint-disable-next-line */ + const totalMemory = `${Util.bytesToSize(memory).value}${Util.bytesToSize(memory).unit} / ${Util.bytesToSize(require("os").totalmem()).value}${Util.bytesToSize(require("os").totalmem()).unit}`; + + /* eslint-disable-next-line */ + const totalMem = Util.bytesToSize(require("os").totalmem()).value * 1000 ; const used: number = process.memoryUsage().rss / totalMem / totalMem; osUtils.cpuUsage((percentage) => { const embed = new Utils.RichEmbed() - .setColor(client.config.BOT.COLOUR) - .setFooter(client.user.username, client.user.avatarURL) - .setThumbnail(client.user.avatarURL) - .setTimestamp() - .setTitle(client.translate("general.stats.title").replace("{bot}", client.user.username)) - .addField(client.translate("general.stats.memory"), `${totalMemory} \n (${Math.round(used * 100) / 100}%)`, true) - .addField(client.translate("general.stats.cpu"), `${Util.round(percentage, 2)}%`, true) - .addField(client.translate("general.stats.uptime"), `${Util.time(client.uptime)}`, true) - .addField("NodeJS", `${process.versions.node}`, true) - .addField("Eris", `${VERSION}`, true) - .addField(client.translate("general.stats.platform"), `${process.platform.charAt(0).toUpperCase() + process.platform.slice(1)}`, true); + .setColor(client.config.BOT.COLOUR) + .setFooter(client.user.username, client.user.avatarURL) + .setThumbnail(client.user.avatarURL) + .setTimestamp() + .setTitle(client.translate("general.stats.title").replace("{bot}", client.user.username)) + .addField(client.translate("general.stats.memory"), `${totalMemory} \n (${Math.round(used * 100) / 100}%)`, true) + .addField(client.translate("general.stats.cpu"), `${Util.round(percentage, 2)}%`, true) + .addField(client.translate("general.stats.uptime"), `${Util.time(client.uptime)}`, true) + .addField("NodeJS", `${process.versions.node}`, true) + .addField("Eris", `${VERSION}`, true) + .addField(client.translate("general.stats.platform"), `${process.platform.charAt(0).toUpperCase() + process.platform.slice(1)}`, true); - return interaction.createMessage({ - embeds: [embed], - flags: Constants.MessageFlags.EPHEMERAL - }); + return interaction.createMessage({ + embeds: [embed] + }); }); } diff --git a/framework/lib/Events/Modules/GuildCreateEvent.ts b/framework/lib/Events/Modules/GuildCreateEvent.ts index 6d01e6e..4856b5d 100644 --- a/framework/lib/Events/Modules/GuildCreateEvent.ts +++ b/framework/lib/Events/Modules/GuildCreateEvent.ts @@ -17,7 +17,7 @@ export async function guildCreateEvent(client: ReaderClient, guild: Guild) { settings: ({ locale: "en" } as IGuildSchemaSettings) - }) + }); } commands.forEach((command) => { diff --git a/framework/lib/Events/Modules/InteractionCreateEvent.ts b/framework/lib/Events/Modules/InteractionCreateEvent.ts index 9b699be..ab6a7f1 100644 --- a/framework/lib/Events/Modules/InteractionCreateEvent.ts +++ b/framework/lib/Events/Modules/InteractionCreateEvent.ts @@ -1,6 +1,5 @@ import { ReaderClient } from "../../Client"; import { CommandInteraction, Constants, TextChannel } from "eris"; -import { ICommandRunPayload } from "../../Interfaces"; import { t } from "i18next"; import { GuildModel, UserModel } from "../../Models"; import { Utils } from "givies-framework"; @@ -12,7 +11,6 @@ export async function interactionCreateEvent(client: ReaderClient, interaction: if (interaction.member.bot) return; const command = client.commands.get(interaction.data.name); - const payload: ICommandRunPayload = { client, interaction }; const guildData = await GuildModel.findOne({ id: interaction.guildID }); const userData = await UserModel.findOne({ id: interaction.member.id }); diff --git a/framework/lib/Utils/Util.ts b/framework/lib/Utils/Util.ts index 427589d..ed5b8f8 100644 --- a/framework/lib/Utils/Util.ts +++ b/framework/lib/Utils/Util.ts @@ -6,7 +6,7 @@ import { Utils } from "givies-framework"; import byteSize from "byte-size"; interface IByteSize { - value: string; + value: number; unit: string; } @@ -18,7 +18,7 @@ export class Util { * @returns {IByteSize} */ public static bytesToSize(bytes: number): IByteSize { - return byteSize(bytes); + return byteSize(bytes) as any; } /**