From 4cb42e138918925256c19963b77a1d2bd5fad88a Mon Sep 17 00:00:00 2001 From: TheDogHusky Date: Wed, 11 Sep 2024 17:44:26 +0200 Subject: [PATCH] Fix command names, and add 8ball and owoify commands --- package-lock.json | 8 +++--- package.json | 2 +- src/commands/fun/8ball.ts | 55 +++++++++++++++++++++++++++++++++++++ src/commands/fun/hug.ts | 2 +- src/commands/fun/kiss.ts | 2 +- src/commands/fun/kitsune.ts | 2 +- src/commands/fun/lewd.ts | 2 +- src/commands/fun/owoify.ts | 41 +++++++++++++++++++++++++++ src/commands/fun/pat.ts | 2 +- src/commands/fun/slap.ts | 2 +- tsconfig.json | 2 +- 11 files changed, 108 insertions(+), 12 deletions(-) create mode 100644 src/commands/fun/8ball.ts create mode 100644 src/commands/fun/owoify.ts diff --git a/package-lock.json b/package-lock.json index 4f0f29b..4b92f5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "dotenv": "^16.4.5", "mongoose": "^8.6.1", "ms": "^2.1.3", - "nekonya.js": "^1.1.8", + "nekonya.js": "^1.2.8", "pterodactyl.js": "^2.1.1", "tsx": "^4.19.0" }, @@ -1203,9 +1203,9 @@ "license": "MIT" }, "node_modules/nekonya.js": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/nekonya.js/-/nekonya.js-1.1.8.tgz", - "integrity": "sha512-e9nXLJDsdrPyNO3ARupG/w2/cPwRaqr8KsUwnRqDoDmE7UQpOQ5XlfeBmyASVkjrC8RROQQupjSSL2RLigW2dA==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/nekonya.js/-/nekonya.js-1.2.8.tgz", + "integrity": "sha512-jiBIVEyfTo8ucuOtKoWDcyiDJcLUD/REv7BUQur47ct6PPmN514fDc/A5Qoj0a0YJa5CZCfK2z9oBWMIMlu+rw==", "license": "MIT", "dependencies": { "@types/node-fetch": "^2.6.2", diff --git a/package.json b/package.json index 0619d14..728ecec 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "dotenv": "^16.4.5", "mongoose": "^8.6.1", "ms": "^2.1.3", - "nekonya.js": "^1.1.8", + "nekonya.js": "^1.2.8", "pterodactyl.js": "^2.1.1", "tsx": "^4.19.0" }, diff --git a/src/commands/fun/8ball.ts b/src/commands/fun/8ball.ts new file mode 100644 index 0000000..b57cbfd --- /dev/null +++ b/src/commands/fun/8ball.ts @@ -0,0 +1,55 @@ +import Command from '../../struct/command'; +import Client from '../../struct/client'; +import { ChatInputCommandInteraction, ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'; +import { IGuild } from '../../struct/typings'; +import * as NekoNya from 'nekonya.js'; + +export default class OwoifyCommand extends Command { + constructor(client: Client) { + super(client, { + name: '8ball', + description: 'Ask the magic 8ball a question!', + category: 'fun', + usage: '8ball [cute]', + ownerOnly: false, + nsfw: false, + options: [{ + name: 'question', + description: 'Your question', + type: ApplicationCommandOptionType.String, + required: true + }, { + name: 'cute', + description: 'Whether to make the answer cute', + type: ApplicationCommandOptionType.Boolean, + required: false + }], + defer: false + }); + }; + + public async run(client: Client, ctx: ChatInputCommandInteraction<"cached">, data: IGuild): Promise { + const text = ctx.options.getString('question', true).replaceAll("\\n", "\n"); + const result = await NekoNya.eightball(ctx.options.getBoolean('cute', false) || false); + + const embed = new EmbedBuilder() + .setColor(client.config.colors.main) + .setTimestamp() + .setTitle(`${client.config.emotes.hug}・8ball Answer`) + .addFields([ + { + name: `${client.config.emotes.question}・Question`, + value: `> ${text}` + }, + { + name: `${client.config.emotes.eightball}・Answer`, + value: `> ${result}` + } + ]) + .setAuthor({ name: ctx.user.tag, iconURL: ctx.user.displayAvatarURL({ size: 1024, extension: 'webp' }) }) + .setFooter({ text: `Requested by ${ctx.user.tag}`, iconURL: client.user?.displayAvatarURL({ size: 1024, extension: 'webp' }) }); + await ctx.reply({ + embeds: [embed] + }); + }; +}; \ No newline at end of file diff --git a/src/commands/fun/hug.ts b/src/commands/fun/hug.ts index 3bb964a..81a14a7 100644 --- a/src/commands/fun/hug.ts +++ b/src/commands/fun/hug.ts @@ -4,7 +4,7 @@ import { ChatInputCommandInteraction, ApplicationCommandOptionType, EmbedBuilder import { IGuild } from '../../struct/typings'; import * as NekoNya from 'nekonya.js'; -export default class KitsuneCommand extends Command { +export default class HugCommand extends Command { constructor(client: Client) { super(client, { name: 'hug', diff --git a/src/commands/fun/kiss.ts b/src/commands/fun/kiss.ts index 0e4df17..05306b5 100644 --- a/src/commands/fun/kiss.ts +++ b/src/commands/fun/kiss.ts @@ -4,7 +4,7 @@ import { ChatInputCommandInteraction, ApplicationCommandOptionType, EmbedBuilder import { IGuild } from '../../struct/typings'; import * as NekoNya from 'nekonya.js'; -export default class KitsuneCommand extends Command { +export default class KissCommand extends Command { constructor(client: Client) { super(client, { name: 'kiss', diff --git a/src/commands/fun/kitsune.ts b/src/commands/fun/kitsune.ts index 688e46a..5c29c20 100644 --- a/src/commands/fun/kitsune.ts +++ b/src/commands/fun/kitsune.ts @@ -7,7 +7,7 @@ import * as NekoNya from 'nekonya.js'; export default class KitsuneCommand extends Command { constructor(client: Client) { super(client, { - name: 'neko', + name: 'kitsune', description: 'Get a random kitsune image', category: 'fun', usage: 'kitsune [number]', diff --git a/src/commands/fun/lewd.ts b/src/commands/fun/lewd.ts index 3695bf3..d0c792f 100644 --- a/src/commands/fun/lewd.ts +++ b/src/commands/fun/lewd.ts @@ -4,7 +4,7 @@ import { ChatInputCommandInteraction, ApplicationCommandOptionType, EmbedBuilder import { IGuild } from '../../struct/typings'; import * as NekoNya from 'nekonya.js'; -export default class NekoCommand extends Command { +export default class LewdCommand extends Command { constructor(client: Client) { super(client, { name: 'lewd', diff --git a/src/commands/fun/owoify.ts b/src/commands/fun/owoify.ts new file mode 100644 index 0000000..2caf1ee --- /dev/null +++ b/src/commands/fun/owoify.ts @@ -0,0 +1,41 @@ +import Command from '../../struct/command'; +import Client from '../../struct/client'; +import { ChatInputCommandInteraction, ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'; +import { IGuild } from '../../struct/typings'; +import * as NekoNya from 'nekonya.js'; + +export default class OwoifyCommand extends Command { + constructor(client: Client) { + super(client, { + name: 'owoify', + description: 'Make your text cute!', + category: 'fun', + usage: 'owoify ', + ownerOnly: false, + nsfw: false, + options: [{ + name: 'text', + description: 'The text to owoify', + type: ApplicationCommandOptionType.String, + required: true + }], + defer: false + }); + }; + + public async run(client: Client, ctx: ChatInputCommandInteraction<"cached">, data: IGuild): Promise { + const text = ctx.options.getString('text', true).replaceAll("\\n", "\n"); + const result = (await NekoNya.owoify(text)).replaceAll("\n", "\n> "); + + const embed = new EmbedBuilder() + .setColor(client.config.colors.main) + .setTimestamp() + .setDescription(`> ${result}`) + .setTitle(`${client.config.emotes.hug}・Owoify Result`) + .setAuthor({ name: ctx.user.tag, iconURL: ctx.user.displayAvatarURL({ size: 1024, extension: 'webp' }) }) + .setFooter({ text: `Requested by ${ctx.user.tag}`, iconURL: client.user?.displayAvatarURL({ size: 1024, extension: 'webp' }) }); + await ctx.reply({ + embeds: [embed] + }); + }; +}; \ No newline at end of file diff --git a/src/commands/fun/pat.ts b/src/commands/fun/pat.ts index 5524deb..32e2f61 100644 --- a/src/commands/fun/pat.ts +++ b/src/commands/fun/pat.ts @@ -4,7 +4,7 @@ import { ChatInputCommandInteraction, ApplicationCommandOptionType, EmbedBuilder import { IGuild } from '../../struct/typings'; import * as NekoNya from 'nekonya.js'; -export default class KitsuneCommand extends Command { +export default class PatCommand extends Command { constructor(client: Client) { super(client, { name: 'pat', diff --git a/src/commands/fun/slap.ts b/src/commands/fun/slap.ts index 323f08e..7aef47c 100644 --- a/src/commands/fun/slap.ts +++ b/src/commands/fun/slap.ts @@ -4,7 +4,7 @@ import { ChatInputCommandInteraction, ApplicationCommandOptionType, EmbedBuilder import { IGuild } from '../../struct/typings'; import * as NekoNya from 'nekonya.js'; -export default class KitsuneCommand extends Command { +export default class SlapCommand extends Command { constructor(client: Client) { super(client, { name: 'slap', diff --git a/tsconfig.json b/tsconfig.json index 70198e9..f9ad204 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */