diff --git a/assets/images/3000years.png b/assets/images/3000years.png new file mode 100644 index 00000000..fcabcabd Binary files /dev/null and b/assets/images/3000years.png differ diff --git a/assets/images/beautiful.png b/assets/images/beautiful.png new file mode 100644 index 00000000..69dc4835 Binary files /dev/null and b/assets/images/beautiful.png differ diff --git a/assets/images/bobross.png b/assets/images/bobross.png new file mode 100644 index 00000000..268af1ef Binary files /dev/null and b/assets/images/bobross.png differ diff --git a/assets/images/card.png b/assets/images/card.png new file mode 100644 index 00000000..0aa9d097 Binary files /dev/null and b/assets/images/card.png differ diff --git a/assets/images/rip.png b/assets/images/rip.png new file mode 100644 index 00000000..2098ed5c Binary files /dev/null and b/assets/images/rip.png differ diff --git a/assets/images/steamcard.png b/assets/images/steamcard.png new file mode 100644 index 00000000..14f4f2b4 Binary files /dev/null and b/assets/images/steamcard.png differ diff --git a/assets/images/triggered.png b/assets/images/triggered.png new file mode 100644 index 00000000..78833ca1 Binary files /dev/null and b/assets/images/triggered.png differ diff --git a/assets/images/wanted.png b/assets/images/wanted.png new file mode 100644 index 00000000..068768a3 Binary files /dev/null and b/assets/images/wanted.png differ diff --git a/commands/avataredit/3000years.js b/commands/avataredit/3000years.js index 25a2fbd0..8718de9b 100644 --- a/commands/avataredit/3000years.js +++ b/commands/avataredit/3000years.js @@ -1,6 +1,9 @@ const { Command } = require('discord.js-commando'); const Canvas = require('canvas'); const request = require('superagent'); +const { promisifyAll } = require('tsubaki'); +const fs = promisifyAll(require('fs')); +const path = require('path'); module.exports = class YearsCommand extends Command { constructor(client) { @@ -37,11 +40,8 @@ module.exports = class YearsCommand extends Command { ctx.drawImage(base, 0, 0); ctx.drawImage(avatar, 461, 127, 200, 200); }; - const azImg = await request - .get('https://i.imgur.com/eScwGFS.png'); - const avatarImg = await request - .get(avatarURL); - base.src = azImg.body; + base.src = await fs.readFileAsync(path.join(__dirname, '..', '..', 'assets', 'images', '3000years.png')); + const avatarImg = await request.get(avatarURL); avatar.src = avatarImg.body; generate(); return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'az.png' }] }) diff --git a/commands/avataredit/beautiful.js b/commands/avataredit/beautiful.js index 99da1ae6..98e4cc82 100644 --- a/commands/avataredit/beautiful.js +++ b/commands/avataredit/beautiful.js @@ -1,6 +1,9 @@ const { Command } = require('discord.js-commando'); const Canvas = require('canvas'); const request = require('superagent'); +const { promisifyAll } = require('tsubaki'); +const fs = promisifyAll(require('fs')); +const path = require('path'); module.exports = class BeautifulCommand extends Command { constructor(client) { @@ -36,13 +39,10 @@ module.exports = class BeautifulCommand extends Command { const generate = () => { ctx.drawImage(base, 0, 0); ctx.drawImage(avatar, 341, 35, 117, 135); - ctx.drawImage(avatar, 342, 301, 117, 135); + ctx.drawImage(avatar, 342, 303, 117, 135); }; - const grunkleImg = await request - .get('https://i.imgur.com/71qLwPf.png'); - const avatarImg = await request - .get(avatarURL); - base.src = grunkleImg.body; + base.src = await fs.readFileAsync(path.join(__dirname, '..', '..', 'assets', 'images', 'beautiful.png')); + const avatarImg = await request.get(avatarURL); avatar.src = avatarImg.body; generate(); return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'grunkle.png' }] }) diff --git a/commands/avataredit/bobross.js b/commands/avataredit/bobross.js index 67d9ba2e..5ca48345 100644 --- a/commands/avataredit/bobross.js +++ b/commands/avataredit/bobross.js @@ -1,6 +1,9 @@ const { Command } = require('discord.js-commando'); const Canvas = require('canvas'); const request = require('superagent'); +const { promisifyAll } = require('tsubaki'); +const fs = promisifyAll(require('fs')); +const path = require('path'); module.exports = class BobRossCommand extends Command { constructor(client) { @@ -41,11 +44,8 @@ module.exports = class BobRossCommand extends Command { ctx.rotate(-3 * Math.PI / 180); ctx.drawImage(base, 0, 0); }; - const rossImg = await request - .get('https://i.imgur.com/7NSiFLd.png'); - const avatarImg = await request - .get(avatarURL); - base.src = rossImg.body; + base.src = await fs.readFileAsync(path.join(__dirname, '..', '..', 'assets', 'images', 'bobross.png')); + const avatarImg = await request.get(avatarURL); avatar.src = avatarImg.body; generate(); return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'ross.png' }] }) diff --git a/commands/avataredit/card.js b/commands/avataredit/card.js index 94e941ad..d9856f5b 100644 --- a/commands/avataredit/card.js +++ b/commands/avataredit/card.js @@ -2,6 +2,8 @@ const { Command } = require('discord.js-commando'); const Canvas = require('canvas'); const request = require('superagent'); const moment = require('moment'); +const { promisifyAll } = require('tsubaki'); +const fs = promisifyAll(require('fs')); const path = require('path'); const { version } = require('../../package'); @@ -61,11 +63,8 @@ module.exports = class CardCommand extends Command { ctx.fillText(member.id, 30, 355); ctx.fillText(`#${member.user.discriminator}`, 313, 355); }; - const cardImg = await request - .get('https://i.imgur.com/6j8RHk1.png'); - const avatarImg = await request - .get(avatarURL); - base.src = cardImg.body; + base.src = await fs.readFileAsync(path.join(__dirname, '..', '..', 'assets', 'images', 'card.png')); + const avatarImg = await request.get(avatarURL); avatar.src = avatarImg.body; generate(); return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'card.png' }] }) diff --git a/commands/avataredit/greyscale.js b/commands/avataredit/greyscale.js index 56a581dc..e9dd880f 100644 --- a/commands/avataredit/greyscale.js +++ b/commands/avataredit/greyscale.js @@ -44,8 +44,7 @@ module.exports = class GreyscaleCommand extends Command { } ctx.putImageData(imgData, 0, 0); }; - const avatarImg = await request - .get(avatarURL); + const avatarImg = await request.get(avatarURL); avatar.src = avatarImg.body; generate(); return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'greyscale.png' }] }) diff --git a/commands/avataredit/invert.js b/commands/avataredit/invert.js index ed9bdbaf..6c2a0aac 100644 --- a/commands/avataredit/invert.js +++ b/commands/avataredit/invert.js @@ -42,8 +42,7 @@ module.exports = class InvertCommand extends Command { } ctx.putImageData(imgData, 0, 0); }; - const avatarImg = await request - .get(avatarURL); + const avatarImg = await request.get(avatarURL); avatar.src = avatarImg.body; generate(); return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'invert.png' }] }) diff --git a/commands/avataredit/rip.js b/commands/avataredit/rip.js index e79fb1b8..7ea72f2a 100644 --- a/commands/avataredit/rip.js +++ b/commands/avataredit/rip.js @@ -1,6 +1,9 @@ const { Command } = require('discord.js-commando'); const Canvas = require('canvas'); const request = require('superagent'); +const { promisifyAll } = require('tsubaki'); +const fs = promisifyAll(require('fs')); +const path = require('path'); module.exports = class RIPCommand extends Command { constructor(client) { @@ -46,11 +49,8 @@ module.exports = class RIPCommand extends Command { } ctx.putImageData(imgData, 158, 51); }; - const ripImg = await request - .get('https://i.imgur.com/Gbu1B2m.png'); - const avatarImg = await request - .get(avatarURL); - base.src = ripImg.body; + base.src = await fs.readFileAsync(path.join(__dirname, '..', '..', 'assets', 'images', 'rip.png')); + const avatarImg = await request.get(avatarURL); avatar.src = avatarImg.body; generate(); return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'rip.png' }] }) diff --git a/commands/avataredit/steamcard.js b/commands/avataredit/steamcard.js index 5493bae4..2409e870 100644 --- a/commands/avataredit/steamcard.js +++ b/commands/avataredit/steamcard.js @@ -1,6 +1,8 @@ const { Command } = require('discord.js-commando'); const Canvas = require('canvas'); const request = require('superagent'); +const { promisifyAll } = require('tsubaki'); +const fs = promisifyAll(require('fs')); const path = require('path'); module.exports = class SteamCardCommand extends Command { @@ -43,11 +45,8 @@ module.exports = class SteamCardCommand extends Command { ctx.font = '30px Open Sans'; ctx.fillText(username, 35, 48); }; - const cardImg = await request - .get('https://i.imgur.com/JF0WwQX.png'); - const avatarImg = await request - .get(avatarURL); - base.src = cardImg.body; + base.src = await fs.readFileAsync(path.join(__dirname, '..', '..', 'assets', 'images', 'steamcard.png')); + const avatarImg = await request.get(avatarURL); avatar.src = avatarImg.body; generate(); return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'card.png' }] }) diff --git a/commands/avataredit/triggered.js b/commands/avataredit/triggered.js index a1cfc124..f4dc9c54 100644 --- a/commands/avataredit/triggered.js +++ b/commands/avataredit/triggered.js @@ -1,6 +1,9 @@ const { Command } = require('discord.js-commando'); const Canvas = require('canvas'); const request = require('superagent'); +const { promisifyAll } = require('tsubaki'); +const fs = promisifyAll(require('fs')); +const path = require('path'); module.exports = class TriggeredCommand extends Command { constructor(client) { @@ -44,11 +47,8 @@ module.exports = class TriggeredCommand extends Command { ctx.putImageData(imgData, 0, 0); ctx.drawImage(base, 0, 0); }; - const triggeredImg = await request - .get('https://i.imgur.com/tF9yF62.png'); - const avatarImg = await request - .get(avatarURL); - base.src = triggeredImg.body; + base.src = await fs.readFileAsync(path.join(__dirname, '..', '..', 'assets', 'images', 'triggered.png')); + const avatarImg = await request.get(avatarURL); avatar.src = avatarImg.body; generate(); return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'triggered.png' }] }) diff --git a/commands/avataredit/wanted.js b/commands/avataredit/wanted.js index a773fa97..1ba94fc5 100644 --- a/commands/avataredit/wanted.js +++ b/commands/avataredit/wanted.js @@ -1,6 +1,9 @@ const { Command } = require('discord.js-commando'); const Canvas = require('canvas'); const request = require('superagent'); +const { promisifyAll } = require('tsubaki'); +const fs = promisifyAll(require('fs')); +const path = require('path'); module.exports = class WantedCommand extends Command { constructor(client) { @@ -36,11 +39,8 @@ module.exports = class WantedCommand extends Command { ctx.drawImage(base, 0, 0); ctx.drawImage(avatar, 150, 360, 430, 430); }; - const wantedImg = await request - .get('https://i.imgur.com/6bBDfsO.png'); - const avatarImg = await request - .get(avatarURL); - base.src = wantedImg.body; + base.src = await fs.readFileAsync(path.join(__dirname, '..', '..', 'assets', 'images', 'wanted.png')); + const avatarImg = await request.get(avatarURL); avatar.src = avatarImg.body; generate(); return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'wanted.png' }] }) diff --git a/commands/numedit/currency.js b/commands/numedit/currency.js index 71377c00..2ec4dfe4 100644 --- a/commands/numedit/currency.js +++ b/commands/numedit/currency.js @@ -44,8 +44,7 @@ module.exports = class CurrencyCommand extends Command { const { base, to, amount } = args; if (base === to) return msg.say(`Converting ${base} to ${to} is the same value, dummy.`); try { - const { body } = await request - .get(`http://api.fixer.io/latest?base=${base}&symbols=${to}`); + const { body } = await request.get(`http://api.fixer.io/latest?base=${base}&symbols=${to}`); const rate = body.rates[to]; return msg.say(`${amount} ${base} is ${amount * rate} ${to}.`); } catch (err) { diff --git a/commands/random/spam.js b/commands/random/spam.js index 270f0b95..3e382f0d 100644 --- a/commands/random/spam.js +++ b/commands/random/spam.js @@ -11,9 +11,6 @@ module.exports = class SpamCommand extends Command { } run(msg) { - if (msg.channel.type !== 'dm') - if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) - return msg.say('This Command requires the `Attach Files` Permission.'); return msg.channel.send({ files: ['https://i.imgur.com/2JFu5xE.jpg'] }) .catch(err => msg.say(err)); } diff --git a/commands/randomimg/cat.js b/commands/randomimg/cat.js index b11564a0..104ef490 100644 --- a/commands/randomimg/cat.js +++ b/commands/randomimg/cat.js @@ -13,9 +13,6 @@ module.exports = class CatCommand extends Command { } async run(msg) { - if (msg.channel.type !== 'dm') - 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('http://random.cat/meow'); diff --git a/commands/randomimg/dog.js b/commands/randomimg/dog.js index 8ef25dea..6c31e634 100644 --- a/commands/randomimg/dog.js +++ b/commands/randomimg/dog.js @@ -12,9 +12,6 @@ module.exports = class DogCommand extends Command { } async run(msg) { - if (msg.channel.type !== 'dm') - 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://random.dog/woof.json'); diff --git a/commands/randomimg/xiaopai.js b/commands/randomimg/xiaopai.js index 72418fd9..3a21d6b5 100644 --- a/commands/randomimg/xiaopai.js +++ b/commands/randomimg/xiaopai.js @@ -13,9 +13,6 @@ module.exports = class XiaoCommand extends Command { } run(msg) { - if (msg.channel.type !== 'dm') - if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) - return msg.say('This Command requires the `Attach Files` Permission.'); const xiao = xiaos[Math.floor(Math.random() * xiaos.length)]; return msg.channel.send({ files: [xiao] }) .catch(err => msg.say(err)); diff --git a/commands/search/botinfo.js b/commands/search/botinfo.js index d325b2e8..63d0a5ce 100644 --- a/commands/search/botinfo.js +++ b/commands/search/botinfo.js @@ -31,7 +31,7 @@ module.exports = class BotSearchCommand extends Command { .set({ 'Authorization': DISCORD_BOTS_KEY }); const embed = new RichEmbed() .setColor(0x9797FF) - .setAuthor('Discord Bots', 'https://i.imgur.com/lrKYBQi.jpg') + .setAuthor('Discord Bots') .setTitle(body.name) .setURL(`https://bots.discord.pw/bots/${bot.id}`) .setDescription(body.description) diff --git a/commands/search/forecast.js b/commands/search/forecast.js index f502b85b..794dde9e 100644 --- a/commands/search/forecast.js +++ b/commands/search/forecast.js @@ -31,7 +31,7 @@ module.exports = class ForecastCommand extends Command { const forecasts = body.query.results.channel.item.forecast; const embed = new RichEmbed() .setColor(0x0000FF) - .setAuthor(body.query.results.channel.title, 'https://i.imgur.com/2MT0ViC.png') + .setAuthor(body.query.results.channel.title) .setURL(body.query.results.channel.link) .setTimestamp() .addField(`**${forecasts[0].day} - ${forecasts[0].date}:**`, diff --git a/commands/search/imdb.js b/commands/search/imdb.js index 4900e1c1..73132251 100644 --- a/commands/search/imdb.js +++ b/commands/search/imdb.js @@ -31,7 +31,7 @@ module.exports = class IMDBCommand extends Command { if (body.Error) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xDBA628) - .setAuthor('IMDB', 'https://i.imgur.com/sXwwIQs.png') + .setAuthor('IMDB') .setURL(`http://www.imdb.com/title/${body.imdbID}`) .setTitle(`${body.Title} (${body.imdbRating} Score)`) .setDescription(body.Plot.substr(0, 2000)) diff --git a/commands/search/osu.js b/commands/search/osu.js index 9a8c1737..c9755b14 100644 --- a/commands/search/osu.js +++ b/commands/search/osu.js @@ -32,7 +32,7 @@ module.exports = class OsuCommand extends Command { if (!body.length) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xFF66AA) - .setAuthor('osu!', 'https://i.imgur.com/EmnUp00.png') + .setAuthor('osu!') .setURL('https://osu.ppy.sh/') .addField('**Username:**', body[0].username, true) diff --git a/commands/search/soundcloud.js b/commands/search/soundcloud.js index 2d04c696..52d97343 100644 --- a/commands/search/soundcloud.js +++ b/commands/search/soundcloud.js @@ -32,7 +32,7 @@ module.exports = class SoundCloudCommand extends Command { if (!body.length) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xF15A22) - .setAuthor(body[0].title, 'https://i.imgur.com/lFIz7RU.png') + .setAuthor(body[0].title) .setURL(body[0].permalink_url) .setThumbnail(body[0].artwork_url) .addField('**Artist:**', diff --git a/commands/search/urban.js b/commands/search/urban.js index 5f94b431..7511486b 100644 --- a/commands/search/urban.js +++ b/commands/search/urban.js @@ -31,7 +31,7 @@ module.exports = class UrbanCommand extends Command { if (!body.list.length) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0x32a8f0) - .setAuthor('Urban Dictionary', 'https://i.imgur.com/fzFuuL7.png') + .setAuthor('Urban Dictionary') .setURL(body.list[0].permalink) .setTitle(body.list[0].word) .setDescription(body.list[0].definition.substr(0, 2000)) diff --git a/commands/search/wattpad.js b/commands/search/wattpad.js index 99c6e971..8c698c59 100644 --- a/commands/search/wattpad.js +++ b/commands/search/wattpad.js @@ -33,7 +33,7 @@ module.exports = class WattpadCommand extends Command { if (!body.stories.length) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xF89C34) - .setAuthor('Wattpad', 'https://i.imgur.com/Rw9vRQB.png') + .setAuthor('Wattpad') .setURL(body.stories[0].url) .setTitle(body.stories[0].title) .setDescription(body.stories[0].description.substr(0, 2000)) diff --git a/commands/search/weather.js b/commands/search/weather.js index 5cb75856..a806ab3f 100644 --- a/commands/search/weather.js +++ b/commands/search/weather.js @@ -30,7 +30,7 @@ module.exports = class WeatherCommand extends Command { if (!body.query.count) throw new Error('Location Not Found.'); const embed = new RichEmbed() .setColor(0x0000FF) - .setAuthor(body.query.results.channel.title, 'https://i.imgur.com/2MT0ViC.png') + .setAuthor(body.query.results.channel.title) .setURL(body.query.results.channel.link) .setTimestamp() .addField('**City:**', diff --git a/commands/search/wikipedia.js b/commands/search/wikipedia.js index 60f0e0e2..36d610c1 100644 --- a/commands/search/wikipedia.js +++ b/commands/search/wikipedia.js @@ -33,7 +33,7 @@ module.exports = class WikipediaCommand extends Command { .setColor(0xE7E7E7) .setTitle(body.query.pages[0].title) .setURL(`https://en.wikipedia.org/wiki/${query}`) - .setAuthor('Wikipedia', 'https://i.imgur.com/a4eeEhh.png') + .setAuthor('Wikipedia') .setDescription(body.query.pages[0].extract.substr(0, 2000).replace(/[\n]/g, '\n\n')); return msg.embed(embed); } catch (err) { diff --git a/commands/search/youtube.js b/commands/search/youtube.js index 33257d1e..30b662af 100644 --- a/commands/search/youtube.js +++ b/commands/search/youtube.js @@ -34,7 +34,7 @@ module.exports = class YouTubeCommand extends Command { .setColor(0xDD2825) .setTitle(body.items[0].snippet.title) .setDescription(body.items[0].snippet.description) - .setAuthor(`YouTube - ${body.items[0].snippet.channelTitle}`, 'https://i.imgur.com/hkUafwu.png') + .setAuthor(`YouTube - ${body.items[0].snippet.channelTitle}`) .setURL(`https://www.youtube.com/watch?v=${body.items[0].id.videoId}`) .setThumbnail(body.items[0].snippet.thumbnails.default.url); return msg.embed(embed); diff --git a/commands/search/yugioh.js b/commands/search/yugioh.js index 89a92375..56057433 100644 --- a/commands/search/yugioh.js +++ b/commands/search/yugioh.js @@ -34,7 +34,7 @@ module.exports = class YuGiOhCommand extends Command { .setColor(0xBE5F1F) .setTitle(body.data.name) .setDescription(body.data.text) - .setAuthor('Yu-Gi-Oh!', 'https://i.imgur.com/7gPm9Rr.png') + .setAuthor('Yu-Gi-Oh!') .addField('**Card Type:**', body.data.card_type, true) .addField('**Type:**', diff --git a/commands/userinfo/userinfo.js b/commands/userinfo/userinfo.js index 12257e77..2320ecf5 100644 --- a/commands/userinfo/userinfo.js +++ b/commands/userinfo/userinfo.js @@ -57,12 +57,12 @@ module.exports = class UserInfoCommand extends Command { member.id, true) .addField('**Joined Discord On:**', stripIndents` - ${moment(member.user.createdTimestamp).format('MMMM Do YYYY h:mm:ss a')} + ${moment(member.user.createdTimestamp).format('MMMM Do YYYY h:mm:ss A')} ${moment.duration(Date.now() - member.user.createdTimestamp).format('y[ years], M[ months], w[ weeks, and ]d[ days]')} ago. `) .addField('**Joined Server On:**', stripIndents` - ${moment(member.joinedTimestamp).format('MMMM Do YYYY h:mm:ss a')} + ${moment(member.joinedTimestamp).format('MMMM Do YYYY h:mm:ss A')} ${moment.duration(Date.now() - member.joinedTimestamp).format('y[ years], M[ months], w[ weeks, and ]d[ days]')} ago. `) .addField('**Status:**', diff --git a/commands/util/info.js b/commands/util/info.js index 79b5cd8b..c7123443 100644 --- a/commands/util/info.js +++ b/commands/util/info.js @@ -58,7 +58,8 @@ module.exports = class InfoCommand extends Command { [canvas](https://github.com/Automattic/node-canvas), [cheerio](https://cheerio.js.org), [sequelize](http://docs.sequelizejs.com), - [pg](https://github.com/brianc/node-postgres) + [pg](https://github.com/brianc/node-postgres), + [tsubaki](https://github.com/iCrawl/tsubaki) ` ) .addField('APIs', diff --git a/package.json b/package.json index c93f9441..5077f135 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "19.2.2", + "version": "19.2.3", "description": "A Discord Bot", "main": "shardingmanager.js", "scripts": { @@ -44,6 +44,7 @@ "pg": "^6.1.5", "sequelize": "^3.30.4", "superagent": "^3.5.2", + "tsubaki": "^1.1.0", "zalgolize": "^1.2.4" } }