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"]
path = src/utils/lingua
url = git@github.com:thaldrin/lingua.git
[submodule "lux"]
path = lux
url = git@github.com:thaldrin/lux.git
[submodule "src/utils/modulus"]
path = src/utils/modulus
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:
# - lantern
# - default
# networks:
# lantern:
# cultum:
# container_name: cultum
# restart: always
# hostname: cultum
# dns:
# - 1.1.1.1
# - 1.0.0.1
# network_mode: "bridge"
# build:
volumes:
grafana:
prometheus:

View File

@ -1,4 +1,17 @@
//@ts-ignore
import config from "./config";
import client from "./src/handler/client/Client"
let Bot = new client(config)
import { Discord } from "@thaldrin/eu"
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": "",
"main": "build/shard.js",
"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:dev": "nodemon --ignore \"build/\" -e js,ts --exec \"npm run node:build && npm run node:start\"",
"docker:build": "docker-compose build",
@ -27,6 +27,7 @@
"homepage": "https://github.com/thaldrin/thaldrin#readme",
"dependencies": {
"@supabase/supabase-js": "^1.7.7",
"@thaldrin/eu": "^0.0.5",
"@thaldrin/sourcefinder": "^1.0.3",
"axios": "^0.21.1",
"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 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"
})
import chalk from "chalk"

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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({

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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)

View File

@ -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'

View File

@ -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)

View File

@ -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

View File

@ -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 = [

View File

@ -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

View File

@ -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({

View File

@ -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 = [

View File

@ -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({

View File

@ -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

View File

@ -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() {

View File

@ -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() {

View File

@ -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()

View File

@ -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({

View File

@ -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() {

View File

@ -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({

View File

@ -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() {

View File

@ -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>`

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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 = {

View File

@ -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>("usage").select().eq('name', "message")
if (usage_data?.length === 0) {
let { data: a, error: b } = await supabase.from<Usage>("usage").insert({ name: "message", type: "event" }).select()
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")
// ! Messages seen
// // ! Messages seen
// let { data: usage_data, error: usage_error } = await supabase.from<Usage>("usage").select().eq('name', "message")
// if (usage_data?.length === 0) {
// let { data: a, error: b } = await supabase.from<Usage>("usage").insert({ name: "message", type: "event" }).select()
// 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")
// // ! Messages seen
// ? 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)
if (check_data?.length === 0) {
let { data: c, error: d } = await supabase.from<Server>('servers').insert({
server_id: message.guild?.id
})
}
// ? Get Server Config
let { data: server_data, error: server_error } = await supabase.from<Server>("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<Server>("servers").select().eq(`server_id`, message.guild.id).limit(1)
// if (check_data?.length === 0) {
// let { data: c, error: d } = await supabase.from<Server>('servers').insert({
// server_id: message.guild?.id
// })
// }
// // ? 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 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>("usage").select().eq(`name`, cmd.name).limit(1)
if (usage_check_data?.length == 0) {
let { data: c, error: d } = await supabase.from<Usage>('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>("usage").select().eq(`name`, cmd.name).limit(1)
// if (usage_check_data?.length == 0) {
// let { data: c, error: d } = await supabase.from<Usage>('usage').insert({
// name: cmd.name,
// type: "command",
// // amount: 1
// })
}
// }
// 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({
type: "command:executed",
command: cmd.name,

View File

@ -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",

View File

@ -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 = {

View File

@ -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)
}

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 replace from './replace'
let SensitiveStrings = [
config.token,
config.discord?.token,
config.supabase.key,
config.supabase.url,
config.apis.sheri,

View File

@ -1,5 +1,5 @@
import path from "path"
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 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 { Command, Usage } from "./types";
// import supabase from "./database";
// 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 commands: C[] = [];
// let data = modulus.
// for(const command in data) {
// // @ts-ignore
// commands.push({ name: data[command].name, amount: data[command].amount });
// }
let { data, error } = await supabase
.from<Usage>("usage")
.select()
.filter("type", "eq", "command");
for (const command in data) {
// @ts-ignore
commands.push({ name: data[command].name, amount: data[command].amount });
}
return commands.sort((a, b) => a.amount - b.amount);
}
// return commands.sort((a, b) => a.amount - b.amount);
// }

View File

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

View File

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

View File

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