Lots of stoof

This commit is contained in:
Daniel Odendahl Jr
2017-10-12 02:15:40 +00:00
parent 04c1728591
commit b15beb8d48
7 changed files with 30 additions and 14 deletions
+7 -4
View File
@@ -24,7 +24,7 @@ module.exports = class AkinatorCommand extends Command {
this.sessions.set(msg.channel.id, { progress: null });
while (this.sessions.get(msg.channel.id).progress < 99) {
const data = ans === null ? await this.createSession(msg.channel) : await this.progress(msg.channel, ans);
if (this.sessions.get(msg.channel.id).step >= 80) break;
if (!data || this.sessions.get(msg.channel.id).step >= 80) break;
const answers = data.answers.map(answer => answer.answer.toLowerCase());
answers.push('end');
await msg.say(stripIndents`
@@ -76,6 +76,7 @@ module.exports = class AkinatorCommand extends Command {
player: 'xiaobot'
});
const data = body.parameters;
if (!data) return null;
this.sessions.set(channel.id, {
id: data.identification.session,
signature: data.identification.signature,
@@ -95,13 +96,15 @@ module.exports = class AkinatorCommand extends Command {
step: session.step,
answer
});
const data = body.parameters;
if (!data) return null;
this.sessions.set(channel.id, {
id: session.id,
signature: session.signature,
step: parseInt(body.parameters.step, 10),
progress: parseInt(body.parameters.progression, 10)
step: parseInt(data.step, 10),
progress: parseInt(data.progression, 10)
});
return body.parameters;
return data;
}
async finish(channel) {
+8 -2
View File
@@ -1,4 +1,5 @@
const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
const pokemon = require('../../assets/json/pokemon-fusion');
module.exports = class PokemonFusionCommand extends Command {
@@ -35,7 +36,12 @@ module.exports = class PokemonFusionCommand extends Command {
});
}
run(msg, { body, palette }) {
return msg.say({ files: [`http://images.alexonsager.net/pokemon/fused/${body}/${body}.${palette}.png`] });
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!`);
}
}
};
+1 -1
View File
@@ -50,7 +50,7 @@ module.exports = class SoundboardCommand extends Command {
return null;
} catch (err) {
channel.leave();
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
throw err;
}
}
};
+2 -1
View File
@@ -38,7 +38,8 @@ module.exports = class RecipeCommand extends Command {
.setThumbnail(recipe.thumbnail);
return msg.embed(embed);
} catch (err) {
return msg.say('Could not find any results.');
if (err.status === 500) return msg.say('Could not find any results.');
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+10 -4
View File
@@ -40,15 +40,17 @@ module.exports = class SteamCommand extends Command {
const original = data.price_overview ? data.price_overview.initial / 100 : 0;
const price = current === original ? `$${current}` : `~~$${original}~~ $${current}`;
const platforms = [];
if (data.platforms.windows) platforms.push('Windows');
if (data.platforms.mac) platforms.push('Mac');
if (data.platforms.linux) platforms.push('Linux');
if (data.platforms) {
if (data.platforms.windows) platforms.push('Windows');
if (data.platforms.mac) platforms.push('Mac');
if (data.platforms.linux) platforms.push('Linux');
}
const embed = new MessageEmbed()
.setColor(0x101D2F)
.setAuthor('Steam', 'https://i.imgur.com/xxr2UBZ.png')
.setTitle(data.name)
.setURL(`http://store.steampowered.com/app/${data.steam_appid}`)
.setImage(data.header_image)
.setThumbnail(search.body.tiny_image)
.addField(' Price',
price, true)
.addField(' Metascore',
@@ -57,6 +59,10 @@ module.exports = class SteamCommand extends Command {
data.recommendations ? data.recommendations.total : 'N/A', true)
.addField(' Platforms',
platforms.join(', ') || 'None', true)
.addField(' Release Data',
data.release_date ? data.release_date.date : 'N/A', true)
.addField(' DLC Count',
data.dlc ? data.dlc.length : 0, true)
.addField(' Developers',
data.developers.join(', ') || 'N/A')
.addField(' Publishers',
+1 -1
View File
@@ -42,7 +42,7 @@ module.exports = class VocaloidCommand extends Command {
.setAuthor('VocaDB', 'https://i.imgur.com/6QwraDT.jpg')
.setTitle(data.name)
.setURL(`http://vocadb.net/S/${data.id}`)
.setDescription(data.lyrics.length ? shorten(data.lyrics[0].value) : 'N/A')
.setDescription(data.lyrics.length ? shorten(data.lyrics[0].value) : 'No lyrics available.')
.setThumbnail(data.thumbUrl)
.addField(' Artist',
data.artistString)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "47.0.1",
"version": "47.0.2",
"description": "Your personal server companion.",
"main": "Shard.js",
"scripts": {