push latest

This commit is contained in:
Lio Young 2021-05-05 14:57:42 +02:00
parent 116920726b
commit 1c1756d180
No known key found for this signature in database
GPG Key ID: 789795A11879E169
6 changed files with 75 additions and 4 deletions

View File

@ -1,11 +1,12 @@
import { Client, Collection } from "discord.js";
import { readdirSync as read } from "fs";
import path from "path";
import { Command } from "../../utils/types";
import Logger from "../../utils/logger";
// const server = require('../../website/server');
export default class Thaldrin extends Client {
commands: Collection<unknown, unknown>;
commands: Collection<string, Command>;
cooldowns: Collection<unknown, unknown>;
config: any;
lastEval: any;

View File

@ -0,0 +1,22 @@
import Command from '../../handler/structures/Command';
import { Context } from '../../utils/types';
import lingua from '../../utils/lingua';
import embed from '../../utils/embed';
export = class Invite extends Command {
constructor() {
super({
name: "invite",
description: "Invite the bot to your server",
aliases: ["inv"],
cooldown: 1,
})
}
async command(ctx: Context) {
// TODO: generate custom invites for every server
// @ts-ignore
ctx.channel.send(`${lingua[ctx.settings.locale].INVITE_STRING}:\n<${ctx.config.variables.invite}>`)
}
}

31
src/modules/misc/stats.ts Normal file
View File

@ -0,0 +1,31 @@
import Command from '../../handler/structures/Command';
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() {
super({
name: "stats",
description: "See the Bot's Stats",
aliases: ["statistics"],
cooldown: 1,
})
}
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)
}
}

View File

@ -0,0 +1,14 @@
import supabase from "./database"
import { Command, Usage } from "./types"
export default async function usage(c: Map<string, Command>) {
let commands: string[] = []
let { data, error } = await supabase.from<Usage>("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
}

View File

@ -1,6 +1,6 @@
import { SupabaseClient } from "@supabase/supabase-js";
import { Client, Guild, GuildMember, Message, NewsChannel, TextChannel, User } from "discord.js";
import Thaldrin from "../handler/client/Client";
export type Server = {
readonly id: string
server_id: string
@ -34,8 +34,9 @@ export type Command = {
hidden?: boolean;
}
export type Context = {
client: Client;
client: Thaldrin;
args: string[]
guild: Guild | null;
message: Message;
@ -161,6 +162,7 @@ export interface Variables {
invite: string
}
website: string
invite: any;
}
export interface Pkg {

View File

@ -44,5 +44,6 @@ export default {
},
tagline: "A Random Image and Utility Bot",
color: "#ff995d",
website: "thaldr.in"
website: "thaldr.in",
invite: "https://t8.pm/legacy-invite"
}