More Stoof

This commit is contained in:
Daniel Odendahl Jr
2017-10-13 17:33:29 +00:00
parent 76111000b5
commit 981f59b1b1
40 changed files with 228 additions and 125 deletions
+4 -1
View File
@@ -33,7 +33,10 @@ module.exports = class AchievementCommand extends Command {
h: 'Achievement Get!',
t: text
});
return msg.say({ files: [{ attachment: body, name: 'achievement.png' }] });
return msg.say({ files: [{
attachment: body,
name: 'achievement.png'
}] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+6 -3
View File
@@ -32,9 +32,9 @@ module.exports = class BeLikeBillCommand extends Command {
}
async run(msg, { name }) {
const canvas = createCanvas(800, 420);
const ctx = canvas.getContext('2d');
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'be-like-bill.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '23px Noto';
const text = stripIndents`
@@ -46,7 +46,10 @@ module.exports = class BeLikeBillCommand extends Command {
Be like ${name}.
`;
ctx.fillText(text, 31, 80);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'be-like-bill.png' }] });
return msg.say({ files: [{
attachment: canvas.toBuffer(),
name: 'be-like-bill.png'
}] });
}
};
+4 -1
View File
@@ -30,6 +30,9 @@ module.exports = class ColorCommand extends Command {
const ctx = canvas.getContext('2d');
ctx.fillStyle = color;
ctx.fillRect(0, 0, 250, 250);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'color.png' }] });
return msg.say({ files: [{
attachment: canvas.toBuffer(),
name: 'color.png'
}] });
}
};
+4 -1
View File
@@ -45,7 +45,10 @@ module.exports = class MemeCommand extends Command {
const search = await snekfetch.get(`https://memegen.link/api/search/${type}`);
if (!search.body.length) return msg.say('Could not find any results.');
const { body } = await snekfetch.get(search.body[0].template.blank.replace(/\/_/, `/${top}/${bottom}`));
return msg.say({ files: [{ attachment: body, name: 'meme.jpg' }] });
return msg.say({ files: [{
attachment: body,
name: 'meme.jpg'
}] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+2 -8
View File
@@ -1,5 +1,4 @@
const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
const pokemon = require('../../assets/json/pokemon-fusion');
module.exports = class PokemonFusionCommand extends Command {
@@ -36,12 +35,7 @@ module.exports = class PokemonFusionCommand extends Command {
});
}
async run(msg, { body, palette }) {
try {
const image = await snekfetch.get(`http://images.alexonsager.net/pokemon/fused/${body}/${body}.${palette}.png`);
return msg.say({ files: [{ attachment: image.body, name: 'pokemon-fusion.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
run(msg, { body, palette }) {
return msg.say(`http://images.alexonsager.net/pokemon/fused/${body}/${body}.${palette}.png`);
}
};
+4 -1
View File
@@ -23,7 +23,10 @@ module.exports = class RobohashCommand extends Command {
async run(msg, { text }) {
try {
const { body } = await snekfetch.get(`https://robohash.org/${text}`);
return msg.say({ files: [{ attachment: body, name: 'robohash.png' }] });
return msg.say({ files: [{
attachment: body,
name: 'robohash.png'
}] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}