Hearing Test Command

This commit is contained in:
Dragon Fire
2020-10-31 11:00:28 -04:00
parent d74639e1f4
commit 06d23a15b4
16 changed files with 74 additions and 2 deletions
+4 -1
View File
@@ -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/)
+14
View File
@@ -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"
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+55
View File
@@ -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!`);
}
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "119.35.2",
"version": "119.36.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {