diff --git a/src/modules/animals/birb.ts b/src/discord/commands/animals/birb.ts similarity index 80% rename from src/modules/animals/birb.ts rename to src/discord/commands/animals/birb.ts index e16aa0f..2102788 100644 --- a/src/modules/animals/birb.ts +++ b/src/discord/commands/animals/birb.ts @@ -1,8 +1,8 @@ -import yiff from '../../utils/yiff'; -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import yiff from '../../../utils/yiff'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import request from '../../utils/animals'; +import request from '../../../utils/animals'; export = class Birb extends Command { constructor() { diff --git a/src/modules/animals/cat.ts b/src/discord/commands/animals/cat.ts similarity index 80% rename from src/modules/animals/cat.ts rename to src/discord/commands/animals/cat.ts index 1f15d23..6be75a8 100644 --- a/src/modules/animals/cat.ts +++ b/src/discord/commands/animals/cat.ts @@ -1,8 +1,8 @@ -import yiff from '../../utils/yiff'; -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import yiff from '../../../utils/yiff'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import request from '../../utils/animals'; +import request from '../../../utils/animals'; export = class Cat extends Command { constructor() { diff --git a/src/modules/animals/fox.ts b/src/discord/commands/animals/fox.ts similarity index 80% rename from src/modules/animals/fox.ts rename to src/discord/commands/animals/fox.ts index d984b17..38d316d 100644 --- a/src/modules/animals/fox.ts +++ b/src/discord/commands/animals/fox.ts @@ -1,8 +1,8 @@ -import yiff from '../../utils/yiff'; -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import yiff from '../../../utils/yiff'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import request from '../../utils/animals'; +import request from '../../../utils/animals'; export = class Fox extends Command { constructor() { diff --git a/src/modules/animals/hyena.ts b/src/discord/commands/animals/hyena.ts similarity index 80% rename from src/modules/animals/hyena.ts rename to src/discord/commands/animals/hyena.ts index a2a9922..c281bf1 100644 --- a/src/modules/animals/hyena.ts +++ b/src/discord/commands/animals/hyena.ts @@ -1,8 +1,8 @@ -import yiff from '../../utils/yiff'; -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import yiff from '../../../utils/yiff'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import request from '../../utils/animals'; +import request from '../../../utils/animals'; export = class Hyena extends Command { constructor() { diff --git a/src/modules/animals/shibe.ts b/src/discord/commands/animals/shibe.ts similarity index 80% rename from src/modules/animals/shibe.ts rename to src/discord/commands/animals/shibe.ts index a75ed73..514b9aa 100644 --- a/src/modules/animals/shibe.ts +++ b/src/discord/commands/animals/shibe.ts @@ -1,8 +1,8 @@ -import yiff from '../../utils/yiff'; -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import yiff from '../../../utils/yiff'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import request from '../../utils/animals'; +import request from '../../../utils/animals'; export = class Shibe extends Command { constructor() { diff --git a/src/modules/animals/wolf.ts b/src/discord/commands/animals/wolf.ts similarity index 80% rename from src/modules/animals/wolf.ts rename to src/discord/commands/animals/wolf.ts index 143b48e..4d2a467 100644 --- a/src/modules/animals/wolf.ts +++ b/src/discord/commands/animals/wolf.ts @@ -1,8 +1,8 @@ -import yiff from '../../utils/yiff'; -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import yiff from '../../../utils/yiff'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import request from '../../utils/animals'; +import request from '../../../utils/animals'; export = class Wolf extends Command { constructor() { diff --git a/src/modules/developer/eval.ts b/src/discord/commands/developer/eval.ts similarity index 84% rename from src/modules/developer/eval.ts rename to src/discord/commands/developer/eval.ts index 14bd408..4655029 100644 --- a/src/modules/developer/eval.ts +++ b/src/discord/commands/developer/eval.ts @@ -1,6 +1,6 @@ -import { Context } from "../../utils/types"; -import Command from "../../handler/structures/Command"; -import clean from "../../utils/clean" +import { Context } from "../../../utils/types"; +import { Command } from '@thaldrin/eu'; +import clean from "../../../utils/clean" export = class Eval extends Command { constructor() { super({ diff --git a/src/modules/developer/exec.ts b/src/discord/commands/developer/exec.ts similarity index 90% rename from src/modules/developer/exec.ts rename to src/discord/commands/developer/exec.ts index 6315218..cc12547 100644 --- a/src/modules/developer/exec.ts +++ b/src/discord/commands/developer/exec.ts @@ -1,6 +1,6 @@ -import Command from "../../handler/structures/Command"; +import { Command } from '@thaldrin/eu'; import { exec } from "child_process"; -import { Context } from "../../utils/types"; +import { Context } from "../../../utils/types"; export = class Exec extends Command { constructor() { diff --git a/src/modules/fun/boop.ts b/src/discord/commands/fun/boop.ts similarity index 87% rename from src/modules/fun/boop.ts rename to src/discord/commands/fun/boop.ts index f32447c..1bc07f9 100644 --- a/src/modules/fun/boop.ts +++ b/src/discord/commands/fun/boop.ts @@ -1,10 +1,10 @@ // @ts-nocheck -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import lingua from '../../utils/lingua'; -import replace from '../../utils/replace'; -import { request } from '../../utils/command.roleplay'; +import lingua from '../../../utils/lingua'; +import replace from '../../../utils/replace'; +import { request } from '../../../utils/command.roleplay'; export = class Boop extends Command { constructor() { diff --git a/src/modules/fun/cuddle.ts b/src/discord/commands/fun/cuddle.ts similarity index 87% rename from src/modules/fun/cuddle.ts rename to src/discord/commands/fun/cuddle.ts index fa69dce..bc6e96f 100644 --- a/src/modules/fun/cuddle.ts +++ b/src/discord/commands/fun/cuddle.ts @@ -1,10 +1,10 @@ // @ts-nocheck -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import lingua from '../../utils/lingua'; -import replace from '../../utils/replace'; -import { request } from '../../utils/command.roleplay'; +import lingua from '../../../utils/lingua'; +import replace from '../../../utils/replace'; +import { request } from '../../../utils/command.roleplay'; export = class Cuddle extends Command { constructor() { diff --git a/src/modules/fun/hold.ts b/src/discord/commands/fun/hold.ts similarity index 87% rename from src/modules/fun/hold.ts rename to src/discord/commands/fun/hold.ts index e38e9c6..2102b09 100644 --- a/src/modules/fun/hold.ts +++ b/src/discord/commands/fun/hold.ts @@ -1,10 +1,10 @@ // @ts-nocheck -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import language from '../../utils/language'; -import replace from '../../utils/replace'; -import { request } from '../../utils/command.roleplay'; +import language from '../../../utils/language'; +import replace from '../../../utils/replace'; +import { request } from '../../../utils/command.roleplay'; export = class Hold extends Command { constructor() { diff --git a/src/modules/fun/hug.ts b/src/discord/commands/fun/hug.ts similarity index 87% rename from src/modules/fun/hug.ts rename to src/discord/commands/fun/hug.ts index 4aeee5f..4be6566 100644 --- a/src/modules/fun/hug.ts +++ b/src/discord/commands/fun/hug.ts @@ -1,10 +1,10 @@ // @ts-nocheck -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import language from '../../utils/language'; -import replace from '../../utils/replace'; -import { request } from '../../utils/command.roleplay'; +import language from '../../../utils/language'; +import replace from '../../../utils/replace'; +import { request } from '../../../utils/command.roleplay'; export = class Hug extends Command { constructor() { diff --git a/src/modules/fun/lick.ts b/src/discord/commands/fun/lick.ts similarity index 87% rename from src/modules/fun/lick.ts rename to src/discord/commands/fun/lick.ts index caf03d0..25194f5 100644 --- a/src/modules/fun/lick.ts +++ b/src/discord/commands/fun/lick.ts @@ -1,10 +1,10 @@ // @ts-nocheck -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import language from '../../utils/language'; -import replace from '../../utils/replace'; -import { request } from '../../utils/command.roleplay'; +import language from '../../../utils/language'; +import replace from '../../../utils/replace'; +import { request } from '../../../utils/command.roleplay'; export = class Lick extends Command { constructor() { diff --git a/src/modules/info/about.ts b/src/discord/commands/info/about.ts similarity index 92% rename from src/modules/info/about.ts rename to src/discord/commands/info/about.ts index 2880c1b..da9f99b 100644 --- a/src/modules/info/about.ts +++ b/src/discord/commands/info/about.ts @@ -1,7 +1,7 @@ -import { Context } from '../../utils/types'; -import Command from '../../handler/structures/Command'; +import { Context } from '../../../utils/types'; +import { Command } from '@thaldrin/eu'; import { MessageEmbed } from 'discord.js'; -import config from '../../../config'; +import config from '../../../../config'; export = class Info extends Command { constructor() { @@ -22,6 +22,7 @@ export = class Info extends Command { }) devs = devs.join(' ') } else { + // @ts-ignore 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) { @@ -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)`) .addField("Contributors", `${contribs}`, false) .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("Website", `[${ctx.config.variables.website}](https://${ctx.config.variables.website})`, true) .setColor(ctx.config.variables.color) diff --git a/src/modules/info/locale.ts b/src/discord/commands/info/locale.ts similarity index 93% rename from src/modules/info/locale.ts rename to src/discord/commands/info/locale.ts index a0a58bd..6660405 100644 --- a/src/modules/info/locale.ts +++ b/src/discord/commands/info/locale.ts @@ -1,11 +1,11 @@ // @ts-nocheck -import Command from '../../handler/structures/Command'; -import { Context, Server } from '../../utils/types'; -import database from "../../utils/database" +import { Command } from '@thaldrin/eu'; +import { Context, Server } from '../../../utils/types'; +import database from "../../../utils/database" import path from 'path' -import langs from '../../utils/language'; +import langs from '../../../utils/language'; import { MessageEmbed } from 'discord.js'; -import replace from '../../utils/replace'; +import replace from '../../../utils/replace'; import fs from 'fs' import path from 'path' diff --git a/src/modules/info/ping.ts b/src/discord/commands/info/ping.ts similarity index 82% rename from src/modules/info/ping.ts rename to src/discord/commands/info/ping.ts index c3c9afe..bc088a9 100644 --- a/src/modules/info/ping.ts +++ b/src/discord/commands/info/ping.ts @@ -1,6 +1,6 @@ -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; -import lingua from '../../utils/lingua'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; +import lingua from '../../../utils/lingua'; export = class Ping extends Command { constructor() { @@ -14,6 +14,7 @@ export = class Ping extends Command { async command(ctx: Context) { const ping = await ctx.channel.send("Pinging...") const rest = Math.round(ping.createdTimestamp - ctx.message.createdTimestamp) + // @ts-ignore const ws = Math.round(ctx.client.ws.ping) // @ts-ignore const shard = Math.round(ctx.guild?.shard.ping) diff --git a/src/modules/info/settings.ts b/src/discord/commands/info/settings.ts similarity index 96% rename from src/modules/info/settings.ts rename to src/discord/commands/info/settings.ts index 56f0f06..083e5a9 100644 --- a/src/modules/info/settings.ts +++ b/src/discord/commands/info/settings.ts @@ -1,9 +1,9 @@ -import Command from '../../handler/structures/Command'; -import { Context, Server } from '../../utils/types'; -import lingua from '../../utils/lingua'; +import { Command } from '@thaldrin/eu'; +import { Context, Server } from '../../../utils/types'; +import lingua from '../../../utils/lingua'; import { MessageEmbed } from 'discord.js'; -import database from "../../utils/database" -import language from '../../utils/language'; +import database from "../../../utils/database" +import language from '../../../utils/language'; function enabled(a: boolean, lang: string) { // @ts-ignore diff --git a/src/modules/info/stats.ts b/src/discord/commands/info/stats.ts similarity index 86% rename from src/modules/info/stats.ts rename to src/discord/commands/info/stats.ts index 92cca97..55dce0a 100644 --- a/src/modules/info/stats.ts +++ b/src/discord/commands/info/stats.ts @@ -1,9 +1,9 @@ -import Command from '../../handler/structures/Command'; -import { Context, Usage } from '../../utils/types'; +import { Command } from '@thaldrin/eu'; +import { Context, Usage } from '../../../utils/types'; // import lingua from '../../utils/lingua'; import { MessageEmbed } from 'discord.js'; -import CommandUsage from '../../utils/command.usage'; -import { commitHash } from "../../utils/git" +// import CommandUsage from '../../../src/utils/command.usage'; +import { commitHash } from "../../../utils/git" function uptime(ms: number) { function pad(s: number) { @@ -30,7 +30,9 @@ export = class Stats extends Command { async command(ctx: Context) { // @ts-ignore const guilds = (await ctx.client.shard?.fetchClientValues(`guilds.cache.size`)).reduce((a, b) => a + b, 0) + // @ts-ignore const shards = ctx.client.shard?.count + // @ts-ignore const users = (await ctx.client.shard?.fetchClientValues(`users.cache.size`))?.reduce((a, b) => a + b, 0) let MiscValues = [ diff --git a/src/modules/info/user.ts b/src/discord/commands/info/user.ts similarity index 91% rename from src/modules/info/user.ts rename to src/discord/commands/info/user.ts index 53bf52f..b0d46e3 100644 --- a/src/modules/info/user.ts +++ b/src/discord/commands/info/user.ts @@ -1,8 +1,8 @@ -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; -import language from '../../utils/language'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; +import language from '../../../utils/language'; import { Guild, GuildMember, MessageEmbed, User as DiscordUser } from 'discord.js'; -import replace from '../../utils/replace'; +import replace from '../../../utils/replace'; let MentionRegex = /^<@!?(\d+)>$/gi diff --git a/src/modules/misc/bug.ts b/src/discord/commands/misc/bug.ts similarity index 75% rename from src/modules/misc/bug.ts rename to src/discord/commands/misc/bug.ts index fc9c799..36ab78e 100644 --- a/src/modules/misc/bug.ts +++ b/src/discord/commands/misc/bug.ts @@ -1,9 +1,9 @@ -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; -import SendWS from "../../utils/webhook"; -import language from '../../utils/language'; -import { bug } from '../../utils/trello'; -import replace from '../../utils/replace'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; +import SendWS from "../../../utils/webhook"; +import language from '../../../utils/language'; +import { bug } from '../../../utils/trello'; +import replace from '../../../utils/replace'; export = class Suggestion extends Command { constructor() { super({ diff --git a/src/modules/misc/donate.ts b/src/discord/commands/misc/donate.ts similarity index 88% rename from src/modules/misc/donate.ts rename to src/discord/commands/misc/donate.ts index 1d672b8..8c44cf0 100644 --- a/src/modules/misc/donate.ts +++ b/src/discord/commands/misc/donate.ts @@ -1,7 +1,7 @@ -import Command from "../../handler/structures/Command"; -import { Context } from "../../utils/types"; -import lingua from "../../utils/lingua"; -import replace from "../../utils/replace"; +import { Command } from '@thaldrin/eu'; +import { Context } from "../../../utils/types"; +import lingua from "../../../utils/lingua"; +import replace from "../../../utils/replace"; import { MessageEmbed } from "discord.js"; let perks = [ diff --git a/src/modules/misc/e926.ts b/src/discord/commands/misc/e926.ts similarity index 86% rename from src/modules/misc/e926.ts rename to src/discord/commands/misc/e926.ts index a725386..0f146f8 100644 --- a/src/modules/misc/e926.ts +++ b/src/discord/commands/misc/e926.ts @@ -1,8 +1,8 @@ -import yiff from "../../utils/yiff" -import Command from "../../handler/structures/Command" -import { Context } from "../../utils/types"; +import yiff from "../../../utils/yiff" +import { Command } from '@thaldrin/eu'; +import { Context } from "../../../utils/types"; import { MessageEmbed } from "discord.js" -import language from "../../utils/language"; +import language from "../../../utils/language"; export = class E926 extends Command { constructor() { super({ diff --git a/src/modules/misc/help.ts b/src/discord/commands/misc/help.ts similarity index 91% rename from src/modules/misc/help.ts rename to src/discord/commands/misc/help.ts index 804f534..8618842 100644 --- a/src/modules/misc/help.ts +++ b/src/discord/commands/misc/help.ts @@ -1,7 +1,7 @@ -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; -import language from '../../utils/language'; -import { Folders, Commands } from "../../utils/command.amount"; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; +import language from '../../../utils/language'; +import { Folders, Commands } from "../../../utils/command.amount"; import { MessageEmbed } from 'discord.js'; export = class Help extends Command { @@ -31,6 +31,7 @@ export = class Help extends Command { let arg = ctx.args[0] if (await (await Folders()).includes(arg)) { if (arg === 'developer' && !ctx.isDeveloper) return + // @ts-ignore let commands = await (await Commands(arg, ctx.client)).map(command => `\`${command.name}\` - ${command.description}`) embed.addField("Commands", commands.join("\n")) // @ts-ignore diff --git a/src/modules/misc/invite.ts b/src/discord/commands/misc/invite.ts similarity index 73% rename from src/modules/misc/invite.ts rename to src/discord/commands/misc/invite.ts index 9db51d8..475f9e6 100644 --- a/src/modules/misc/invite.ts +++ b/src/discord/commands/misc/invite.ts @@ -1,7 +1,8 @@ -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; -import language from '../../utils/language'; -import replace from '../../utils/replace'; +import { Command } from '@thaldrin/eu'; + +import { Context } from '../../../utils/types'; +import language from '../../../utils/language'; +import replace from '../../../utils/replace'; export = class Invite extends Command { constructor() { diff --git a/src/modules/misc/prefix.ts b/src/discord/commands/misc/prefix.ts similarity index 93% rename from src/modules/misc/prefix.ts rename to src/discord/commands/misc/prefix.ts index fa2c6ee..49952e7 100644 --- a/src/modules/misc/prefix.ts +++ b/src/discord/commands/misc/prefix.ts @@ -1,8 +1,8 @@ -import Command from '../../handler/structures/Command'; -import { Context, Server } from '../../utils/types'; -import database from "../../utils/database" -import language from '../../utils/language'; -import replace from '../../utils/replace'; +import { Command } from '@thaldrin/eu'; +import { Context, Server } from '../../../utils/types'; +import database from "../../../utils/database" +import language from '../../../utils/language'; +import replace from '../../../utils/replace'; import { MessageEmbed } from 'discord.js'; export = class Prefix extends Command { constructor() { diff --git a/src/modules/misc/roll.ts b/src/discord/commands/misc/roll.ts similarity index 77% rename from src/modules/misc/roll.ts rename to src/discord/commands/misc/roll.ts index cc38ab7..ea32095 100644 --- a/src/modules/misc/roll.ts +++ b/src/discord/commands/misc/roll.ts @@ -1,7 +1,7 @@ -import Command from "../../handler/structures/Command"; -import { Context } from "../../utils/types"; -import language from "../../utils/language"; -import replace from "../../utils/replace"; +import { Command } from '@thaldrin/eu'; +import { Context } from "../../../utils/types"; +import language from "../../../utils/language"; +import replace from "../../../utils/replace"; import Roll from 'roll' const roll = new Roll() diff --git a/src/modules/misc/suggestion.ts b/src/discord/commands/misc/suggestion.ts similarity index 79% rename from src/modules/misc/suggestion.ts rename to src/discord/commands/misc/suggestion.ts index 0d983ac..75df82f 100644 --- a/src/modules/misc/suggestion.ts +++ b/src/discord/commands/misc/suggestion.ts @@ -1,8 +1,8 @@ -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; -import SendWS from "../../utils/webhook"; -import language from '../../utils/language'; -import { suggest } from '../../utils/trello'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; +import SendWS from "../../../utils/webhook"; +import language from '../../../utils/language'; +import { suggest } from '../../../utils/trello'; export = class Suggestion extends Command { constructor() { super({ diff --git a/src/modules/nsfw/bulge.ts b/src/discord/commands/nsfw/bulge.ts similarity index 87% rename from src/modules/nsfw/bulge.ts rename to src/discord/commands/nsfw/bulge.ts index 2975f55..b272e36 100644 --- a/src/modules/nsfw/bulge.ts +++ b/src/discord/commands/nsfw/bulge.ts @@ -1,10 +1,10 @@ // @ts-nocheck -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import language from '../../utils/language'; -import replace from '../../utils/replace'; -import { request } from '../../utils/command.roleplay'; +import language from '../../../utils/language'; +import replace from '../../../utils/replace'; +import { request } from '../../../utils/command.roleplay'; export = class Bulge extends Command { constructor() { diff --git a/src/modules/nsfw/e621.ts b/src/discord/commands/nsfw/e621.ts similarity index 86% rename from src/modules/nsfw/e621.ts rename to src/discord/commands/nsfw/e621.ts index 3c46347..f4d49a9 100644 --- a/src/modules/nsfw/e621.ts +++ b/src/discord/commands/nsfw/e621.ts @@ -1,8 +1,8 @@ -import yiff from "../../utils/yiff" -import Command from "../../handler/structures/Command" -import { Context } from "../../utils/types"; +import yiff from "../../../utils/yiff" +import { Command } from '@thaldrin/eu'; +import { Context } from "../../../utils/types"; import { MessageEmbed } from "discord.js" -import language from "../../utils/language"; +import language from "../../../utils/language"; export = class E621 extends Command { constructor() { super({ diff --git a/src/modules/nsfw/ncuddle.ts b/src/discord/commands/nsfw/ncuddle.ts similarity index 87% rename from src/modules/nsfw/ncuddle.ts rename to src/discord/commands/nsfw/ncuddle.ts index c069e91..a070a3a 100644 --- a/src/modules/nsfw/ncuddle.ts +++ b/src/discord/commands/nsfw/ncuddle.ts @@ -1,10 +1,9 @@ // @ts-nocheck -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import { Command } from '@thaldrin/eu'; import { MessageEmbed } from 'discord.js'; -import language from '../../utils/language'; -import replace from '../../utils/replace'; -import { request } from '../../utils/command.roleplay'; +import language from '../../../utils/language'; +import replace from '../../../utils/replace'; +import { request } from '../../../utils/command.roleplay'; export = class NSFW_Cuddle extends Command { constructor() { diff --git a/src/modules/nsfw/nhold.ts b/src/discord/commands/nsfw/nhold.ts similarity index 85% rename from src/modules/nsfw/nhold.ts rename to src/discord/commands/nsfw/nhold.ts index f47bfcd..b3d1565 100644 --- a/src/modules/nsfw/nhold.ts +++ b/src/discord/commands/nsfw/nhold.ts @@ -1,16 +1,16 @@ // @ts-nocheck -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import language from '../../utils/language'; -import replace from '../../utils/replace'; -import { request } from '../../utils/command.roleplay'; +import language from '../../../utils/language'; +import replace from '../../../utils/replace'; +import { request } from '../../../utils/command.roleplay'; export = class NSFW_Hold extends Command { constructor() { super({ name: "nhold", - description: "Hug somebody!", + description: "Hold somebody!", cooldown: 1, nsfw: true, usage: `<@User>` diff --git a/src/modules/nsfw/nhug.ts b/src/discord/commands/nsfw/nhug.ts similarity index 87% rename from src/modules/nsfw/nhug.ts rename to src/discord/commands/nsfw/nhug.ts index 9e9371b..973a488 100644 --- a/src/modules/nsfw/nhug.ts +++ b/src/discord/commands/nsfw/nhug.ts @@ -1,10 +1,10 @@ // @ts-nocheck -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import language from '../../utils/language'; -import replace from '../../utils/replace'; -import { request } from '../../utils/command.roleplay'; +import language from '../../../utils/language'; +import replace from '../../../utils/replace'; +import { request } from '../../../utils/command.roleplay'; export = class NSFW_Hug extends Command { constructor() { diff --git a/src/modules/nsfw/nkiss.ts b/src/discord/commands/nsfw/nkiss.ts similarity index 87% rename from src/modules/nsfw/nkiss.ts rename to src/discord/commands/nsfw/nkiss.ts index 06aeb6e..8bc96f5 100644 --- a/src/modules/nsfw/nkiss.ts +++ b/src/discord/commands/nsfw/nkiss.ts @@ -1,10 +1,10 @@ // @ts-nocheck -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import language from '../../utils/language'; -import replace from '../../utils/replace'; -import { request } from '../../utils/command.roleplay'; +import language from '../../../utils/language'; +import replace from '../../../utils/replace'; +import { request } from '../../../utils/command.roleplay'; export = class NSFW_Kiss extends Command { constructor() { diff --git a/src/modules/nsfw/nlick.ts b/src/discord/commands/nsfw/nlick.ts similarity index 87% rename from src/modules/nsfw/nlick.ts rename to src/discord/commands/nsfw/nlick.ts index e213562..2718df8 100644 --- a/src/modules/nsfw/nlick.ts +++ b/src/discord/commands/nsfw/nlick.ts @@ -1,10 +1,10 @@ // @ts-nocheck -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; +import { Command } from '@thaldrin/eu'; +import { Context } from '../../../utils/types'; import { MessageEmbed } from 'discord.js'; -import language from '../../utils/language'; -import replace from '../../utils/replace'; -import { request } from '../../utils/command.roleplay'; +import language from '../../../utils/language'; +import replace from '../../../utils/replace'; +import { request } from '../../../utils/command.roleplay'; export = class NSFW_Lick extends Command { constructor() { diff --git a/src/events/create.guild.ts b/src/discord/events/create.guild.ts similarity index 84% rename from src/events/create.guild.ts rename to src/discord/events/create.guild.ts index e17c956..cc0c7c6 100644 --- a/src/events/create.guild.ts +++ b/src/discord/events/create.guild.ts @@ -1,5 +1,5 @@ -import Logger from "../utils/logger" -import config from "../../config" +import Logger from "../../utils/logger" +import config from "../../../config" import { Guild } from "discord.js" // import Prom from "../utils/init.prometheus"; export = { diff --git a/src/events/message.ts b/src/discord/events/message.ts similarity index 61% rename from src/events/message.ts rename to src/discord/events/message.ts index 29792d0..95b407e 100644 --- a/src/events/message.ts +++ b/src/discord/events/message.ts @@ -1,16 +1,18 @@ // @ts-nocheck import { Client, Collection, Message, MessageEmbed } from "discord.js"; -import Logger from "../utils/logger"; -import supabase from "../utils/database"; -import { Command, Server, Usage } from "../utils/types"; -import config from "../../config"; -import { Commands, Shortlink, SourceFinder } from "../utils/wrapper.features"; -import language from "../utils/language"; -import replace from "../utils/replace"; +import Logger from "../../utils/logger"; +import supabase from "../../utils/database"; +import { Command, Server, Usage } from "../../utils/types"; +import config from "../../../config"; +import { Commands, Shortlink, SourceFinder } from "../../utils/wrapper.features"; +import mod from "../../utils/database"; +import language from "../../utils/language"; +import replace from "../../utils/replace"; import chalk from "chalk"; // import Prom from "../utils/init.prometheus"; + export = { name: "message", run: async (client: Client, message: Message) => { @@ -18,35 +20,35 @@ export = { if (message.author.bot) return if (message.channel.type === "dm") return - // ! Messages seen - let { data: usage_data, error: usage_error } = await supabase.from("usage").select().eq('name', "message") - if (usage_data?.length === 0) { - let { data: a, error: b } = await supabase.from("usage").insert({ name: "message", type: "event" }).select() - usage_data = a - } - let { data: updated_usage_data, error } = await supabase.from('usage').update({ amount: usage_data[0].amount + 1 }).select().eq("name", "message") - // ! Messages seen + // // ! Messages seen + // let { data: usage_data, error: usage_error } = await supabase.from("usage").select().eq('name', "message") + // if (usage_data?.length === 0) { + // let { data: a, error: b } = await supabase.from("usage").insert({ name: "message", type: "event" }).select() + // usage_data = a + // } + // let { data: updated_usage_data, error } = await supabase.from('usage').update({ amount: usage_data[0].amount + 1 }).select().eq("name", "message") + // // ! Messages seen - // ? Check if Server exists in DB - let { data: check_data, error: check_error } = await supabase.from("servers").select().eq(`server_id`, message.guild.id).limit(1) - if (check_data?.length === 0) { - let { data: c, error: d } = await supabase.from('servers').insert({ - server_id: message.guild?.id - }) - } - // ? Get Server Config - let { data: server_data, error: server_error } = await supabase.from("servers").select().eq(`server_id`, message.guild.id).limit(1) - + // // ? Check if Server exists in DB + // let { data: check_data, error: check_error } = await supabase.from("servers").select().eq(`server_id`, message.guild.id).limit(1) + // if (check_data?.length === 0) { + // let { data: c, error: d } = await supabase.from('servers').insert({ + // server_id: message.guild?.id + // }) + // } + // // ? Get Server Config + // let { data: server_data, error: server_error } = await supabase.from("servers").select().eq(`server_id`, message.guild.id).limit(1) + let server_data = await mod.server(message.guild.id) // ? 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 - await SourceFinder(message, server_data[0].sourcefinder) + await SourceFinder(message, server_data.sourcefinder) // ? Check if Channel Topic allows Commands if (await Commands(message)) return; // ! 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 Exists: boolean @@ -75,9 +77,9 @@ export = { message, channel: message.channel, author: message.author, member: message.member, - supabase, + modulus: mod, language, - settings: server_data[0], + settings: server_data, config, isDeveloper: config.variables.developers.find(dev => dev.id === message.author.id) } @@ -113,19 +115,19 @@ export = { try { await cmd.command(ctx) - // ? Check if Comnand exists in DB - let { data: usage_check_data, error: usage_check_error } = await supabase.from("usage").select().eq(`name`, cmd.name).limit(1) - if (usage_check_data?.length == 0) { - let { data: c, error: d } = await supabase.from('usage').insert({ - name: cmd.name, - type: "command", - // amount: 1 - }) + // // ? Check if Comnand exists in DB + // let { data: usage_check_data, error: usage_check_error } = await supabase.from("usage").select().eq(`name`, cmd.name).limit(1) + // if (usage_check_data?.length == 0) { + // let { data: c, error: d } = await supabase.from('usage').insert({ + // name: cmd.name, + // type: "command", + // // amount: 1 + // }) - } + // } // Prom.commandsExecuted.inc() - let { data: command_usage_data, command_usage_error } = await supabase.from('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').update({ amount: (usage_check_data[0] || { amount: 0 }).amount + 1 }).select().eq("name", cmd.name) Logger.info({ type: "command:executed", command: cmd.name, diff --git a/src/events/ready.ts b/src/discord/events/ready.ts similarity index 80% rename from src/events/ready.ts rename to src/discord/events/ready.ts index f13db86..017db1f 100644 --- a/src/events/ready.ts +++ b/src/discord/events/ready.ts @@ -1,5 +1,5 @@ -import Logger from "../utils/logger" -import config from "../../config" +import Logger from "../../utils/logger" +import config from "../../../config" // import prom from "../utils/init.prometheus" export = { name: "ready", diff --git a/src/events/remove.guild.ts b/src/discord/events/remove.guild.ts similarity index 90% rename from src/events/remove.guild.ts rename to src/discord/events/remove.guild.ts index f02b5d5..99a5c55 100644 --- a/src/events/remove.guild.ts +++ b/src/discord/events/remove.guild.ts @@ -1,4 +1,4 @@ -import Logger from "../utils/logger" +import Logger from "../../utils/logger" import { Guild } from "discord.js" // import Prom from "../utils/init.prometheus"; export = { diff --git a/src/events/update.message.ts b/src/discord/events/update.message.ts similarity index 70% rename from src/events/update.message.ts rename to src/discord/events/update.message.ts index 0602e66..7ba8e4b 100644 --- a/src/events/update.message.ts +++ b/src/discord/events/update.message.ts @@ -1,5 +1,5 @@ import { Client, Message } from "discord.js"; -import Logger from "../utils/logger"; +import Logger from "../../utils/logger"; export = { @@ -9,7 +9,7 @@ export = { 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) } diff --git a/src/handler/client/Client.ts b/src/handler/client/Client.ts deleted file mode 100644 index dea3b6d..0000000 --- a/src/handler/client/Client.ts +++ /dev/null @@ -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; - cooldowns: Collection; - 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); - } - }); - }); - } -}; \ No newline at end of file diff --git a/src/handler/structures/Command.ts b/src/handler/structures/Command.ts deleted file mode 100644 index 10fefb6..0000000 --- a/src/handler/structures/Command.ts +++ /dev/null @@ -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.") - } -};