From 0e92006cb613cedbbcffd6903a3c93b62897b567 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 31 Oct 2020 11:11:48 -0400 Subject: [PATCH] Fix --- assets/json/hearing-test.json | 64 ++++++++++++++++++++++++------- commands/games-sp/hearing-test.js | 4 +- 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/assets/json/hearing-test.json b/assets/json/hearing-test.json index 3adfa08e..72ecc237 100644 --- a/assets/json/hearing-test.json +++ b/assets/json/hearing-test.json @@ -1,14 +1,50 @@ -{ - "all": "8000.mp3", - "60": "10000.mp3", - "50": "12000.mp3", - "45": "14000.mp3", - "39": "15000.mp3", - "30": "16000.mp3", - "24a": "17000.mp3", - "24b": "18000.mp3", - "24c": "19000.mp3", - "24d": "20000.mp3", - "20": "21000.mp3", - "18": "22000.mp3" -} +[ + { + "age": "all", + "file": "8000.mp3" + }, + { + "age": "60", + "file": "10000.mp3" + }, + { + "age": "50", + "file": "12000.mp3" + }, + { + "age": "45", + "file": "14000.mp3" + }, + { + "age": "39", + "file": "15000.mp3" + }, + { + "age": "30", + "file": "16000.mp3" + }, + { + "age": "24", + "file": "17000.mp3" + }, + { + "age": "24", + "file": "18000.mp3" + }, + { + "age": "24", + "file": "19000.mp3" + }, + { + "age": "24", + "file": "20000.mp3" + }, + { + "age": "20", + "file": "21000.mp3" + }, + { + "age": "18", + "file": "22000.mp3" + } +] diff --git a/commands/games-sp/hearing-test.js b/commands/games-sp/hearing-test.js index 1f595945..7b57fab1 100644 --- a/commands/games-sp/hearing-test.js +++ b/commands/games-sp/hearing-test.js @@ -36,13 +36,13 @@ module.exports = class HearingTestCommand extends Command { } try { let age; - for (const [dataAge, file] of Object.entries(data)) { + for (const { age: dataAge, file } of data) { connection.play(path.join(__dirname, '..', '..', 'assets', 'sounds', 'hearing-test', file)); await delay(2000); await msg.reply('Did you hear that sound? Reply with [y]es or [n]o.'); const heard = await verify(msg.channel, msg.author); if (!heard) { - age = dataAge.replace(/a|b|c|d/, ''); + age = dataAge; break; } }