mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-14 15:57:42 +02:00
Support More Pokemon
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { reactIfAble } = require('../../util/Util');
|
||||
const pokemonCount = 893;
|
||||
|
||||
module.exports = class WhosThatPokemonCryCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -70,9 +69,9 @@ module.exports = class WhosThatPokemonCryCommand extends Command {
|
||||
key: 'pokemon',
|
||||
prompt: 'What Pokémon do you want to use?',
|
||||
type: 'integer',
|
||||
max: pokemonCount,
|
||||
max: client.pokemon.pokemonCountWithCry,
|
||||
min: 0,
|
||||
default: () => Math.floor(Math.random() * (pokemonCount + 1))
|
||||
default: () => Math.floor(Math.random() * (client.pokemon.pokemonCountWithCry + 1))
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -5,7 +5,6 @@ const { reactIfAble } = require('../../util/Util');
|
||||
const { silhouette } = require('../../util/Canvas');
|
||||
const path = require('path');
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Pokemon Solid.ttf'), { family: 'Pokemon' });
|
||||
const pokemonCount = 893;
|
||||
|
||||
module.exports = class WhosThatPokemonCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -73,9 +72,9 @@ module.exports = class WhosThatPokemonCommand extends Command {
|
||||
key: 'pokemon',
|
||||
prompt: 'What Pokémon do you want to use?',
|
||||
type: 'integer',
|
||||
max: pokemonCount,
|
||||
max: client.pokemon.pokemonCount,
|
||||
min: 0,
|
||||
default: () => Math.floor(Math.random() * (pokemonCount + 1))
|
||||
default: () => Math.floor(Math.random() * (client.pokemon.pokemonCount + 1))
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -100,10 +99,9 @@ module.exports = class WhosThatPokemonCommand extends Command {
|
||||
max: 1,
|
||||
time: 15000
|
||||
});
|
||||
if (connection) {
|
||||
if (connection && data.cry) {
|
||||
if (connection.dispatcher) connection.dispatcher.end();
|
||||
connection.play(data.cry);
|
||||
await reactIfAble(msg, this.client.user, '🔉');
|
||||
}
|
||||
this.client.games.delete(msg.channel.id);
|
||||
if (!msgs.size) return msg.reply(`Time! It's **${data.name}**!`, { files: [answerAttachment] });
|
||||
|
||||
@@ -88,13 +88,15 @@ module.exports = class PokedexCommand extends Command {
|
||||
if (found.id === data.id) return `**${found.name}**`;
|
||||
return found.name;
|
||||
}).join(' -> '));
|
||||
const connection = msg.guild ? this.client.voice.connections.get(msg.guild.id) : null;
|
||||
if (connection) {
|
||||
connection.play(data.cry);
|
||||
await reactIfAble(msg, this.client.user, '🔉');
|
||||
} else {
|
||||
const usage = this.client.registry.commands.get('join').usage();
|
||||
embed.setFooter(`Join a voice channel and use ${usage} to hear the Pokémon's cry.`);
|
||||
if (data.cry) {
|
||||
const connection = msg.guild ? this.client.voice.connections.get(msg.guild.id) : null;
|
||||
if (connection) {
|
||||
connection.play(data.cry);
|
||||
await reactIfAble(msg, this.client.user, '🔉');
|
||||
} else {
|
||||
const usage = this.client.registry.commands.get('join').usage();
|
||||
embed.setFooter(`Join a voice channel and use ${usage} to hear the Pokémon's cry.`);
|
||||
}
|
||||
}
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user