mirror of https://github.com/thaldrin/thaldrin.git
push latest
This commit is contained in:
parent
116920726b
commit
1c1756d180
|
@ -1,11 +1,12 @@
|
||||||
import { Client, Collection } from "discord.js";
|
import { Client, Collection } from "discord.js";
|
||||||
import { readdirSync as read } from "fs";
|
import { readdirSync as read } from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import { Command } from "../../utils/types";
|
||||||
import Logger from "../../utils/logger";
|
import Logger from "../../utils/logger";
|
||||||
// const server = require('../../website/server');
|
// const server = require('../../website/server');
|
||||||
|
|
||||||
export default class Thaldrin extends Client {
|
export default class Thaldrin extends Client {
|
||||||
commands: Collection<unknown, unknown>;
|
commands: Collection<string, Command>;
|
||||||
cooldowns: Collection<unknown, unknown>;
|
cooldowns: Collection<unknown, unknown>;
|
||||||
config: any;
|
config: any;
|
||||||
lastEval: any;
|
lastEval: any;
|
||||||
|
|
|
@ -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}>`)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -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)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
import { SupabaseClient } from "@supabase/supabase-js";
|
import { SupabaseClient } from "@supabase/supabase-js";
|
||||||
import { Client, Guild, GuildMember, Message, NewsChannel, TextChannel, User } from "discord.js";
|
import { Client, Guild, GuildMember, Message, NewsChannel, TextChannel, User } from "discord.js";
|
||||||
|
import Thaldrin from "../handler/client/Client";
|
||||||
export type Server = {
|
export type Server = {
|
||||||
readonly id: string
|
readonly id: string
|
||||||
server_id: string
|
server_id: string
|
||||||
|
@ -34,8 +34,9 @@ export type Command = {
|
||||||
hidden?: boolean;
|
hidden?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export type Context = {
|
export type Context = {
|
||||||
client: Client;
|
client: Thaldrin;
|
||||||
args: string[]
|
args: string[]
|
||||||
guild: Guild | null;
|
guild: Guild | null;
|
||||||
message: Message;
|
message: Message;
|
||||||
|
@ -161,6 +162,7 @@ export interface Variables {
|
||||||
invite: string
|
invite: string
|
||||||
}
|
}
|
||||||
website: string
|
website: string
|
||||||
|
invite: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Pkg {
|
export interface Pkg {
|
||||||
|
|
|
@ -44,5 +44,6 @@ export default {
|
||||||
},
|
},
|
||||||
tagline: "A Random Image and Utility Bot",
|
tagline: "A Random Image and Utility Bot",
|
||||||
color: "#ff995d",
|
color: "#ff995d",
|
||||||
website: "thaldr.in"
|
website: "thaldr.in",
|
||||||
|
invite: "https://t8.pm/legacy-invite"
|
||||||
}
|
}
|
Loading…
Reference in New Issue