diff --git a/README.md b/README.md index 920c1873..3603fa37 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ You can join the home server with [this link](https://discord.gg/fqQF8mc). [discord.js](https://discord.js.org), [commando](https://github.com/Gawdl3y/discord.js-commando), [zalgoize](https://github.com/clux/zalgolize), [superagent](https://visionmedia.github.io/superagent), [mathjs](http://mathjs.org), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org), [sequelize](http://docs.sequelizejs.com), [pg](https://github.com/brianc/node-postgres) ## APIs -[Wattpad](https://developer.wattpad.com), [Wordnik](http://developer.wordnik.com), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link), [YuGiOh](http://docs.yugiohprices.apiary.io), [YouTube](https://developers.google.com/youtube), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com), [Yahoo Weather](https://developer.yahoo.com/weather), [Google Maps](https://developers.google.com/maps), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [rrrather](http://www.rrrather.com/botapi), [SoundCloud](https://developers.soundcloud.com), [random.cat](http://random.cat), [random.dog](https://random.dog), [fixer.io](http://fixer.io) +[Wattpad](https://developer.wattpad.com), [Wordnik](http://developer.wordnik.com), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link), [YuGiOh](http://docs.yugiohprices.apiary.io), [YouTube](https://developers.google.com/youtube), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com), [Yahoo Weather](https://developer.yahoo.com/weather), [Google Maps](https://developers.google.com/maps), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [rrrather](http://www.rrrather.com/botapi), [SoundCloud](https://developers.soundcloud.com), [random.cat](http://random.cat), [random.dog](https://random.dog), [fixer.io](http://fixer.io), [konachan](https://konachan.net) ## Licensing The bot is licensed under an [ISC License](https://opensource.org/licenses/ISC). See the file `LICENSE.md` for more information. diff --git a/commands/guildinfo/guildinfo.js b/commands/guildinfo/guildinfo.js index 85437b1f..c97790ca 100644 --- a/commands/guildinfo/guildinfo.js +++ b/commands/guildinfo/guildinfo.js @@ -21,7 +21,7 @@ module.exports = class GuildInfoCommand extends Command { return msg.say('This Command requires the `Embed Links` Permission.'); const embed = new RichEmbed() .setColor(0x00AE86) - .setThumbnail(msg.guild.iconURL('png')) + .setThumbnail(msg.guild.iconURL()) .addField('**Name:**', msg.guild.name, true) .addField('**ID:**', diff --git a/commands/randomimg/nsfwanime.js b/commands/randomimg/nsfwanime.js new file mode 100644 index 00000000..4ea9108b --- /dev/null +++ b/commands/randomimg/nsfwanime.js @@ -0,0 +1,28 @@ +const { Command } = require('discord.js-commando'); +const request = require('superagent'); + +module.exports = class NSFWAnimeCommand extends Command { + constructor(client) { + super(client, { + name: 'nsfw-anime', + group: 'randomimg', + memberName: 'nsfw-anime', + description: 'Sends a random (NSFW!) anime image.', + guildOnly: true + }); + } + + async run(msg) { + if (!msg.channel.nsfw) return msg.say('This Command can only be used in NSFW Channels.'); + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + return msg.say('This Command requires the `Attach Files` Permission.'); + try { + const { body } = await request + .get('https://konachan.net/post.json?tags=order:random&limit=1'); + return msg.channel.send({ files: [`https:${body[0].file_url}`] }) + .catch(err => msg.say(err)); + } catch (err) { + return msg.say(err); + } + } +}; diff --git a/commands/search/botinfo.js b/commands/search/botinfo.js index 25433b45..d325b2e8 100644 --- a/commands/search/botinfo.js +++ b/commands/search/botinfo.js @@ -1,6 +1,7 @@ const { Command } = require('discord.js-commando'); const { RichEmbed } = require('discord.js'); const request = require('superagent'); +const { DISCORD_BOTS_KEY } = process.env; module.exports = class BotSearchCommand extends Command { constructor(client) { @@ -27,7 +28,7 @@ module.exports = class BotSearchCommand extends Command { try { const { body } = await request .get(`https://bots.discord.pw/api/bots/${bot.id}`) - .set({ 'Authorization': process.env.DISCORD_BOTS_KEY }); + .set({ 'Authorization': DISCORD_BOTS_KEY }); const embed = new RichEmbed() .setColor(0x9797FF) .setAuthor('Discord Bots', 'https://i.imgur.com/lrKYBQi.jpg') diff --git a/commands/search/define.js b/commands/search/define.js index 37585e75..442716a5 100644 --- a/commands/search/define.js +++ b/commands/search/define.js @@ -1,6 +1,7 @@ const { Command } = require('discord.js-commando'); const { RichEmbed } = require('discord.js'); const request = require('superagent'); +const { WORDNIK_KEY } = process.env; module.exports = class DefineCommand extends Command { constructor(client) { @@ -27,7 +28,7 @@ module.exports = class DefineCommand extends Command { const { query } = args; try { const { body } = await request - .get(`http://api.wordnik.com:80/v4/word.json/${query}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${process.env.WORDNIK_KEY}`); + .get(`http://api.wordnik.com:80/v4/word.json/${query}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${WORDNIK_KEY}`); if (body.length === 0) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0x9797FF) diff --git a/commands/search/google.js b/commands/search/google.js index 320bd2e1..6820208a 100644 --- a/commands/search/google.js +++ b/commands/search/google.js @@ -33,7 +33,7 @@ module.exports = class GoogleCommand extends Command { href = querystring.parse(href.replace('/url?', '')); return message.edit(href.q); } catch (err) { - return message.edit('An Error Occurred: No Results.'); + return message.edit('Error: No Results.'); } } }; diff --git a/commands/search/map.js b/commands/search/map.js index 81c1f00e..cf392cc1 100644 --- a/commands/search/map.js +++ b/commands/search/map.js @@ -1,5 +1,6 @@ const { Command } = require('discord.js-commando'); const request = require('superagent'); +const { GOOGLE_KEY } = process.env; module.exports = class MapCommand extends Command { constructor(client) { @@ -37,7 +38,7 @@ module.exports = class MapCommand extends Command { const { zoom, query } = args; try { const { body } = await request - .get(`https://maps.googleapis.com/maps/api/staticmap?center=${query}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`); + .get(`https://maps.googleapis.com/maps/api/staticmap?center=${query}&zoom=${zoom}&size=500x500&key=${GOOGLE_KEY}`); return msg.channel.send({ files: [{ attachment: body, name: 'map.png' }] }) .catch(err => msg.say(err)); } catch (err) { diff --git a/commands/search/osu.js b/commands/search/osu.js index 3fb6bfb3..fbe17ea6 100644 --- a/commands/search/osu.js +++ b/commands/search/osu.js @@ -1,6 +1,7 @@ const { Command } = require('discord.js-commando'); const { RichEmbed } = require('discord.js'); const request = require('superagent'); +const { OSU_KEY } = process.env; module.exports = class OsuCommand extends Command { constructor(client) { @@ -27,7 +28,7 @@ module.exports = class OsuCommand extends Command { const { query } = args; try { const { body } = await request - .get(`https://osu.ppy.sh/api/get_user?k=${process.env.OSU_KEY}&u=${query}&type=string`); + .get(`https://osu.ppy.sh/api/get_user?k=${OSU_KEY}&u=${query}&type=string`); if (body.length === 0) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xFF66AA) diff --git a/commands/search/soundcloud.js b/commands/search/soundcloud.js index cfca8c15..61a9025c 100644 --- a/commands/search/soundcloud.js +++ b/commands/search/soundcloud.js @@ -1,6 +1,7 @@ const { Command } = require('discord.js-commando'); const { RichEmbed } = require('discord.js'); const request = require('superagent'); +const { SOUNDCLOUD_KEY } = process.env; module.exports = class SoundCloudCommand extends Command { constructor(client) { @@ -27,7 +28,7 @@ module.exports = class SoundCloudCommand extends Command { const { query } = args; try { const { body } = await request - .get(`https://api.soundcloud.com/tracks?q=${query}&client_id=${process.env.SOUNDCLOUD_KEY}`); + .get(`https://api.soundcloud.com/tracks?q=${query}&client_id=${SOUNDCLOUD_KEY}`); if (body.length === 0) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xF15A22) diff --git a/commands/search/wattpad.js b/commands/search/wattpad.js index 0cc73cf5..b70830ce 100644 --- a/commands/search/wattpad.js +++ b/commands/search/wattpad.js @@ -1,6 +1,7 @@ const { Command } = require('discord.js-commando'); const { RichEmbed } = require('discord.js'); const request = require('superagent'); +const { WATTPAD_KEY } = process.env; module.exports = class WattpadCommand extends Command { constructor(client) { @@ -28,7 +29,7 @@ module.exports = class WattpadCommand extends Command { try { const { body } = await request .get(`https://api.wattpad.com:443/v4/stories?query=${query}&limit=1`) - .set({ 'Authorization': `Basic ${process.env.WATTPAD_KEY}` }); + .set({ 'Authorization': `Basic ${WATTPAD_KEY}` }); if (body.stories.length === 0) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xF89C34) diff --git a/commands/search/youtube.js b/commands/search/youtube.js index c7db1c25..50645c95 100644 --- a/commands/search/youtube.js +++ b/commands/search/youtube.js @@ -1,6 +1,7 @@ const { Command } = require('discord.js-commando'); const { RichEmbed } = require('discord.js'); const request = require('superagent'); +const { GOOGLE_KEY } = process.env; module.exports = class YouTubeCommand extends Command { constructor(client) { @@ -27,7 +28,7 @@ module.exports = class YouTubeCommand extends Command { const { query } = args; try { const { body } = await request - .get(`https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&maxResults=1&q=${query}&key=${process.env.GOOGLE_KEY}`); + .get(`https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&maxResults=1&q=${query}&key=${GOOGLE_KEY}`); if (body.items.length === 0) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xDD2825) diff --git a/commands/search/yugioh.js b/commands/search/yugioh.js index 751eae50..89a92375 100644 --- a/commands/search/yugioh.js +++ b/commands/search/yugioh.js @@ -36,7 +36,7 @@ module.exports = class YuGiOhCommand extends Command { .setDescription(body.data.text) .setAuthor('Yu-Gi-Oh!', 'https://i.imgur.com/7gPm9Rr.png') .addField('**Card Type:**', - 'monster', true) + body.data.card_type, true) .addField('**Type:**', body.data.type, true) .addField('**Attribute:**', @@ -48,15 +48,16 @@ module.exports = class YuGiOhCommand extends Command { .addField('**Level:**', body.data.level, true); return msg.embed(embed); + } else { + const embed = new RichEmbed() + .setColor(0xBE5F1F) + .setTitle(body.data.name) + .setDescription(body.data.text) + .setAuthor('Yu-Gi-Oh!', 'https://i.imgur.com/7gPm9Rr.png') + .addField('**Card Type:**', + body.data.card_type, true); + return msg.embed(embed); } - const embed = new RichEmbed() - .setColor(0xBE5F1F) - .setTitle(body.data.name) - .setDescription(body.data.text) - .setAuthor('Yu-Gi-Oh!', 'https://i.imgur.com/7gPm9Rr.png') - .addField('**Card Type:**', - body.data.card_type, true); - return msg.embed(embed); } catch (err) { return msg.say(err); } diff --git a/commands/textedit/webhook.js b/commands/textedit/webhook.js index 31a48e31..117780d0 100644 --- a/commands/textedit/webhook.js +++ b/commands/textedit/webhook.js @@ -1,5 +1,6 @@ const { Command } = require('discord.js-commando'); const request = require('superagent'); +const { WEBHOOK_URL } = process.env; module.exports = class WebhookCommand extends Command { constructor(client) { @@ -31,7 +32,7 @@ module.exports = class WebhookCommand extends Command { try { msg.delete(); await request - .post(process.env.WEBHOOK_URL) + .post(WEBHOOK_URL) .send({ content }); return null; } catch (err) { diff --git a/commands/userinfo/avatar.js b/commands/userinfo/avatar.js index 5b4c3310..596df7d0 100644 --- a/commands/userinfo/avatar.js +++ b/commands/userinfo/avatar.js @@ -19,6 +19,6 @@ module.exports = class AvatarCommand extends Command { run(msg, args) { const { user } = args; - return msg.say(user.avatarURL('png', 2048) || user.displayAvatarURL); + return msg.say(user.avatarURL('webp', 2048) || user.displayAvatarURL); } }; diff --git a/commands/util/info.js b/commands/util/info.js index 1a7419eb..81c7253f 100644 --- a/commands/util/info.js +++ b/commands/util/info.js @@ -82,7 +82,8 @@ module.exports = class InfoCommand extends Command { [SoundCloud](https://developers.soundcloud.com), [random.cat](http://random.cat), [random.dog](https://random.dog), - [fixer.io](http://fixer.io) + [fixer.io](http://fixer.io), + [konachan](https://konachan.net) ` ); return msg.embed(embed); diff --git a/html/carbondesc.html b/html/carbondesc.html index 100eff96..fd47da66 100644 --- a/html/carbondesc.html +++ b/html/carbondesc.html @@ -52,6 +52,7 @@