mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
Шутки с canhazdadjoke.com
This commit is contained in:
parent
9447c81b01
commit
294d4f87c0
4 changed files with 19 additions and 13 deletions
15
base/JaBa.js
15
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,10 +47,17 @@ 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,
|
||||
searchCooldown: 30,
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
"DESCRIPTION": "Получить случайную шутку!",
|
||||
"USAGE": "{{prefix}}joke",
|
||||
"EXAMPLES": "{{prefix}}joke",
|
||||
"FOOTER": "JaBa | blague.xyz"
|
||||
"FOOTER": "JaBa | ID шутки: {{id}} | icanhazdadjoke.com"
|
||||
}
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue