diff --git a/src/modules/misc/stats.ts b/src/modules/misc/stats.ts index 4348fdf..0427add 100644 --- a/src/modules/misc/stats.ts +++ b/src/modules/misc/stats.ts @@ -3,7 +3,6 @@ import { Context, Usage } from '../../utils/types'; import lingua from '../../utils/lingua'; import embed from '../../utils/embed'; import CommandUsage from '../../utils/command.usage'; -import vega from "vega" export = class Stats extends Command { constructor() { @@ -17,15 +16,7 @@ export = class Stats extends Command { async command(ctx: Context) { let Stats = await CommandUsage(ctx.client.commands) - // @ts-ignore - let View = new vega.View(vega.parse(Stats), { renderer: "none" }) - let Canvas = await View.toCanvas() - // return ctx.channel.send(Stats.join("\n")) - // @ts-ignore - let Image = View.createPNGStream() - // @ts-ignore - let Buffer = Image.toBuffer() - console.log(Buffer) + console.log(Stats) } } \ No newline at end of file diff --git a/src/utils/command.usage.ts b/src/utils/command.usage.ts index 3169cce..fa9646a 100644 --- a/src/utils/command.usage.ts +++ b/src/utils/command.usage.ts @@ -1,14 +1,19 @@ -import supabase from "./database" -import { Command, Usage } from "./types" +import supabase from "./database"; +import { Command, Usage } from "./types"; + +type C = { name: string; amount: number }; export default async function usage(c: Map) { - let commands: string[] = [] + let commands: C[] = []; - let { data, error } = await supabase.from("usage").select().filter("type", "eq", "command") - for (const command in data) { - // @ts-ignore - commands.push({ name: data[command].name, amount: data[command].amount }) - } + let { data, error } = await supabase + .from("usage") + .select() + .filter("type", "eq", "command"); + for (const command in data) { + // @ts-ignore + commands.push({ name: data[command].name, amount: data[command].amount }); + } - return commands -} \ No newline at end of file + return commands.sort((a, b) => a.amount - b.amount); +}