From 253579265a1aae143cd31c9e4496fa38309e2f97 Mon Sep 17 00:00:00 2001 From: Lio Young Date: Sat, 8 May 2021 01:57:48 +0200 Subject: [PATCH] so many fixes --- package.json | 4 +- src/modules/{roleplay => fun}/hug.ts | 4 +- src/modules/general/help.ts | 32 -------------- .../{general/info.ts => info/about.ts} | 3 +- src/modules/{general => info}/ping.ts | 0 src/modules/{misc => info}/stats.ts | 2 +- src/modules/misc/e926.ts | 2 +- src/modules/misc/help.ts | 43 +++++++++++++++++++ src/modules/misc/invite.ts | 1 - src/modules/{general => misc}/suggestion.ts | 0 src/modules/nsfw/e621.ts | 18 ++++---- src/utils/lingua | 2 +- 12 files changed, 60 insertions(+), 51 deletions(-) rename src/modules/{roleplay => fun}/hug.ts (94%) delete mode 100644 src/modules/general/help.ts rename src/modules/{general/info.ts => info/about.ts} (97%) rename src/modules/{general => info}/ping.ts (100%) rename src/modules/{misc => info}/stats.ts (92%) create mode 100644 src/modules/misc/help.ts rename src/modules/{general => misc}/suggestion.ts (100%) diff --git a/package.json b/package.json index 0dca45a..a77ddf7 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,9 @@ "description": "", "main": "build/shard.js", "scripts": { - "build": "tsc", + "build": "rm -rf build/ && tsc", "start": "node build/shard.js", - "dev": "nodemon --ignore \"./build\" -e js,ts --exec \"npm run build && npm run start\"", + "dev": "nodemon --ignore \"build/\" -e js,ts --exec \"npm run build && npm run start\"", "init": "npm run subs:init && npm run subs:update", "subs:init": "git submodule init && git submodule update", "subs:update": "git submodule update --remote" diff --git a/src/modules/roleplay/hug.ts b/src/modules/fun/hug.ts similarity index 94% rename from src/modules/roleplay/hug.ts rename to src/modules/fun/hug.ts index 458d64a..ec2f53e 100644 --- a/src/modules/roleplay/hug.ts +++ b/src/modules/fun/hug.ts @@ -2,8 +2,8 @@ import yiff from '../../utils/yiff'; import Command from '../../handler/structures/Command'; import { Context } from '../../utils/types'; import { MessageEmbed } from 'discord.js'; -import lingua from './../../utils/lingua'; -import replace from './../../utils/replace'; +import lingua from '../../utils/lingua'; +import replace from '../../utils/replace'; export = class Hug extends Command { constructor() { diff --git a/src/modules/general/help.ts b/src/modules/general/help.ts deleted file mode 100644 index 6908ed9..0000000 --- a/src/modules/general/help.ts +++ /dev/null @@ -1,32 +0,0 @@ -import Command from '../../handler/structures/Command'; -import { Context } from '../../utils/types'; -import lingua from '../../utils/lingua'; -import { Folders, Commands } from "../../utils/command.amount"; -import embed from '../../utils/embed'; -export = class Help extends Command { - constructor() { - super({ - name: "help", - aliases: ['?', 'h'], - description: "Get help with the Bot", - cooldown: 1, - }) - } - - // ? [ 'developer', 'general', 'images', 'misc', 'roleplay' ] - - async command(ctx: Context) { - if (ctx.args.length === 0) { - embed.setTitle("Help") - await (await Folders()).forEach(async folder => { - if (!ctx.isDeveloper && folder === 'developer') return - // @ts-ignore - embed.addField(`${lingua[ctx.settings.locale].CATEGORIES[folder.toUpperCase()].name || folder} [\`${[...(await Commands(folder, ctx.client))].length}\`]`, `\`${ctx.config.variables.prefix[2]} help ${folder}\``, true) - }) - return ctx.channel.send(embed) - } - - ctx.channel.send(embed) - - } -} \ No newline at end of file diff --git a/src/modules/general/info.ts b/src/modules/info/about.ts similarity index 97% rename from src/modules/general/info.ts rename to src/modules/info/about.ts index 694e2f8..35fb656 100644 --- a/src/modules/general/info.ts +++ b/src/modules/info/about.ts @@ -6,9 +6,8 @@ import config from '../../../config'; export = class Info extends Command { constructor() { super({ - name: "info", + name: "about", description: "Show Information about the Bot", - aliases: ["about"], cooldown: 0 }) } diff --git a/src/modules/general/ping.ts b/src/modules/info/ping.ts similarity index 100% rename from src/modules/general/ping.ts rename to src/modules/info/ping.ts diff --git a/src/modules/misc/stats.ts b/src/modules/info/stats.ts similarity index 92% rename from src/modules/misc/stats.ts rename to src/modules/info/stats.ts index 0427add..77cae05 100644 --- a/src/modules/misc/stats.ts +++ b/src/modules/info/stats.ts @@ -1,7 +1,7 @@ import Command from '../../handler/structures/Command'; import { Context, Usage } from '../../utils/types'; import lingua from '../../utils/lingua'; -import embed from '../../utils/embed'; +import { MessageEmbed } from 'discord.js'; import CommandUsage from '../../utils/command.usage'; export = class Stats extends Command { diff --git a/src/modules/misc/e926.ts b/src/modules/misc/e926.ts index 891c2ad..4fc00e0 100644 --- a/src/modules/misc/e926.ts +++ b/src/modules/misc/e926.ts @@ -2,7 +2,6 @@ import yiff from "../../utils/yiff" import Command from "../../handler/structures/Command" import { Context } from "../../utils/types"; import { MessageEmbed } from "discord.js" -import embed from "../../utils/embed"; import lingua from "../../utils/lingua"; export = class E926 extends Command { constructor() { @@ -16,6 +15,7 @@ export = class E926 extends Command { } async command(ctx: Context) { + let embed = new MessageEmbed().setColor(ctx.config.variables.color).setFooter(`${ctx.config.variables.name}`, ctx.config.variables.avatar) // @ts-ignore if (ctx.args.length < 1) return ctx.channel.send(embed.setTitle(lingua[ctx.settings.locale].NOT_ENOUGH_TAGS).setDescription(lingua[ctx.settings.locale].NOT_ENOUGH_TAGS_DES)) let request = await yiff.e926(ctx.args.join(" ")) diff --git a/src/modules/misc/help.ts b/src/modules/misc/help.ts new file mode 100644 index 0000000..6a9079d --- /dev/null +++ b/src/modules/misc/help.ts @@ -0,0 +1,43 @@ +import Command from '../../handler/structures/Command'; +import { Context } from '../../utils/types'; +import lingua from '../../utils/lingua'; +import { Folders, Commands } from "../../utils/command.amount"; +import { MessageEmbed } from 'discord.js'; + +export = class Help extends Command { + constructor() { + super({ + name: "help", + aliases: ['?', 'h'], + description: "Get help with the Bot", + cooldown: 1, + }) + } + + // ? [ 'developer', 'general', 'images', 'misc', 'roleplay' ] + + async command(ctx: Context) { + let embed = new MessageEmbed().setColor(ctx.config.variables.color).setFooter(`${ctx.config.variables.name}`, ctx.config.variables.avatar) + + if (ctx.args.length === 0) { + await (await Folders()).forEach(async folder => { + if (!ctx.isDeveloper && folder === 'developer') return + // @ts-ignore + return embed.addField(`${lingua[ctx.settings.locale].CATEGORIES[folder.toUpperCase()].name || folder} [\`${[...(await Commands(folder, ctx.client))].length}\`]`, `\`${ctx.config.variables.prefix[2]} help ${folder}\``, true) + }) + embed.setTitle("Help") + return ctx.channel.send(embed) + } + let arg = ctx.args[0] + if (await (await Folders()).includes(arg)) { + + let commands = await (await Commands(arg, ctx.client)).map(command => `\`${command.name}\` - ${command.description}`) + embed.addField("Commands", commands.join("\n")) + // @ts-ignore + embed.setTitle(`${lingua[ctx.settings.locale].CATEGORIES[arg.toUpperCase()].name || arg}`) + return ctx.channel.send(embed) + } + + + } +} \ No newline at end of file diff --git a/src/modules/misc/invite.ts b/src/modules/misc/invite.ts index f6f80f0..3e4ddda 100644 --- a/src/modules/misc/invite.ts +++ b/src/modules/misc/invite.ts @@ -1,7 +1,6 @@ import Command from '../../handler/structures/Command'; import { Context } from '../../utils/types'; import lingua from '../../utils/lingua'; -import embed from '../../utils/embed'; import replace from '../../utils/replace'; export = class Invite extends Command { diff --git a/src/modules/general/suggestion.ts b/src/modules/misc/suggestion.ts similarity index 100% rename from src/modules/general/suggestion.ts rename to src/modules/misc/suggestion.ts diff --git a/src/modules/nsfw/e621.ts b/src/modules/nsfw/e621.ts index e3e5e07..86c2ad3 100644 --- a/src/modules/nsfw/e621.ts +++ b/src/modules/nsfw/e621.ts @@ -2,29 +2,29 @@ import yiff from "../../utils/yiff" import Command from "../../handler/structures/Command" import { Context } from "../../utils/types"; import { MessageEmbed } from "discord.js" -import embed from "../../utils/embed"; import lingua from "../../utils/lingua"; export = class E621 extends Command { constructor() { super({ - name: "e926", - description: "Get an Image from E926", - aliases: ['e9', 'enine'], - cooldown: 1 + name: "e621", + description: "Get an Image from E621", + aliases: ['e6', 'esix'], + cooldown: 2 }) } async command(ctx: Context) { + let embed = new MessageEmbed().setColor(ctx.config.variables.color).setFooter(`${ctx.config.variables.name}`, ctx.config.variables.avatar) // @ts-ignore if (ctx.args.length < 1) return ctx.channel.send(embed.setTitle(lingua[ctx.settings.locale].NOT_ENOUGH_TAGS).setDescription(lingua[ctx.settings.locale].NOT_ENOUGH_TAGS_DES)) - let request = await yiff.e926(ctx.args.join(" ")) + let request = await yiff.e621(ctx.args.join(" ")) if (ctx.settings.embeds) { - embed.setAuthor('e926.net', 'https://thaldrin.media/e621.png', `https://e926.net/post/${request[0].id}`) + embed.setAuthor('e621.net', 'https://thaldrin.media/e621.png', `https://e621.net/post/${request[0].id}`) .setImage(request[0].file.url) - .setDescription(`[Link](https://e926.net/post/${request[0].id})`) + .setDescription(`[Link](https://e621.net/post/${request[0].id})`) ctx.channel.send(embed) } else { - ctx.channel.send(`\n\n${request[0].file.url}`) + ctx.channel.send(`\n\n${request[0].file.url}`) } } diff --git a/src/utils/lingua b/src/utils/lingua index c13845e..6ef3be5 160000 --- a/src/utils/lingua +++ b/src/utils/lingua @@ -1 +1 @@ -Subproject commit c13845e8406bd862cdef290414a56044f17918fb +Subproject commit 6ef3be5f4e4600ed920f3aed83393cbd9ec6533f