move commands and events around

This commit is contained in:
Lio Young 2021-09-11 13:36:51 +02:00
parent c6c481f552
commit 1b43ccfda4
41 changed files with 204 additions and 301 deletions

View File

@ -1,8 +1,8 @@
import yiff from '../../utils/yiff'; import yiff from '../../../utils/yiff';
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import request from '../../utils/animals'; import request from '../../../utils/animals';
export = class Birb extends Command { export = class Birb extends Command {
constructor() { constructor() {

View File

@ -1,8 +1,8 @@
import yiff from '../../utils/yiff'; import yiff from '../../../utils/yiff';
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import request from '../../utils/animals'; import request from '../../../utils/animals';
export = class Cat extends Command { export = class Cat extends Command {
constructor() { constructor() {

View File

@ -1,8 +1,8 @@
import yiff from '../../utils/yiff'; import yiff from '../../../utils/yiff';
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import request from '../../utils/animals'; import request from '../../../utils/animals';
export = class Fox extends Command { export = class Fox extends Command {
constructor() { constructor() {

View File

@ -1,8 +1,8 @@
import yiff from '../../utils/yiff'; import yiff from '../../../utils/yiff';
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import request from '../../utils/animals'; import request from '../../../utils/animals';
export = class Hyena extends Command { export = class Hyena extends Command {
constructor() { constructor() {

View File

@ -1,8 +1,8 @@
import yiff from '../../utils/yiff'; import yiff from '../../../utils/yiff';
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import request from '../../utils/animals'; import request from '../../../utils/animals';
export = class Shibe extends Command { export = class Shibe extends Command {
constructor() { constructor() {

View File

@ -1,8 +1,8 @@
import yiff from '../../utils/yiff'; import yiff from '../../../utils/yiff';
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import request from '../../utils/animals'; import request from '../../../utils/animals';
export = class Wolf extends Command { export = class Wolf extends Command {
constructor() { constructor() {

View File

@ -1,6 +1,6 @@
import { Context } from "../../utils/types"; import { Context } from "../../../utils/types";
import Command from "../../handler/structures/Command"; import { Command } from '@thaldrin/eu';
import clean from "../../utils/clean" import clean from "../../../utils/clean"
export = class Eval extends Command { export = class Eval extends Command {
constructor() { constructor() {
super({ super({

View File

@ -1,6 +1,6 @@
import Command from "../../handler/structures/Command"; import { Command } from '@thaldrin/eu';
import { exec } from "child_process"; import { exec } from "child_process";
import { Context } from "../../utils/types"; import { Context } from "../../../utils/types";
export = class Exec extends Command { export = class Exec extends Command {
constructor() { constructor() {

View File

@ -1,10 +1,10 @@
// @ts-nocheck // @ts-nocheck
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import lingua from '../../utils/lingua'; import lingua from '../../../utils/lingua';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
import { request } from '../../utils/command.roleplay'; import { request } from '../../../utils/command.roleplay';
export = class Boop extends Command { export = class Boop extends Command {
constructor() { constructor() {

View File

@ -1,10 +1,10 @@
// @ts-nocheck // @ts-nocheck
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import lingua from '../../utils/lingua'; import lingua from '../../../utils/lingua';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
import { request } from '../../utils/command.roleplay'; import { request } from '../../../utils/command.roleplay';
export = class Cuddle extends Command { export = class Cuddle extends Command {
constructor() { constructor() {

View File

@ -1,10 +1,10 @@
// @ts-nocheck // @ts-nocheck
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import language from '../../utils/language'; import language from '../../../utils/language';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
import { request } from '../../utils/command.roleplay'; import { request } from '../../../utils/command.roleplay';
export = class Hold extends Command { export = class Hold extends Command {
constructor() { constructor() {

View File

@ -1,10 +1,10 @@
// @ts-nocheck // @ts-nocheck
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import language from '../../utils/language'; import language from '../../../utils/language';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
import { request } from '../../utils/command.roleplay'; import { request } from '../../../utils/command.roleplay';
export = class Hug extends Command { export = class Hug extends Command {
constructor() { constructor() {

View File

@ -1,10 +1,10 @@
// @ts-nocheck // @ts-nocheck
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import language from '../../utils/language'; import language from '../../../utils/language';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
import { request } from '../../utils/command.roleplay'; import { request } from '../../../utils/command.roleplay';
export = class Lick extends Command { export = class Lick extends Command {
constructor() { constructor() {

View File

@ -1,7 +1,7 @@
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import config from '../../../config'; import config from '../../../../config';
export = class Info extends Command { export = class Info extends Command {
constructor() { constructor() {
@ -22,6 +22,7 @@ export = class Info extends Command {
}) })
devs = devs.join(' ') devs = devs.join(' ')
} else { } else {
// @ts-ignore
devs = `**[${ctx.client.users.cache.get(ctx.config.variables.developers[0].id)?.username}](${ctx.config.variables.developers[0].link})**` devs = `**[${ctx.client.users.cache.get(ctx.config.variables.developers[0].id)?.username}](${ctx.config.variables.developers[0].link})**`
} }
if (ctx.config.variables.contributors.length > 1) { if (ctx.config.variables.contributors.length > 1) {
@ -39,6 +40,7 @@ export = class Info extends Command {
A [Caecus](https://werewolf.design) Project\n[Consider supporting the Development of this Bot](https://lio.cat/support)`) A [Caecus](https://werewolf.design) Project\n[Consider supporting the Development of this Bot](https://lio.cat/support)`)
.addField("Contributors", `${contribs}`, false) .addField("Contributors", `${contribs}`, false)
.addField("Source", config.variables.source, true) .addField("Source", config.variables.source, true)
// @ts-ignore
.addField("Support Server", `[${ctx.client.guilds.cache.get(ctx.config.variables.support.id)?.name}](${ctx.config.variables.support.invite})`, true) .addField("Support Server", `[${ctx.client.guilds.cache.get(ctx.config.variables.support.id)?.name}](${ctx.config.variables.support.invite})`, true)
.addField("Website", `[${ctx.config.variables.website}](https://${ctx.config.variables.website})`, true) .addField("Website", `[${ctx.config.variables.website}](https://${ctx.config.variables.website})`, true)
.setColor(ctx.config.variables.color) .setColor(ctx.config.variables.color)

View File

@ -1,11 +1,11 @@
// @ts-nocheck // @ts-nocheck
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context, Server } from '../../utils/types'; import { Context, Server } from '../../../utils/types';
import database from "../../utils/database" import database from "../../../utils/database"
import path from 'path' import path from 'path'
import langs from '../../utils/language'; import langs from '../../../utils/language';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
import fs from 'fs' import fs from 'fs'
import path from 'path' import path from 'path'

View File

@ -1,6 +1,6 @@
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import lingua from '../../utils/lingua'; import lingua from '../../../utils/lingua';
export = class Ping extends Command { export = class Ping extends Command {
constructor() { constructor() {
@ -14,6 +14,7 @@ export = class Ping extends Command {
async command(ctx: Context) { async command(ctx: Context) {
const ping = await ctx.channel.send("Pinging...") const ping = await ctx.channel.send("Pinging...")
const rest = Math.round(ping.createdTimestamp - ctx.message.createdTimestamp) const rest = Math.round(ping.createdTimestamp - ctx.message.createdTimestamp)
// @ts-ignore
const ws = Math.round(ctx.client.ws.ping) const ws = Math.round(ctx.client.ws.ping)
// @ts-ignore // @ts-ignore
const shard = Math.round(ctx.guild?.shard.ping) const shard = Math.round(ctx.guild?.shard.ping)

View File

@ -1,9 +1,9 @@
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context, Server } from '../../utils/types'; import { Context, Server } from '../../../utils/types';
import lingua from '../../utils/lingua'; import lingua from '../../../utils/lingua';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import database from "../../utils/database" import database from "../../../utils/database"
import language from '../../utils/language'; import language from '../../../utils/language';
function enabled(a: boolean, lang: string) { function enabled(a: boolean, lang: string) {
// @ts-ignore // @ts-ignore

View File

@ -1,9 +1,9 @@
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context, Usage } from '../../utils/types'; import { Context, Usage } from '../../../utils/types';
// import lingua from '../../utils/lingua'; // import lingua from '../../utils/lingua';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import CommandUsage from '../../utils/command.usage'; // import CommandUsage from '../../../src/utils/command.usage';
import { commitHash } from "../../utils/git" import { commitHash } from "../../../utils/git"
function uptime(ms: number) { function uptime(ms: number) {
function pad(s: number) { function pad(s: number) {
@ -30,7 +30,9 @@ export = class Stats extends Command {
async command(ctx: Context) { async command(ctx: Context) {
// @ts-ignore // @ts-ignore
const guilds = (await ctx.client.shard?.fetchClientValues(`guilds.cache.size`)).reduce((a, b) => a + b, 0) const guilds = (await ctx.client.shard?.fetchClientValues(`guilds.cache.size`)).reduce((a, b) => a + b, 0)
// @ts-ignore
const shards = ctx.client.shard?.count const shards = ctx.client.shard?.count
// @ts-ignore
const users = (await ctx.client.shard?.fetchClientValues(`users.cache.size`))?.reduce((a, b) => a + b, 0) const users = (await ctx.client.shard?.fetchClientValues(`users.cache.size`))?.reduce((a, b) => a + b, 0)
let MiscValues = [ let MiscValues = [

View File

@ -1,8 +1,8 @@
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import language from '../../utils/language'; import language from '../../../utils/language';
import { Guild, GuildMember, MessageEmbed, User as DiscordUser } from 'discord.js'; import { Guild, GuildMember, MessageEmbed, User as DiscordUser } from 'discord.js';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
let MentionRegex = /^<@!?(\d+)>$/gi let MentionRegex = /^<@!?(\d+)>$/gi

View File

@ -1,9 +1,9 @@
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import SendWS from "../../utils/webhook"; import SendWS from "../../../utils/webhook";
import language from '../../utils/language'; import language from '../../../utils/language';
import { bug } from '../../utils/trello'; import { bug } from '../../../utils/trello';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
export = class Suggestion extends Command { export = class Suggestion extends Command {
constructor() { constructor() {
super({ super({

View File

@ -1,7 +1,7 @@
import Command from "../../handler/structures/Command"; import { Command } from '@thaldrin/eu';
import { Context } from "../../utils/types"; import { Context } from "../../../utils/types";
import lingua from "../../utils/lingua"; import lingua from "../../../utils/lingua";
import replace from "../../utils/replace"; import replace from "../../../utils/replace";
import { MessageEmbed } from "discord.js"; import { MessageEmbed } from "discord.js";
let perks = [ let perks = [

View File

@ -1,8 +1,8 @@
import yiff from "../../utils/yiff" import yiff from "../../../utils/yiff"
import Command from "../../handler/structures/Command" import { Command } from '@thaldrin/eu';
import { Context } from "../../utils/types"; import { Context } from "../../../utils/types";
import { MessageEmbed } from "discord.js" import { MessageEmbed } from "discord.js"
import language from "../../utils/language"; import language from "../../../utils/language";
export = class E926 extends Command { export = class E926 extends Command {
constructor() { constructor() {
super({ super({

View File

@ -1,7 +1,7 @@
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import language from '../../utils/language'; import language from '../../../utils/language';
import { Folders, Commands } from "../../utils/command.amount"; import { Folders, Commands } from "../../../utils/command.amount";
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
export = class Help extends Command { export = class Help extends Command {
@ -31,6 +31,7 @@ export = class Help extends Command {
let arg = ctx.args[0] let arg = ctx.args[0]
if (await (await Folders()).includes(arg)) { if (await (await Folders()).includes(arg)) {
if (arg === 'developer' && !ctx.isDeveloper) return if (arg === 'developer' && !ctx.isDeveloper) return
// @ts-ignore
let commands = await (await Commands(arg, ctx.client)).map(command => `\`${command.name}\` - ${command.description}`) let commands = await (await Commands(arg, ctx.client)).map(command => `\`${command.name}\` - ${command.description}`)
embed.addField("Commands", commands.join("\n")) embed.addField("Commands", commands.join("\n"))
// @ts-ignore // @ts-ignore

View File

@ -1,7 +1,8 @@
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types';
import language from '../../utils/language'; import { Context } from '../../../utils/types';
import replace from '../../utils/replace'; import language from '../../../utils/language';
import replace from '../../../utils/replace';
export = class Invite extends Command { export = class Invite extends Command {
constructor() { constructor() {

View File

@ -1,8 +1,8 @@
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context, Server } from '../../utils/types'; import { Context, Server } from '../../../utils/types';
import database from "../../utils/database" import database from "../../../utils/database"
import language from '../../utils/language'; import language from '../../../utils/language';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
export = class Prefix extends Command { export = class Prefix extends Command {
constructor() { constructor() {

View File

@ -1,7 +1,7 @@
import Command from "../../handler/structures/Command"; import { Command } from '@thaldrin/eu';
import { Context } from "../../utils/types"; import { Context } from "../../../utils/types";
import language from "../../utils/language"; import language from "../../../utils/language";
import replace from "../../utils/replace"; import replace from "../../../utils/replace";
import Roll from 'roll' import Roll from 'roll'
const roll = new Roll() const roll = new Roll()

View File

@ -1,8 +1,8 @@
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import SendWS from "../../utils/webhook"; import SendWS from "../../../utils/webhook";
import language from '../../utils/language'; import language from '../../../utils/language';
import { suggest } from '../../utils/trello'; import { suggest } from '../../../utils/trello';
export = class Suggestion extends Command { export = class Suggestion extends Command {
constructor() { constructor() {
super({ super({

View File

@ -1,10 +1,10 @@
// @ts-nocheck // @ts-nocheck
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import language from '../../utils/language'; import language from '../../../utils/language';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
import { request } from '../../utils/command.roleplay'; import { request } from '../../../utils/command.roleplay';
export = class Bulge extends Command { export = class Bulge extends Command {
constructor() { constructor() {

View File

@ -1,8 +1,8 @@
import yiff from "../../utils/yiff" import yiff from "../../../utils/yiff"
import Command from "../../handler/structures/Command" import { Command } from '@thaldrin/eu';
import { Context } from "../../utils/types"; import { Context } from "../../../utils/types";
import { MessageEmbed } from "discord.js" import { MessageEmbed } from "discord.js"
import language from "../../utils/language"; import language from "../../../utils/language";
export = class E621 extends Command { export = class E621 extends Command {
constructor() { constructor() {
super({ super({

View File

@ -1,10 +1,9 @@
// @ts-nocheck // @ts-nocheck
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import language from '../../utils/language'; import language from '../../../utils/language';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
import { request } from '../../utils/command.roleplay'; import { request } from '../../../utils/command.roleplay';
export = class NSFW_Cuddle extends Command { export = class NSFW_Cuddle extends Command {
constructor() { constructor() {

View File

@ -1,16 +1,16 @@
// @ts-nocheck // @ts-nocheck
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import language from '../../utils/language'; import language from '../../../utils/language';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
import { request } from '../../utils/command.roleplay'; import { request } from '../../../utils/command.roleplay';
export = class NSFW_Hold extends Command { export = class NSFW_Hold extends Command {
constructor() { constructor() {
super({ super({
name: "nhold", name: "nhold",
description: "Hug somebody!", description: "Hold somebody!",
cooldown: 1, cooldown: 1,
nsfw: true, nsfw: true,
usage: `<@User>` usage: `<@User>`

View File

@ -1,10 +1,10 @@
// @ts-nocheck // @ts-nocheck
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import language from '../../utils/language'; import language from '../../../utils/language';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
import { request } from '../../utils/command.roleplay'; import { request } from '../../../utils/command.roleplay';
export = class NSFW_Hug extends Command { export = class NSFW_Hug extends Command {
constructor() { constructor() {

View File

@ -1,10 +1,10 @@
// @ts-nocheck // @ts-nocheck
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import language from '../../utils/language'; import language from '../../../utils/language';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
import { request } from '../../utils/command.roleplay'; import { request } from '../../../utils/command.roleplay';
export = class NSFW_Kiss extends Command { export = class NSFW_Kiss extends Command {
constructor() { constructor() {

View File

@ -1,10 +1,10 @@
// @ts-nocheck // @ts-nocheck
import Command from '../../handler/structures/Command'; import { Command } from '@thaldrin/eu';
import { Context } from '../../utils/types'; import { Context } from '../../../utils/types';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import language from '../../utils/language'; import language from '../../../utils/language';
import replace from '../../utils/replace'; import replace from '../../../utils/replace';
import { request } from '../../utils/command.roleplay'; import { request } from '../../../utils/command.roleplay';
export = class NSFW_Lick extends Command { export = class NSFW_Lick extends Command {
constructor() { constructor() {

View File

@ -1,5 +1,5 @@
import Logger from "../utils/logger" import Logger from "../../utils/logger"
import config from "../../config" import config from "../../../config"
import { Guild } from "discord.js" import { Guild } from "discord.js"
// import Prom from "../utils/init.prometheus"; // import Prom from "../utils/init.prometheus";
export = { export = {

View File

@ -1,16 +1,18 @@
// @ts-nocheck // @ts-nocheck
import { Client, Collection, Message, MessageEmbed } from "discord.js"; import { Client, Collection, Message, MessageEmbed } from "discord.js";
import Logger from "../utils/logger"; import Logger from "../../utils/logger";
import supabase from "../utils/database"; import supabase from "../../utils/database";
import { Command, Server, Usage } from "../utils/types"; import { Command, Server, Usage } from "../../utils/types";
import config from "../../config"; import config from "../../../config";
import { Commands, Shortlink, SourceFinder } from "../utils/wrapper.features"; import { Commands, Shortlink, SourceFinder } from "../../utils/wrapper.features";
import language from "../utils/language"; import mod from "../../utils/database";
import replace from "../utils/replace"; import language from "../../utils/language";
import replace from "../../utils/replace";
import chalk from "chalk"; import chalk from "chalk";
// import Prom from "../utils/init.prometheus"; // import Prom from "../utils/init.prometheus";
export = { export = {
name: "message", name: "message",
run: async (client: Client, message: Message) => { run: async (client: Client, message: Message) => {
@ -18,35 +20,35 @@ export = {
if (message.author.bot) return if (message.author.bot) return
if (message.channel.type === "dm") return if (message.channel.type === "dm") return
// ! Messages seen // // ! Messages seen
let { data: usage_data, error: usage_error } = await supabase.from<Usage>("usage").select().eq('name', "message") // let { data: usage_data, error: usage_error } = await supabase.from<Usage>("usage").select().eq('name', "message")
if (usage_data?.length === 0) { // if (usage_data?.length === 0) {
let { data: a, error: b } = await supabase.from<Usage>("usage").insert({ name: "message", type: "event" }).select() // let { data: a, error: b } = await supabase.from<Usage>("usage").insert({ name: "message", type: "event" }).select()
usage_data = a // usage_data = a
} // }
let { data: updated_usage_data, error } = await supabase.from<Usage>('usage').update({ amount: usage_data[0].amount + 1 }).select().eq("name", "message") // let { data: updated_usage_data, error } = await supabase.from<Usage>('usage').update({ amount: usage_data[0].amount + 1 }).select().eq("name", "message")
// ! Messages seen // // ! Messages seen
// ? Check if Server exists in DB // // ? Check if Server exists in DB
let { data: check_data, error: check_error } = await supabase.from<Server>("servers").select().eq(`server_id`, message.guild.id).limit(1) // let { data: check_data, error: check_error } = await supabase.from<Server>("servers").select().eq(`server_id`, message.guild.id).limit(1)
if (check_data?.length === 0) { // if (check_data?.length === 0) {
let { data: c, error: d } = await supabase.from<Server>('servers').insert({ // let { data: c, error: d } = await supabase.from<Server>('servers').insert({
server_id: message.guild?.id // server_id: message.guild?.id
}) // })
} // }
// ? Get Server Config // // ? Get Server Config
let { data: server_data, error: server_error } = await supabase.from<Server>("servers").select().eq(`server_id`, message.guild.id).limit(1) // let { data: server_data, error: server_error } = await supabase.from<Server>("servers").select().eq(`server_id`, message.guild.id).limit(1)
let server_data = await mod.server(message.guild.id)
// ? Check if Message includes Shortlinks // ? Check if Message includes Shortlinks
await Shortlink(message, server_data[0].shortlinks) await Shortlink(message, server_data.shortlinks)
// ? Check if Message includes E621 Image Links // ? Check if Message includes E621 Image Links
await SourceFinder(message, server_data[0].sourcefinder) await SourceFinder(message, server_data.sourcefinder)
// ? Check if Channel Topic allows Commands // ? Check if Channel Topic allows Commands
if (await Commands(message)) return; if (await Commands(message)) return;
// ! Prefix // ! Prefix
let PrefixArray: string[] = [...config.variables.prefix, [(server_data[0].prefix ? server_data[0].prefix : [])]].flat(Infinity) let PrefixArray: string[] = [...config.variables.prefix, [(server_data.prefix ? server_data.prefix : [])]].flat(Infinity)
let Prefix: string let Prefix: string
let Exists: boolean let Exists: boolean
@ -75,9 +77,9 @@ export = {
message, channel: message.channel, message, channel: message.channel,
author: message.author, author: message.author,
member: message.member, member: message.member,
supabase, modulus: mod,
language, language,
settings: server_data[0], settings: server_data,
config, config,
isDeveloper: config.variables.developers.find(dev => dev.id === message.author.id) isDeveloper: config.variables.developers.find(dev => dev.id === message.author.id)
} }
@ -113,19 +115,19 @@ export = {
try { try {
await cmd.command(ctx) await cmd.command(ctx)
// ? Check if Comnand exists in DB // // ? Check if Comnand exists in DB
let { data: usage_check_data, error: usage_check_error } = await supabase.from<Usage>("usage").select().eq(`name`, cmd.name).limit(1) // let { data: usage_check_data, error: usage_check_error } = await supabase.from<Usage>("usage").select().eq(`name`, cmd.name).limit(1)
if (usage_check_data?.length == 0) { // if (usage_check_data?.length == 0) {
let { data: c, error: d } = await supabase.from<Usage>('usage').insert({ // let { data: c, error: d } = await supabase.from<Usage>('usage').insert({
name: cmd.name, // name: cmd.name,
type: "command", // type: "command",
// amount: 1 // // amount: 1
}) // })
} // }
// Prom.commandsExecuted.inc() // Prom.commandsExecuted.inc()
let { data: command_usage_data, command_usage_error } = await supabase.from<Usage>('usage').update({ amount: (usage_check_data[0] || { amount: 0 }).amount + 1 }).select().eq("name", cmd.name) // let { data: command_usage_data, command_usage_error } = await supabase.from<Usage>('usage').update({ amount: (usage_check_data[0] || { amount: 0 }).amount + 1 }).select().eq("name", cmd.name)
Logger.info({ Logger.info({
type: "command:executed", type: "command:executed",
command: cmd.name, command: cmd.name,

View File

@ -1,5 +1,5 @@
import Logger from "../utils/logger" import Logger from "../../utils/logger"
import config from "../../config" import config from "../../../config"
// import prom from "../utils/init.prometheus" // import prom from "../utils/init.prometheus"
export = { export = {
name: "ready", name: "ready",

View File

@ -1,4 +1,4 @@
import Logger from "../utils/logger" import Logger from "../../utils/logger"
import { Guild } from "discord.js" import { Guild } from "discord.js"
// import Prom from "../utils/init.prometheus"; // import Prom from "../utils/init.prometheus";
export = { export = {

View File

@ -1,5 +1,5 @@
import { Client, Message } from "discord.js"; import { Client, Message } from "discord.js";
import Logger from "../utils/logger"; import Logger from "../../utils/logger";
export = { export = {
@ -9,7 +9,7 @@ export = {
if (old_message.content === new_message.content) return; if (old_message.content === new_message.content) return;
// Logger.info({ type: `event:messageUpdate`, message: "Emitting new message to event:message" }) // Logger.info({ type: `event:messageUpdate`, message: "Emitting new message to event:message" })
await client.emit("message", new_message) await client.emit("message", new_message)
} }

View File

@ -1,73 +0,0 @@
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";
// import { Prom } from "../../utils/prometheus";
// const server = require('../../website/server');
export default class Thaldrin extends Client {
commands: Collection<string, Command>;
cooldowns: Collection<unknown, unknown>;
config: any;
lastEval: any;
constructor(config: { token: any; }) {
super({
// disableEveryone: true,
// disabledEvents: ['TYPING_START'],
// shardCount: shards,
// totalShardCount: shards
});
this.commands = new Collection();
this.cooldowns = new Collection();
// this.queues = new Collection();
this.config = config;
this.lastEval = null;
// @ts-ignore
// this.on("raw", packet => {
// Prom.events.labels(packet.t).inc()
// })
this.login(config.token);
this.load();
}
async load() {
const events = await read(path.join(__dirname, '../../events'));
const modules = await read(path.join(__dirname, '../../modules'));
// server(this);
events.filter((f) => f.endsWith('.js')).forEach((file) => {
try {
const event = require(path.join(__dirname, '../../events', file));
this.on(event.name, event.run.bind(null, this));
} catch (err) {
console.error(err);
}
});
modules.filter((f) => !f.endsWith('.js')).forEach(async (module) => {
const commands = await read(path.join(__dirname, '../../modules', module));
commands.filter((f) => f.endsWith('.js')).forEach((command) => {
try {
const file = require(path.join(__dirname, '../../modules', module, command));
const Command = new file();
Command.module = module
// Logger.info({
// type: "command:loaded",
// command: Command.name,
// message: `${Command.name}:${Command.module} was loaded`
// })
this.commands.set(Command.name, Command);
} catch (err) {
console.error(err);
}
});
});
}
};

View File

@ -1,32 +0,0 @@
import { Context, Command as CommandContext } from "../../utils/types";
export default class Command {
name: string;
description: string;
aliases: string[];
module: string;
cooldown: number;
guild: boolean;
dev: boolean;
nsfw: boolean;
AuthorPermissions: string | string[];
hidden: boolean;
usage: string
constructor(command: CommandContext) {
this.name = command.name || "generic";
this.description = command.description || "generic command base";
this.aliases = command.aliases || [];
this.module = command.module || "";
this.cooldown = command.cooldown || 1;
this.guild = command.guild || false;
this.dev = command.dev || false;
this.nsfw = command.nsfw || false;
this.AuthorPermissions = command.AuthorPermissions || "NONE";
this.hidden = command.hidden || false;
this.usage = command.usage || ''
}
async run(ctx: Context) {
ctx.channel.send("This is the default command, overwrite me.")
}
};