diff --git a/README.md b/README.md index 24c3a857..847675a4 100644 --- a/README.md +++ b/README.md @@ -258,7 +258,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 553 +Total: 554 ### Utility: @@ -553,6 +553,7 @@ Total: 553 * **fishy:** Go fishing. * **google-feud:** Attempt to determine the top suggestions for a Google search. * **hangman:** Prevent a man from being hanged by guessing a word as fast as you can. +* **hearing-test:** Test your hearing. * **horse-info:** Responds with detailed information on a horse. * **horse-race:** Bet on the fastest horse in a 6-horse race. * **hunger-games:** Simulate a Hunger Games match with up to 24 tributes. @@ -1429,6 +1430,8 @@ here. * challenger ([Original "Super Smash Bros." Game](https://www.smashbros.com/en_US/index.html)) * mario-bros-views ([Original "Super Mario Bros." Game](https://mario.nintendo.com/)) * smw-level ([Original "Super Mario World" Game](https://www.nintendo.co.jp/n02/shvc/mw/index.html)) +- [Noise addicts](http://www.noiseaddicts.com/) + * hearing-test ([Sounds](http://www.noiseaddicts.com/2011/06/mosquito-ringtones/)) - [NotAWeebDev](https://github.com/NotAWeebDev/) * triggered ([Image](https://github.com/NotAWeebDev/Misaki/blob/2e44f9efb467028dcbae5a2c9f836d2e99860b85/assets/images/plate_triggered.png)) - [npm](https://www.npmjs.com/) diff --git a/assets/json/hearing-test.json b/assets/json/hearing-test.json new file mode 100644 index 00000000..3adfa08e --- /dev/null +++ b/assets/json/hearing-test.json @@ -0,0 +1,14 @@ +{ + "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" +} diff --git a/assets/sounds/hearing-test/10000.mp3 b/assets/sounds/hearing-test/10000.mp3 new file mode 100644 index 00000000..c5ef3fd5 Binary files /dev/null and b/assets/sounds/hearing-test/10000.mp3 differ diff --git a/assets/sounds/hearing-test/12000.mp3 b/assets/sounds/hearing-test/12000.mp3 new file mode 100644 index 00000000..a0ae783e Binary files /dev/null and b/assets/sounds/hearing-test/12000.mp3 differ diff --git a/assets/sounds/hearing-test/14000.mp3 b/assets/sounds/hearing-test/14000.mp3 new file mode 100644 index 00000000..9d12e9e2 Binary files /dev/null and b/assets/sounds/hearing-test/14000.mp3 differ diff --git a/assets/sounds/hearing-test/15000.mp3 b/assets/sounds/hearing-test/15000.mp3 new file mode 100644 index 00000000..be8ff492 Binary files /dev/null and b/assets/sounds/hearing-test/15000.mp3 differ diff --git a/assets/sounds/hearing-test/16000.mp3 b/assets/sounds/hearing-test/16000.mp3 new file mode 100644 index 00000000..cbad2a28 Binary files /dev/null and b/assets/sounds/hearing-test/16000.mp3 differ diff --git a/assets/sounds/hearing-test/17000.mp3 b/assets/sounds/hearing-test/17000.mp3 new file mode 100644 index 00000000..262a6cca Binary files /dev/null and b/assets/sounds/hearing-test/17000.mp3 differ diff --git a/assets/sounds/hearing-test/18000.mp3 b/assets/sounds/hearing-test/18000.mp3 new file mode 100644 index 00000000..ea681d7a Binary files /dev/null and b/assets/sounds/hearing-test/18000.mp3 differ diff --git a/assets/sounds/hearing-test/19000.mp3 b/assets/sounds/hearing-test/19000.mp3 new file mode 100644 index 00000000..4eaf763a Binary files /dev/null and b/assets/sounds/hearing-test/19000.mp3 differ diff --git a/assets/sounds/hearing-test/20000.mp3 b/assets/sounds/hearing-test/20000.mp3 new file mode 100644 index 00000000..65aa0712 Binary files /dev/null and b/assets/sounds/hearing-test/20000.mp3 differ diff --git a/assets/sounds/hearing-test/21000.mp3 b/assets/sounds/hearing-test/21000.mp3 new file mode 100644 index 00000000..8b24d323 Binary files /dev/null and b/assets/sounds/hearing-test/21000.mp3 differ diff --git a/assets/sounds/hearing-test/22000.mp3 b/assets/sounds/hearing-test/22000.mp3 new file mode 100644 index 00000000..1f43bb9a Binary files /dev/null and b/assets/sounds/hearing-test/22000.mp3 differ diff --git a/assets/sounds/hearing-test/8000.mp3 b/assets/sounds/hearing-test/8000.mp3 new file mode 100644 index 00000000..f0c1553f Binary files /dev/null and b/assets/sounds/hearing-test/8000.mp3 differ diff --git a/commands/games-sp/hearing-test.js b/commands/games-sp/hearing-test.js new file mode 100644 index 00000000..0794923d --- /dev/null +++ b/commands/games-sp/hearing-test.js @@ -0,0 +1,55 @@ +const Command = require('../../structures/Command'); +const path = require('path'); +const { delay, verify } = require('../../util/Util'); +const data = require('../../assets/json/hearing-test'); + +module.exports = class HearingTestCommand extends Command { + constructor(client) { + super(client, { + name: 'hearing-test', + aliases: ['hear-test', 'hear', 'hearing'], + group: 'games-sp', + memberName: 'hearing-test', + description: 'Test your hearing.', + throttling: { + usages: 1, + duration: 10 + }, + guildOnly: true, + userPermissions: ['CONNECT', 'SPEAK'], + credit: [ + { + name: 'Noise addicts', + url: 'http://www.noiseaddicts.com/', + reason: 'Sounds', + reasonURL: 'http://www.noiseaddicts.com/2011/06/mosquito-ringtones/' + } + ] + }); + } + + async run(msg) { + const connection = this.client.voice.connections.get(msg.guild.id); + if (!connection) { + const usage = this.client.registry.commands.get('join').usage(); + return msg.reply(`I am not in a voice channel. Use ${usage} to fix that!`); + } + try { + let age; + for (const [dataAge, file] of Object.entries(data)) { + connection.play(path.join(__dirname, '..', '..', 'assets', 'sounds', 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/, ''); + break; + } + } + if (age === 'all') return msg.reply('Everyone should be able to hear that. You cannot hear.'); + return msg.reply(`You have the hearing of a **${Number.parseInt(age, 10) + 1} year old**.`); + } catch (err) { + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/package.json b/package.json index 4d913289..90d1b635 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "119.35.2", + "version": "119.36.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {