mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-17 08:17:35 +02:00
msg
This commit is contained in:
@@ -23,10 +23,10 @@ module.exports = class TypingGameCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { difficulty } = args;
|
||||
const sentence = sentences[Math.floor(Math.random() * sentences.length)];
|
||||
let time;
|
||||
@@ -50,18 +50,18 @@ module.exports = class TypingGameCommand extends Command {
|
||||
const embed = new RichEmbed()
|
||||
.setTitle(`You have **${time / 1000}** seconds to type:`)
|
||||
.setDescription(sentence);
|
||||
await message.embed(embed);
|
||||
await msg.embed(embed);
|
||||
try {
|
||||
const collected = await message.channel.awaitMessages(response => response.author.id === message.author.id, {
|
||||
const collected = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
|
||||
max: 1,
|
||||
time: time,
|
||||
errors: ['time']
|
||||
});
|
||||
if (collected.first().content !== sentence)
|
||||
return message.say('Nope, your sentence does not match the original. Try again next time!');
|
||||
return message.say(`Good Job! You won!`);
|
||||
return msg.say('Nope, your sentence does not match the original. Try again next time!');
|
||||
return msg.say(`Good Job! You won!`);
|
||||
} catch (err) {
|
||||
return message.say('Aw... Too bad, try again next time!');
|
||||
return msg.say('Aw... Too bad, try again next time!');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user