Remove difficulty from typing-test

This commit is contained in:
Dragon Fire
2021-01-31 13:20:37 -05:00
parent 4773f651ca
commit aae37e1f87
2 changed files with 6 additions and 26 deletions
+1 -1
View File
@@ -598,7 +598,7 @@ Total: 588
* **sorting-hat:** Take a quiz to determine your Hogwarts house.
* **the-game:** If you think about the game, you lose.
* **true-or-false:** Answer a true or false question.
* **typing-test:** See how fast you can type a sentence in a given time limit.
* **typing-test:** See how fast you can type a sentence.
* **waldo:** Try to find Waldo with spoiler tags!
* **whos-that-pokemon-cry:** Guess who that Pokémon is, based on their cry.
* **whos-that-pokemon:** Guess who that Pokémon is, based on their silhouette.
+5 -25
View File
@@ -2,18 +2,9 @@ const Command = require('../../structures/Command');
const { createCanvas, registerFont } = require('canvas');
const { stripIndents } = require('common-tags');
const path = require('path');
const { list, fetchHSUserDisplay } = require('../../util/Util');
const { fetchHSUserDisplay } = require('../../util/Util');
const words = require('../../assets/json/word-list');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
const difficulties = ['baby', 'easy', 'medium', 'hard', 'extreme', 'impossible'];
const times = {
baby: 60000,
easy: 25000,
medium: 20000,
hard: 15000,
extreme: 10000,
impossible: 5000
};
module.exports = class TypingTestCommand extends Command {
constructor(client) {
@@ -21,30 +12,19 @@ module.exports = class TypingTestCommand extends Command {
name: 'typing-test',
group: 'games-sp',
memberName: 'typing-test',
description: 'See how fast you can type a sentence in a given time limit.',
details: `**Difficulties:** ${difficulties.join(', ')}`,
args: [
{
key: 'difficulty',
prompt: `What should the difficulty of the game be? Either ${list(difficulties, 'or')}.`,
type: 'string',
oneOf: difficulties,
parse: difficulty => difficulty.toLowerCase()
}
]
description: 'See how fast you can type a sentence.'
});
}
async run(msg, { difficulty }) {
async run(msg) {
const sentence = this.generateSentence(5);
const time = times[difficulty];
await msg.reply(`**You have ${time / 1000} seconds to type this sentence.**`, {
await msg.reply(`**You have 30 seconds to type this sentence.**`, {
files: [{ attachment: this.generateImage(sentence), name: 'typing-test.png' }]
});
const now = Date.now();
const msgs = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
max: 1,
time
time: 30000
});
const win = msgs.size && msgs.first().content.toLowerCase() === sentence;
const newScore = Date.now() - now;