From b82a51b6bc70ffeb652d8417d0cdfc85b73d8890 Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Fri, 2 Feb 2024 20:49:55 +0500 Subject: [PATCH] fix cat and dog yipeee --- commands/!DISABLED/crab.js | 49 ---------------------------- commands/{NSFW => !DISABLED}/nsfw.js | 0 commands/{!DISABLED => Fun}/cat.js | 7 ++-- commands/{!DISABLED => Fun}/dog.js | 7 ++-- commands/Music/clips.js | 5 +-- commands/Music/play.c.js | 5 +-- commands/Music/play.js | 5 +-- package.json | 2 +- pnpm-lock.yaml | 23 +++++-------- 9 files changed, 19 insertions(+), 84 deletions(-) delete mode 100644 commands/!DISABLED/crab.js rename commands/{NSFW => !DISABLED}/nsfw.js (100%) rename commands/{!DISABLED => Fun}/cat.js (85%) rename commands/{!DISABLED => Fun}/dog.js (85%) diff --git a/commands/!DISABLED/crab.js b/commands/!DISABLED/crab.js deleted file mode 100644 index 168e4338..00000000 --- a/commands/!DISABLED/crab.js +++ /dev/null @@ -1,49 +0,0 @@ -const { SlashCommandBuilder } = require("discord.js"); -const BaseCommand = require("../../base/BaseCommand"), - fetch = require("node-fetch"); - -class Crab extends BaseCommand { - /** - * - * @param {import("../base/Client")} client - */ - constructor(client) { - super({ - command: new SlashCommandBuilder() - .setName("crab") - .setDescription(client.translate("fun/crab:DESCRIPTION")) - .setDescriptionLocalizations({ - uk: client.translate("fun/crab:DESCRIPTION", null, "uk-UA"), - ru: client.translate("fun/crab:DESCRIPTION", null, "ru-RU"), - }) - .setDMPermission(true), - aliases: [], - dirname: __dirname, - ownerOnly: false, - }); - } - /** - * - * @param {import("../../base/Client")} client - */ - async onLoad() { - //... - } - /** - * - * @param {import("../../base/Client")} client - * @param {import("discord.js").ChatInputCommandInteraction} interaction - * @param {Object} data - */ - async execute(client, interaction) { - await interaction.deferReply(); - - const res = await fetch("https://and-here-is-my-code.glitch.me/img/crab").then(response => response.json()); - - interaction.editReply({ - content: res.Link, - }); - } -} - -module.exports = Crab; diff --git a/commands/NSFW/nsfw.js b/commands/!DISABLED/nsfw.js similarity index 100% rename from commands/NSFW/nsfw.js rename to commands/!DISABLED/nsfw.js diff --git a/commands/!DISABLED/cat.js b/commands/Fun/cat.js similarity index 85% rename from commands/!DISABLED/cat.js rename to commands/Fun/cat.js index 546900b5..349b484e 100644 --- a/commands/!DISABLED/cat.js +++ b/commands/Fun/cat.js @@ -38,11 +38,10 @@ class Cat extends BaseCommand { async execute(client, interaction) { await interaction.deferReply(); - const res = await fetch("https://and-here-is-my-code.glitch.me/img/cat").then(response => response.json()); + const res = await fetch("https://api.thecatapi.com/v1/images/search").then(r => r.json()); + const cat = res[0].url; - interaction.editReply({ - content: res.Link, - }); + await interaction.editReply({ content: cat }); } } diff --git a/commands/!DISABLED/dog.js b/commands/Fun/dog.js similarity index 85% rename from commands/!DISABLED/dog.js rename to commands/Fun/dog.js index 00c32eef..1a7700e7 100644 --- a/commands/!DISABLED/dog.js +++ b/commands/Fun/dog.js @@ -38,11 +38,10 @@ class Dog extends BaseCommand { async execute(client, interaction) { await interaction.deferReply(); - const res = await fetch("https://and-here-is-my-code.glitch.me/img/dog").then(response => response.json()); + const res = await fetch("https://dog.ceo/api/breeds/image/random").then(r => r.json()); + const dog = res.message; - interaction.editReply({ - content: res.Link, - }); + await interaction.editReply({ content: dog }); } } diff --git a/commands/Music/clips.js b/commands/Music/clips.js index 2aeb0ef6..55d8f9e9 100644 --- a/commands/Music/clips.js +++ b/commands/Music/clips.js @@ -59,10 +59,7 @@ class Clips extends BaseCommand { client.player.play(interaction.member.voice.channel, query, { nodeOptions: { - metadata: { - channel: interaction.channel, - requestedBy: interaction.user, - }, + metadata: interaction, }, searchEngine: QueryType.FILE, selfDeaf: true, diff --git a/commands/Music/play.c.js b/commands/Music/play.c.js index 37e245dc..d9832b76 100644 --- a/commands/Music/play.c.js +++ b/commands/Music/play.c.js @@ -51,10 +51,7 @@ class PlayContext extends BaseCommand { else { const { queue } = await client.player.play(interaction.member.voice.channel, searchResult, { nodeOptions: { - metadata: { - channel: interaction.channel, - requestedBy: interaction.user, - }, + metadata: interaction, }, selfDeaf: true, leaveOnEnd: false, diff --git a/commands/Music/play.js b/commands/Music/play.js index f80c3a0a..b040c6b2 100644 --- a/commands/Music/play.js +++ b/commands/Music/play.js @@ -63,10 +63,7 @@ class Play extends BaseCommand { else { const { queue } = await client.player.play(interaction.member.voice.channel, searchResult, { nodeOptions: { - metadata: { - channel: interaction.channel, - requestedBy: interaction.user, - }, + metadata: interaction, }, selfDeaf: true, leaveOnEnd: false, diff --git a/package.json b/package.json index ab43c765..2ba62979 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "mongoose": "^7.6.3", "ms": "^2.1.3", "node-fetch": "^2.7.0", - "play-dl": "^1.9.7" + "youtube-ext": "^1.1.16" }, "devDependencies": { "eslint": "^8.52.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4fdb200f..c805cc67 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -62,9 +62,9 @@ dependencies: node-fetch: specifier: ^2.7.0 version: 2.7.0 - play-dl: - specifier: ^1.9.7 - version: 1.9.7 + youtube-ext: + specifier: ^1.1.16 + version: 1.1.16 devDependencies: eslint: @@ -1668,17 +1668,6 @@ packages: engines: {node: '>=8'} dev: false - /play-audio@0.5.2: - resolution: {integrity: sha512-ZAqHUKkQLix2Iga7pPbsf1LpUoBjcpwU93F1l3qBIfxYddQLhxS6GKmS0d3jV8kSVaUbr6NnOEcEMFvuX93SWQ==} - dev: false - - /play-dl@1.9.7: - resolution: {integrity: sha512-KpgerWxUCY4s9Mhze2qdqPhiqd8Ve6HufpH9mBH3FN+vux55qSh6WJKDabfie8IBHN7lnrAlYcT/UdGax58c2A==} - engines: {node: '>=16.0.0'} - dependencies: - play-audio: 0.5.2 - dev: false - /prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -2156,6 +2145,12 @@ packages: engines: {node: '>=10'} dev: true + /youtube-ext@1.1.16: + resolution: {integrity: sha512-vyzHSwxlCAwqWUxZKJ/5g139BgnbmZFTy9I0nxDwqlbAh74dB1LjayCoB5BgLaaIkSMruEQwlf5bF+EeR235qA==} + dependencies: + undici: 5.27.2 + dev: false + /youtube-sr@4.3.9: resolution: {integrity: sha512-wPGEgVevSn32BJu5jiSHdvoryUCTCIM9LYT+yMDDpUfaev2Dh46dB+4qU31NgJ9XOsNxGlEKmc9qxUO5L0CE/Q==} dev: false