Compare commits

...

6 Commits

Author SHA1 Message Date
Lio Young c67839e2ea update eu 2021-10-24 14:09:49 +02:00
Lio Young 09eeed1961 make the image focused commands quicker to make lol 2021-10-24 14:09:23 +02:00
Lio Young 4a48b3f2b0 create animal commands and use imageproxy 2021-10-22 17:29:39 +02:00
Lio Young e134e65045 add module-alias stuff 2021-10-21 21:20:22 +02:00
Lio Young 014e18f72a x 2021-10-21 21:19:14 +02:00
Lio Young e2be3a994f add new dns entries 2021-10-21 21:18:13 +02:00
25 changed files with 534 additions and 28 deletions

View File

@ -5,6 +5,9 @@ services:
hostname: cultum
restart: always
network_mode: "bridge"
dns:
- 1.1.1.1
- 1.0.0.1
ports:
- 80:80
volumes:
@ -18,5 +21,8 @@ services:
- cultum
restart: always
network_mode: "bridge"
dns:
- 1.1.1.1
- 1.0.0.1
volumes:
- ./config.ts:/opt/thaldrin/config.ts

View File

@ -1,9 +1,10 @@
import { Discord } from "./src/modules/eu/src/index"
import path from "path"
import config from "./src/utils/config"
import { Intents } from "./src/modules/eu/src/misc/imports"
import "./src/utils/patch"
// @ts-ignore
import modulus from "./src/utils/modulus"
import { Discord } from "@modules/eu/src/index"
import path from "path"
import config from "@utils/config"
import { Intents } from "@modules/eu/src/misc/imports"
const Bot = new Discord.Client({
@ -12,6 +13,9 @@ const Bot = new Discord.Client({
commands: path.join(__dirname, "src", "discord", "commands"),
events: path.join(__dirname, "src", "discord", "events"),
options: {
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.DIRECT_MESSAGES]
}
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.DIRECT_MESSAGES],
commandCategories: true,
debug: true
},
})

View File

@ -23,7 +23,8 @@
"module-alias": "^2.2.2",
"revolt-api": "^0.5.3-alpha.0-patch.0",
"revolt.js": "^5.1.0-alpha.0-patch.0",
"wavy": "^1.0.4"
"wavy": "^1.0.4",
"yiff": "^3.1.2"
},
"devDependencies": {
"@types/express": "^4.17.13",

View File

@ -14,6 +14,7 @@ specifiers:
revolt.js: ^5.1.0-alpha.0-patch.0
typescript: ^4.4.3
wavy: ^1.0.4
yiff: ^3.1.2
dependencies:
'@thaldrin/sourcefinder': 1.0.3
@ -26,6 +27,7 @@ dependencies:
revolt-api: 0.5.3-alpha.0-patch.0
revolt.js: 5.1.0-alpha.0-patch.0_typescript@4.4.3
wavy: 1.0.4
yiff: 3.1.2
devDependencies:
'@types/express': 4.17.13
@ -149,6 +151,13 @@ packages:
engines: {node: '>=8'}
dev: false
/ansi-styles/4.3.0:
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
engines: {node: '>=8'}
dependencies:
color-convert: 2.0.1
dev: false
/argparse/2.0.1:
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
dev: false
@ -185,6 +194,25 @@ packages:
engines: {node: '>=6'}
dev: false
/chalk/4.1.2:
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
engines: {node: '>=10'}
dependencies:
ansi-styles: 4.3.0
supports-color: 7.2.0
dev: false
/color-convert/2.0.1:
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
engines: {node: '>=7.0.0'}
dependencies:
color-name: 1.1.4
dev: false
/color-name/1.1.4:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
dev: false
/combined-stream/1.0.8:
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
engines: {node: '>= 0.8'}
@ -291,6 +319,11 @@ packages:
resolution: {integrity: sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=}
dev: false
/has-flag/4.0.0:
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
engines: {node: '>=8'}
dev: false
/is-obj/2.0.0:
resolution: {integrity: sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==}
engines: {node: '>=8'}
@ -450,6 +483,13 @@ packages:
ansi-regex: 5.0.0
dev: false
/supports-color/7.2.0:
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
engines: {node: '>=8'}
dependencies:
has-flag: 4.0.0
dev: false
/through/2.3.8:
resolution: {integrity: sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=}
dev: false
@ -536,3 +576,12 @@ packages:
utf-8-validate:
optional: true
dev: false
/yiff/3.1.2:
resolution: {integrity: sha512-F31hg2bGcLozNtw7vmD+LM/IRBNWreOzM/Fx1wIlaXOVKE8HS6iBaVw0dQROrFrcWpIftf1uVHrDe4GPWAPMDg==}
dependencies:
axios: 0.21.4
chalk: 4.1.2
transitivePeerDependencies:
- debug
dev: false

View File

@ -1,7 +1,8 @@
require("module-alias/register")
import "./src/utils/patch"
import { Discord } from "./src/modules/eu/src/index"
import config from "./src/utils/config"
import { Discord } from "@modules/eu/src/index"
import config from "@utils/config"
let Sharder = new Discord.ShardingManager('./build/index.js',
{

View File

@ -0,0 +1,23 @@
import { Context } from "@utils/types"
import { Command } from "@modules/eu/src/index"
import request from "@utils/animals"
import EmbeddingHandler from "@utils/Embed"
export = class Bird extends Command {
constructor() {
super({
name: "bird",
aliases: ["birb"],
description: "Sends a random bird image",
})
}
async run(context: Context): Promise<any> {
let data = await request("bird")
let Embed = new EmbeddingHandler(context, data)
return Embed.get()
}
}

View File

@ -0,0 +1,22 @@
import { Context } from "@utils/types"
import { Command } from "@modules/eu/src/index"
import request from "@utils/animals"
import EmbeddingHandler from "@utils/Embed"
export = class Cat extends Command {
constructor() {
super({
name: "cat",
description: "Sends a random cat image",
})
}
async run(context: Context): Promise<any> {
let data = await request("cat")
let Embed = new EmbeddingHandler(context, data)
return Embed.get()
}
}

View File

@ -0,0 +1,22 @@
import { Context } from "@utils/types"
import { Command } from "@modules/eu/src/index"
import request from "@utils/animals"
import EmbeddingHandler from "@utils/Embed"
export = class Fox extends Command {
constructor() {
super({
name: "fox",
description: "Sends a random fox image",
})
}
async run(context: Context): Promise<any> {
let data = await request("fox")
let Embed = new EmbeddingHandler(context, data)
return Embed.get()
}
}

View File

@ -0,0 +1,23 @@
import { Context } from "@utils/types"
import { Command } from "@modules/eu/src/index"
import request from "@utils/animals"
import EmbeddingHandler from "@utils/Embed"
export = class Hyena extends Command {
constructor() {
super({
name: "hyena",
aliases: ["yeen"],
description: "Sends a random yeen",
})
}
async run(context: Context): Promise<any> {
let data = await request("hyena")
let Embed = new EmbeddingHandler(context, data)
return Embed.get()
}
}

View File

@ -0,0 +1,22 @@
import { Context } from "@utils/types"
import { Command } from "@modules/eu/src/index"
import request from "@utils/animals"
import EmbeddingHandler from "@utils/Embed"
export = class Shibe extends Command {
constructor() {
super({
name: "shibe",
description: "Sends a random shibe",
})
}
async run(context: Context): Promise<any> {
let data = await request("shibe")
let Embed = new EmbeddingHandler(context, data)
return Embed.get()
}
}

View File

@ -0,0 +1,22 @@
import { Context } from "@utils/types"
import { Command } from "@modules/eu/src/index"
import request from "@utils/animals"
import EmbeddingHandler from "@utils/Embed"
export = class Wolf extends Command {
constructor() {
super({
name: "wolf",
description: "Sends a random Wolf image",
})
}
async run(context: Context): Promise<any> {
let data = await request("wolf")
let Embed = new EmbeddingHandler(context, data)
return Embed.get()
}
}

View File

@ -1,5 +1,5 @@
import { Context } from "../../utils/types"
import { Command } from "../../modules/eu/src/index"
import { Context } from "@utils/types"
import { Command } from "@modules/eu/src/index"
export = class TestingCommand extends Command {
constructor() {

View File

@ -0,0 +1,22 @@
import { Context } from "@utils/types"
import { Command } from "@modules/eu/src/index"
import { request } from "@utils/command.roleplay"
import EmbeddingHandler from "@utils/Embed"
export = class Boop extends Command {
constructor() {
super({
name: "boop",
description: "Boop a fellow fur!",
})
}
async run(context: Context): Promise<any> {
let data = await request("boop", context.settings.locale)
let Embed = new EmbeddingHandler(context, data)
return Embed.get()
}
}

View File

@ -0,0 +1,22 @@
import { Context } from "@utils/types"
import { Command } from "@modules/eu/src/index"
import { request } from "@utils/command.roleplay"
import EmbeddingHandler from "@utils/Embed"
export = class Cuddle extends Command {
constructor() {
super({
name: "cuddle",
description: "Cuddle a fellow fur!",
})
}
async run(context: Context): Promise<any> {
let data = await request("cuddle", context.settings.locale)
let Embed = new EmbeddingHandler(context, data)
return Embed.get()
}
}

View File

@ -0,0 +1,22 @@
import { Context } from "@utils/types"
import { Command } from "@modules/eu/src/index"
import { request } from "@utils/command.roleplay"
import EmbeddingHandler from "@utils/Embed"
export = class Hold extends Command {
constructor() {
super({
name: "hold",
description: "Hold a fellow fur tight!",
})
}
async run(context: Context): Promise<any> {
let data = await request("cuddle", context.settings.locale)
let Embed = new EmbeddingHandler(context, data)
return Embed.get()
}
}

View File

@ -0,0 +1,22 @@
import { Context } from "@utils/types"
import { Command } from "@modules/eu/src/index"
import { request } from "@utils/command.roleplay"
import EmbeddingHandler from "@utils/Embed"
export = class Hug extends Command {
constructor() {
super({
name: "hug",
description: "Hug a fellow fur!",
})
}
async run(context: Context): Promise<any> {
let data = await request("hug", context.settings.locale)
let Embed = new EmbeddingHandler(context, data)
return Embed.get()
}
}

View File

@ -0,0 +1,22 @@
import { Context } from "@utils/types"
import { Command } from "@modules/eu/src/index"
import { request } from "@utils/command.roleplay"
import EmbeddingHandler from "@utils/Embed"
export = class Lick extends Command {
constructor() {
super({
name: "lick",
description: "Lick someone!",
})
}
async run(context: Context): Promise<any> {
let data = await request("lick", context.settings.locale)
let Embed = new EmbeddingHandler(context, data)
return Embed.get()
}
}

View File

@ -1,21 +1,22 @@
// import "../../src/utils/patch"
import { Message, Collection, TextChannel, MessageEmbed } from 'discord.js';
import { Context } from '../../utils/types';
import { EuClient } from '../../modules/eu/src/misc/types';
import modulus from '../../utils/modulus'
import prefixHandler from '../../utils/prefix'
import config from '../../utils/config';
import language from '../../utils/language';
import replace from '../../utils/replace';
import { Context } from '@utils/types';
import { EuClient } from '@modules/eu/src/misc/types';
import modulus from '@utils/modulus'
import prefixHandler from '@utils/prefix'
import config from '@utils/config';
import language from '@utils/language';
import replace from '@utils/replace';
export = {
name: "messageCreate",
run: async (Eu: EuClient, message: Message) => {
if (message.author.bot) return;
let helper = await prefixHandler(message.guild.id, message.content)
if (!helper.success) return
// @ts-ignore
const cmd = Eu.commands.find((c) => c.name == helper.command || (c.aliases && c.aliases.includes(helper.command)))
const cmd = Eu.commands.find((c) => c.name.toLowerCase() == helper.command || (c.aliases && c.aliases.includes(helper.command)))
if (!cmd) return
if (!Eu.cooldowns.has(cmd.name)) {
@ -69,7 +70,7 @@ export = {
try {
await cmd.run(ctx)
} catch (error) {
console.error(error)
let ErrorEmbed = new MessageEmbed().setTitle(replace(/COMMAND/g, cmd.name, language.get(ctx.settings.locale).error.error)).setDescription(`\`${error.message}\`\n\n\`${error}\``).setColor("RED")
return message.channel.send({ embeds: [ErrorEmbed] })
}

View File

@ -1,8 +1,7 @@
import { Message } from 'discord.js';
import Shortlink from '../../utils/shortlink';
import { EuClient } from '../../modules/eu/src/misc/types';
import modulus from '../../utils/modulus'
import sauce from '../../utils/sourcefinder'
import { EuClient } from '@modules/eu/src/misc/types';
import modulus from '@utils/modulus'
import sauce from '@utils/sourcefinder'
export = {
name: "messageCreate",
run: async (Eu: EuClient, message: Message) => {

@ -1 +1 @@
Subproject commit b6ca8e21400e8cff9c36efd55714b2518772127d
Subproject commit 6c3b751429bca1b5e3f3825aba781d363df38dc5

33
src/utils/Embed.ts Normal file
View File

@ -0,0 +1,33 @@
import { MessageEmbed } from "discord.js";
import { Server, Context } from "@utils/types"
export default class EmbeddingHandler {
context: Context
image: string
provider: string
line?: string
constructor(context, data) {
this.context = context
this.image = [data.image].flat()[0]
this.provider = data.provider
this.line = data?.line
}
get() {
if (this.context.settings.embeds) {
let Embed = new MessageEmbed()
// @ts-ignore
.setImage(this.image)
.setFooter(`Thaldrin - Image provided by ${this.provider}`, "https://thaldrin.media/avatar.png")
.setColor("ORANGE")
if ((this.line && this.context.message.mentions.members.size !== 0) && this.context.settings.embeds) Embed.setDescription(`${this.line}`)
return this.context.channel.send({ embeds: [Embed] })
}
else {
if ((this.line && this.context.message.mentions.members.size !== 0) && this.context.settings.embeds) return this.context.channel.send(`${this.line}\n\n${this.image}`)
return this.context.channel.send(`${this.line}\n\n${this.image}`)
}
}
}

40
src/utils/animals.ts Normal file
View File

@ -0,0 +1,40 @@
import { ApplicationCommandPermissionTypes } from "discord.js/typings/enums";
import yiff from "./yiff";
type animal = "bird" | "cat" | "fox" | "hyena" | "shibe" | "wolf";
export default async function request(animal: animal) {
switch (animal) {
case "shibe": {
let request = await yiff.shibe("shibes", 1)
let proxied = request.map(x => ("https://proxy.thaldrin.media/" + x))
return { image: proxied, provider: "shibe.online" };
}
case "bird": {
let request = await yiff.shibe("birds", 1)
let proxied = request.map(x => ("https://proxy.thaldrin.media/" + x))
return { image: proxied, provider: "shibe.online" };
}
case "cat": {
let request = await yiff.shibe("cats", 1)
let proxied = request.map(x => ("https://proxy.thaldrin.media/" + x))
return { image: proxied, provider: "shibe.online" };
}
case "fox": {
let request = await yiff.thaldrin("foxes")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, provider: "thaldr.in" };
}
case "hyena": {
let request = await yiff.thaldrin("yeens")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, provider: "thaldr.in" };
}
case "wolf": {
let request = await yiff.thaldrin("wolves")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, provider: "thaldr.in" };
}
}
}

View File

@ -0,0 +1,97 @@
import yiff from "./yiff";
type action =
"hug"
| "boop"
| "kiss"
| "lick"
| "hold"
| "cuddle"
| "nsfw_hug"
| "nsfw_kiss"
| "nsfw_lick"
| "nsfw_hold"
| "nsfw_cuddle"
| "nsfw_bulge"
function line(category: action) {
return undefined
}
export async function request(action: action, locale: string) {
switch (action) {
case "hug": {
let request = await yiff.sheri("hug")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, line: line(action), provider: "sheri.bot" };
}
case "boop": {
let request = await yiff.sheri("boop")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, line: line(action), provider: "sheri.bot" };
}
case "kiss": {
let request = await yiff.sheri("kiss")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, line: line(action), provider: "sheri.bot" };
}
case "lick": {
let request = await yiff.sheri("lick")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, line: line(action), provider: "sheri.bot" };
}
case "hold": {
let request = await yiff.sheri("hold")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, line: line(action), provider: "sheri.bot" };
}
case "cuddle": {
let request = await yiff.sheri("cuddle")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, line: line(action), provider: "sheri.bot" };
}
case "nsfw_hug": {
let request = await yiff.sheri("nhug")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, line: line(action), provider: "sheri.bot" };
}
case "nsfw_kiss": {
let request = await yiff.sheri("nkiss")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, line: line(action), provider: "sheri.bot" };
}
case "nsfw_lick": {
let request = await yiff.sheri("nlick")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, line: line(action), provider: "sheri.bot" };
}
case "nsfw_hold": {
let request = await yiff.sheri("nhold")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, line: line(action), provider: "sheri.bot" };
}
case "nsfw_cuddle": {
let request = await yiff.sheri("ncuddle")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, line: line(action), provider: "sheri.bot" };
}
case "nsfw_bulge": {
let request = await yiff.sheri("nbulge")
let image = "https://proxy.thaldrin.media/" + request.url
return { image, line: line(action), provider: "sheri.bot" };
}
}
}

12
src/utils/patch.ts Normal file
View File

@ -0,0 +1,12 @@
import path from 'path';
const modulealias = require('module-alias');
let root = path.resolve(__dirname, '../../');
modulealias.addAliases({
'@root': root,
'@src': `${root}/src`,
'@utils': `${root}/src/utils`,
'@modules': `${root}/src/modules`,
})
// modulealias()

19
src/utils/yiff.ts Normal file
View File

@ -0,0 +1,19 @@
import Yiff from 'yiff'
import config from './config'
import pkg from '../../package.json'
let yiff = new Yiff({
useragent: `${pkg.name}/v${pkg.version} (t8.pm/bot)`,
killswitch: {
enabled: false
},
apikey: {
// @ts-ignore
sheri: config.tokens.sheri,
// @ts-ignore
yiffrest: config.tokens.yiffy,
// @ts-ignore
thaldrin: config.tokens.thaldrin
}
})
export default yiff