diff --git a/base/JaBa.js b/base/JaBa.js index 8d84239b..caa71675 100644 --- a/base/JaBa.js +++ b/base/JaBa.js @@ -1,12 +1,12 @@ const { MessageEmbed, Util, Client, Collection } = require("discord.js"), { GiveawaysManager } = require("discord-giveaways"), { SoundCloudPlugin } = require("@distube/soundcloud"), - { SpotifyPlugin } = require("@distube/spotify"), - { Client: Joker } = require("blague.xyz"); + { SpotifyPlugin } = require("@distube/spotify"); const util = require("util"), AmeClient = require("amethyste-api"), path = require("path"), + fetch = require("node-fetch"), DisTube = require("distube"), moment = require("moment"); @@ -47,9 +47,16 @@ class JaBa extends Client { this.databaseCache.mutedUsers = new Collection(); // members who are currently muted if (this.config.apiKeys.amethyste) this.AmeAPI = new AmeClient(this.config.apiKeys.amethyste); - if (this.config.apiKeys.blagueXYZ) this.joker = new Joker(this.config.apiKeys.blagueXYZ, { - defaultLanguage: "en" - }); + this.icanhazdadjoke = async function() { + const joke = await fetch("https://icanhazdadjoke.com/", { + method: "GET", + headers: { + "Accept": "application/json" + } + }); + + return joke; + }; this.player = new DisTube.default(this, { searchSongs: 10, diff --git a/commands/Fun/joke.js b/commands/Fun/joke.js index 4133a957..44bfc3c7 100644 --- a/commands/Fun/joke.js +++ b/commands/Fun/joke.js @@ -18,15 +18,15 @@ class Joke extends Command { } async run(message, args, data) { - if (!this.client.config.apiKeys.blagueXYZ) return message.error("misc:COMMAND_DISABLED"); - - // const joke = await this.client.joker.randomJoke(data.guild.language.substr(0, 2)); - const joke = await this.client.joker.randomJoke("en"); + const joke = await this.client.icanhazdadjoke(); + if (joke.status !== "200") return; const embed = new Discord.MessageEmbed() - .setDescription(joke.toDiscordSpoils()) + .setDescription(joke.joke) .setFooter({ - text: message.translate("fun/joke:FOOTER") + text: message.translate("fun/joke:FOOTER", { + id: joke.id + }) }) .setColor(data.config.embed.color); diff --git a/languages/ru-RU/fun/joke.json b/languages/ru-RU/fun/joke.json index 7fb2ea27..a649df00 100644 --- a/languages/ru-RU/fun/joke.json +++ b/languages/ru-RU/fun/joke.json @@ -2,5 +2,5 @@ "DESCRIPTION": "Получить случайную шутку!", "USAGE": "{{prefix}}joke", "EXAMPLES": "{{prefix}}joke", - "FOOTER": "JaBa | blague.xyz" + "FOOTER": "JaBa | ID шутки: {{id}} | icanhazdadjoke.com" } \ No newline at end of file diff --git a/package.json b/package.json index 09d57957..197804a3 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "@sentry/node": "6.3.6", "@sindresorhus/slugify": "^1.1.0", "amethyste-api": "github:Androz2091/amethyste-api", - "blague.xyz": "^2.0.4", "btoa": "^1.2.1", "canvacord": "^5.1.0", "canvas": "^2.6.1",