mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 18:05:01 +02:00
Lots of stoof
This commit is contained in:
@@ -24,7 +24,7 @@ module.exports = class AkinatorCommand extends Command {
|
|||||||
this.sessions.set(msg.channel.id, { progress: null });
|
this.sessions.set(msg.channel.id, { progress: null });
|
||||||
while (this.sessions.get(msg.channel.id).progress < 99) {
|
while (this.sessions.get(msg.channel.id).progress < 99) {
|
||||||
const data = ans === null ? await this.createSession(msg.channel) : await this.progress(msg.channel, ans);
|
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());
|
const answers = data.answers.map(answer => answer.answer.toLowerCase());
|
||||||
answers.push('end');
|
answers.push('end');
|
||||||
await msg.say(stripIndents`
|
await msg.say(stripIndents`
|
||||||
@@ -76,6 +76,7 @@ module.exports = class AkinatorCommand extends Command {
|
|||||||
player: 'xiaobot'
|
player: 'xiaobot'
|
||||||
});
|
});
|
||||||
const data = body.parameters;
|
const data = body.parameters;
|
||||||
|
if (!data) return null;
|
||||||
this.sessions.set(channel.id, {
|
this.sessions.set(channel.id, {
|
||||||
id: data.identification.session,
|
id: data.identification.session,
|
||||||
signature: data.identification.signature,
|
signature: data.identification.signature,
|
||||||
@@ -95,13 +96,15 @@ module.exports = class AkinatorCommand extends Command {
|
|||||||
step: session.step,
|
step: session.step,
|
||||||
answer
|
answer
|
||||||
});
|
});
|
||||||
|
const data = body.parameters;
|
||||||
|
if (!data) return null;
|
||||||
this.sessions.set(channel.id, {
|
this.sessions.set(channel.id, {
|
||||||
id: session.id,
|
id: session.id,
|
||||||
signature: session.signature,
|
signature: session.signature,
|
||||||
step: parseInt(body.parameters.step, 10),
|
step: parseInt(data.step, 10),
|
||||||
progress: parseInt(body.parameters.progression, 10)
|
progress: parseInt(data.progression, 10)
|
||||||
});
|
});
|
||||||
return body.parameters;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async finish(channel) {
|
async finish(channel) {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const { Command } = require('discord.js-commando');
|
const { Command } = require('discord.js-commando');
|
||||||
|
const snekfetch = require('snekfetch');
|
||||||
const pokemon = require('../../assets/json/pokemon-fusion');
|
const pokemon = require('../../assets/json/pokemon-fusion');
|
||||||
|
|
||||||
module.exports = class PokemonFusionCommand extends Command {
|
module.exports = class PokemonFusionCommand extends Command {
|
||||||
@@ -35,7 +36,12 @@ module.exports = class PokemonFusionCommand extends Command {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
run(msg, { body, palette }) {
|
async run(msg, { body, palette }) {
|
||||||
return msg.say({ files: [`http://images.alexonsager.net/pokemon/fused/${body}/${body}.${palette}.png`] });
|
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!`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ module.exports = class SoundboardCommand extends Command {
|
|||||||
return null;
|
return null;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
channel.leave();
|
channel.leave();
|
||||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ module.exports = class RecipeCommand extends Command {
|
|||||||
.setThumbnail(recipe.thumbnail);
|
.setThumbnail(recipe.thumbnail);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} 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!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,15 +40,17 @@ module.exports = class SteamCommand extends Command {
|
|||||||
const original = data.price_overview ? data.price_overview.initial / 100 : 0;
|
const original = data.price_overview ? data.price_overview.initial / 100 : 0;
|
||||||
const price = current === original ? `$${current}` : `~~$${original}~~ $${current}`;
|
const price = current === original ? `$${current}` : `~~$${original}~~ $${current}`;
|
||||||
const platforms = [];
|
const platforms = [];
|
||||||
if (data.platforms.windows) platforms.push('Windows');
|
if (data.platforms) {
|
||||||
if (data.platforms.mac) platforms.push('Mac');
|
if (data.platforms.windows) platforms.push('Windows');
|
||||||
if (data.platforms.linux) platforms.push('Linux');
|
if (data.platforms.mac) platforms.push('Mac');
|
||||||
|
if (data.platforms.linux) platforms.push('Linux');
|
||||||
|
}
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(0x101D2F)
|
.setColor(0x101D2F)
|
||||||
.setAuthor('Steam', 'https://i.imgur.com/xxr2UBZ.png')
|
.setAuthor('Steam', 'https://i.imgur.com/xxr2UBZ.png')
|
||||||
.setTitle(data.name)
|
.setTitle(data.name)
|
||||||
.setURL(`http://store.steampowered.com/app/${data.steam_appid}`)
|
.setURL(`http://store.steampowered.com/app/${data.steam_appid}`)
|
||||||
.setImage(data.header_image)
|
.setThumbnail(search.body.tiny_image)
|
||||||
.addField('❯ Price',
|
.addField('❯ Price',
|
||||||
price, true)
|
price, true)
|
||||||
.addField('❯ Metascore',
|
.addField('❯ Metascore',
|
||||||
@@ -57,6 +59,10 @@ module.exports = class SteamCommand extends Command {
|
|||||||
data.recommendations ? data.recommendations.total : 'N/A', true)
|
data.recommendations ? data.recommendations.total : 'N/A', true)
|
||||||
.addField('❯ Platforms',
|
.addField('❯ Platforms',
|
||||||
platforms.join(', ') || 'None', true)
|
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',
|
.addField('❯ Developers',
|
||||||
data.developers.join(', ') || 'N/A')
|
data.developers.join(', ') || 'N/A')
|
||||||
.addField('❯ Publishers',
|
.addField('❯ Publishers',
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ module.exports = class VocaloidCommand extends Command {
|
|||||||
.setAuthor('VocaDB', 'https://i.imgur.com/6QwraDT.jpg')
|
.setAuthor('VocaDB', 'https://i.imgur.com/6QwraDT.jpg')
|
||||||
.setTitle(data.name)
|
.setTitle(data.name)
|
||||||
.setURL(`http://vocadb.net/S/${data.id}`)
|
.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)
|
.setThumbnail(data.thumbUrl)
|
||||||
.addField('❯ Artist',
|
.addField('❯ Artist',
|
||||||
data.artistString)
|
data.artistString)
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "47.0.1",
|
"version": "47.0.2",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Shard.js",
|
"main": "Shard.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user