Compare commits

...

8 Commits

Author SHA1 Message Date
Lio Young f42f43128d hope this works? 2021-09-11 13:52:35 +02:00
Lio Young 7534d2d8e5 move to eu 2021-09-11 13:40:53 +02:00
Lio Young b5e08eabcc lock 2021-09-11 13:39:59 +02:00
Lio Young e19cd04b4f add eu, add cultum to build command 2021-09-11 13:39:33 +02:00
Lio Young d078721dbb edit utils 2021-09-11 13:38:36 +02:00
Lio Young 6145477a66 move database stufff to modulus 2021-09-11 13:38:09 +02:00
Lio Young d47197062f lux/cultum stuff 2021-09-11 13:37:47 +02:00
Lio Young 1b43ccfda4 move commands and events around 2021-09-11 13:36:51 +02:00
56 changed files with 1098 additions and 366 deletions

6
.gitmodules vendored
View File

@ -1,9 +1,9 @@
[submodule "src/utils/lingua"] [submodule "src/utils/lingua"]
path = src/utils/lingua path = src/utils/lingua
url = git@github.com:thaldrin/lingua.git url = git@github.com:thaldrin/lingua.git
[submodule "lux"]
path = lux
url = git@github.com:thaldrin/lux.git
[submodule "src/utils/modulus"] [submodule "src/utils/modulus"]
path = src/utils/modulus path = src/utils/modulus
url = git@github.com:thaldrin/modulus.git url = git@github.com:thaldrin/modulus.git
[submodule "lux"]
path = lux
url = git@github.com:thaldrin/lux.git

View File

@ -41,8 +41,15 @@ services:
# networks: # networks:
# - lantern # - lantern
# - default # - default
# networks: # cultum:
# lantern: # container_name: cultum
# restart: always
# hostname: cultum
# dns:
# - 1.1.1.1
# - 1.0.0.1
# network_mode: "bridge"
# build:
volumes: volumes:
grafana: grafana:
prometheus: prometheus:

View File

@ -1,4 +1,17 @@
//@ts-ignore //@ts-ignore
import config from "./config"; import config from "./config";
import client from "./src/handler/client/Client" import { Discord } from "@thaldrin/eu"
let Bot = new client(config) import { Intents } from "discord.js";
import { join } from 'path'
let Bot = new Discord.Client({
// @ts-ignore
token: config.discord?.token,
commands: join(__dirname, "src", "discord", 'commands'),
events: join(__dirname, "src", "discord", 'events'),
options: {
commandCategories: true,
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]
}
})

2
lux

@ -1 +1 @@
Subproject commit 5e4353759d897e9b1dc9b0a7a0a4b6bebe5c530d Subproject commit 4097d300c3ffa81b512c1d680bb2b6f1caedaf29

835
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
"description": "", "description": "",
"main": "build/shard.js", "main": "build/shard.js",
"scripts": { "scripts": {
"node:build": "rm -rf build/ && tsc && cp -r src/utils/lingua/langs build/src/utils/lingua/langs", "node:build": "rm -rf build/ && tsc && cp -r src/utils/lingua/langs build/src/utils/lingua/langs && cp cultum.config.yml build/cultum.config.yml",
"node:start": "node build/shard.js", "node:start": "node build/shard.js",
"node:dev": "nodemon --ignore \"build/\" -e js,ts --exec \"npm run node:build && npm run node:start\"", "node:dev": "nodemon --ignore \"build/\" -e js,ts --exec \"npm run node:build && npm run node:start\"",
"docker:build": "docker-compose build", "docker:build": "docker-compose build",
@ -27,6 +27,7 @@
"homepage": "https://github.com/thaldrin/thaldrin#readme", "homepage": "https://github.com/thaldrin/thaldrin#readme",
"dependencies": { "dependencies": {
"@supabase/supabase-js": "^1.7.7", "@supabase/supabase-js": "^1.7.7",
"@thaldrin/eu": "^0.0.5",
"@thaldrin/sourcefinder": "^1.0.3", "@thaldrin/sourcefinder": "^1.0.3",
"axios": "^0.21.1", "axios": "^0.21.1",
"chalk": "^4.1.0", "chalk": "^4.1.0",

View File

@ -1,8 +1,9 @@
import { ShardingManager } from "discord.js"; import { Discord } from "@thaldrin/eu";
import config from "./config"; import config from "./config";
import figlet from "figlet" import figlet from "figlet"
let Sharder = new ShardingManager('./build/index.js', {
token: config.token, let Sharder = new Discord.ShardingManager('./build/index.js', {
token: config.discord?.token,
totalShards: "auto" totalShards: "auto"
}) })
import chalk from "chalk" import chalk from "chalk"

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.")
}
};

View File

@ -1,7 +1,7 @@
import config from '../../config' import config from '../../config'
import replace from './replace' import replace from './replace'
let SensitiveStrings = [ let SensitiveStrings = [
config.token, config.discord?.token,
config.supabase.key, config.supabase.key,
config.supabase.url, config.supabase.url,
config.apis.sheri, config.apis.sheri,

View File

@ -1,5 +1,5 @@
import path from "path" import path from "path"
import { readdirSync as read } from "fs" import { readdirSync as read } from "fs"
import Thaldrin from '../handler/client/Client'
export async function Folders() { return await read(path.join(__dirname, '../modules')) } export async function Folders() { return await read(path.join(__dirname, '../modules')) }
export async function Commands(module: string, Thaldrin: Thaldrin) { return Thaldrin.commands.filter(command => command.module === module) } export async function Commands(module: string, Thaldrin: any) { return Thaldrin.commands.filter((command: any) => command.module === module) }

View File

@ -1,19 +1,16 @@
import supabase from "./database"; // import supabase from "./database";
import { Command, Usage } from "./types"; // import { Command, Usage } from "./types";
// import modulus from "./database"
// type C = { name: string; amount: number };
type C = { name: string; amount: number }; // export default async function usage(c: Map<string, Command>) {
// let commands: C[] = [];
export default async function usage(c: Map<string, Command>) { // let data = modulus.
let commands: C[] = []; // for(const command in data) {
// // @ts-ignore
// commands.push({ name: data[command].name, amount: data[command].amount });
// }
let { data, error } = await supabase // return commands.sort((a, b) => a.amount - b.amount);
.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.sort((a, b) => a.amount - b.amount);
}

View File

@ -1,9 +1,16 @@
import { createClient } from '@supabase/supabase-js' // import { createClient } from '@supabase/supabase-js'
import config from '../../config' // import config from '../../config'
import { Server } from "./types"; // import { Server } from "./types";
const supabase = createClient(config.supabase.url, config.supabase.key) // const supabase = createClient(config.supabase.url, config.supabase.key)
export default supabase // export default supabase
import Modulus from "../utils/modulus/src/index";
const modulus = new Modulus()
export default modulus

@ -1 +1 @@
Subproject commit 536e9c2391657d22bfb72c6270f998446036dbcb Subproject commit 78e731eab4fe88dbf15d1b654a25b4728c5a8cac

View File

@ -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"; import { EuClient } from "@thaldrin/eu/build/misc/types";
export type Features = export type Features =
| "shortlinks" | "shortlinks"
@ -56,14 +56,14 @@ export type Command = {
export type Context = { export type Context = {
client: Thaldrin; client: EuClient;
args: string[] args: string[]
guild: Guild | null; guild: Guild | null;
message: Message; message: Message;
channel: TextChannel | NewsChannel; channel: TextChannel | NewsChannel;
author: User; author: User;
member: GuildMember | null; member: GuildMember | null;
supabase: SupabaseClient; modulus: any;
settings: Server; settings: Server;
config: Config; config: Config;
isDeveloper: string[] isDeveloper: string[]
@ -88,7 +88,15 @@ export interface Config {
/** /**
* Discord API Token * Discord API Token
*/ */
token: string; discord?: {
token?: string
};
/**
* Revolt API Token
*/
revolt?: {
token?: string
};
/** /**
* Config Strings for Supabase * Config Strings for Supabase
* Thaldrin's Database * Thaldrin's Database
@ -183,9 +191,6 @@ export interface Variables {
} }
website: string website: string
invite: any; invite: any;
prometheus: {
port: number
}
} }
export interface Pkg { export interface Pkg {

View File

@ -20,7 +20,7 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"strictBindCallApply": true, "strictBindCallApply": true,
"strictPropertyInitialization": false, "strictPropertyInitialization": false,
"declaration": true "declaration": false
}, },
"include": ["**/*"], "include": ["**/*"],
"exclude": [ "exclude": [

View File

@ -53,7 +53,4 @@ export default {
color: "#ff995d", color: "#ff995d",
website: "thaldr.in", website: "thaldr.in",
invite: "https://t8.pm/legacy-invite", invite: "https://t8.pm/legacy-invite",
prometheus: {
port: 3621
}
} }