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
17
base/JaBa.js
17
base/JaBa.js
|
@ -1,12 +1,12 @@
|
||||||
const { MessageEmbed, Util, Client, Collection } = require("discord.js"),
|
const { MessageEmbed, Util, Client, Collection } = require("discord.js"),
|
||||||
{ GiveawaysManager } = require("discord-giveaways"),
|
{ GiveawaysManager } = require("discord-giveaways"),
|
||||||
{ SoundCloudPlugin } = require("@distube/soundcloud"),
|
{ SoundCloudPlugin } = require("@distube/soundcloud"),
|
||||||
{ SpotifyPlugin } = require("@distube/spotify"),
|
{ SpotifyPlugin } = require("@distube/spotify");
|
||||||
{ Client: Joker } = require("blague.xyz");
|
|
||||||
|
|
||||||
const util = require("util"),
|
const util = require("util"),
|
||||||
AmeClient = require("amethyste-api"),
|
AmeClient = require("amethyste-api"),
|
||||||
path = require("path"),
|
path = require("path"),
|
||||||
|
fetch = require("node-fetch"),
|
||||||
DisTube = require("distube"),
|
DisTube = require("distube"),
|
||||||
moment = require("moment");
|
moment = require("moment");
|
||||||
|
|
||||||
|
@ -47,9 +47,16 @@ class JaBa extends Client {
|
||||||
this.databaseCache.mutedUsers = new Collection(); // members who are currently muted
|
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.amethyste) this.AmeAPI = new AmeClient(this.config.apiKeys.amethyste);
|
||||||
if (this.config.apiKeys.blagueXYZ) this.joker = new Joker(this.config.apiKeys.blagueXYZ, {
|
this.icanhazdadjoke = async function() {
|
||||||
defaultLanguage: "en"
|
const joke = await fetch("https://icanhazdadjoke.com/", {
|
||||||
});
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Accept": "application/json"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return joke;
|
||||||
|
};
|
||||||
|
|
||||||
this.player = new DisTube.default(this, {
|
this.player = new DisTube.default(this, {
|
||||||
searchSongs: 10,
|
searchSongs: 10,
|
||||||
|
|
|
@ -18,15 +18,15 @@ class Joke extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(message, args, data) {
|
async run(message, args, data) {
|
||||||
if (!this.client.config.apiKeys.blagueXYZ) return message.error("misc:COMMAND_DISABLED");
|
const joke = await this.client.icanhazdadjoke();
|
||||||
|
if (joke.status !== "200") return;
|
||||||
// const joke = await this.client.joker.randomJoke(data.guild.language.substr(0, 2));
|
|
||||||
const joke = await this.client.joker.randomJoke("en");
|
|
||||||
|
|
||||||
const embed = new Discord.MessageEmbed()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setDescription(joke.toDiscordSpoils())
|
.setDescription(joke.joke)
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: message.translate("fun/joke:FOOTER")
|
text: message.translate("fun/joke:FOOTER", {
|
||||||
|
id: joke.id
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.setColor(data.config.embed.color);
|
.setColor(data.config.embed.color);
|
||||||
|
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
"DESCRIPTION": "Получить случайную шутку!",
|
"DESCRIPTION": "Получить случайную шутку!",
|
||||||
"USAGE": "{{prefix}}joke",
|
"USAGE": "{{prefix}}joke",
|
||||||
"EXAMPLES": "{{prefix}}joke",
|
"EXAMPLES": "{{prefix}}joke",
|
||||||
"FOOTER": "JaBa | blague.xyz"
|
"FOOTER": "JaBa | ID шутки: {{id}} | icanhazdadjoke.com"
|
||||||
}
|
}
|
|
@ -21,7 +21,6 @@
|
||||||
"@sentry/node": "6.3.6",
|
"@sentry/node": "6.3.6",
|
||||||
"@sindresorhus/slugify": "^1.1.0",
|
"@sindresorhus/slugify": "^1.1.0",
|
||||||
"amethyste-api": "github:Androz2091/amethyste-api",
|
"amethyste-api": "github:Androz2091/amethyste-api",
|
||||||
"blague.xyz": "^2.0.4",
|
|
||||||
"btoa": "^1.2.1",
|
"btoa": "^1.2.1",
|
||||||
"canvacord": "^5.1.0",
|
"canvacord": "^5.1.0",
|
||||||
"canvas": "^2.6.1",
|
"canvas": "^2.6.1",
|
||||||
|
|
Loading…
Reference in a new issue