diff --git a/README.md b/README.md index f59aa3aa..bb4381a3 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 410 +Total: 411 ### Utility: @@ -567,6 +567,7 @@ Total: 410 ### Other: +* **airhorn:** Plays an airhorn sound in a voice channel. * **cleverbot:** Talk to Cleverbot. (Owner-Only) * **phone-book:** Looks up phone-enabled servers. * **phone:** Starts a phone call with a random server. @@ -733,6 +734,8 @@ here. * owo (Code) - [Digital Equipment Corporation](http://gordonbell.azurewebsites.net/digital/timeline/tmlnhome.htm) * dec-talk (Original DECTalk Software) +- [Discord](https://discord.com/) + * airhorn ([Airhorn Sounds](https://github.com/discord/airhornbot/tree/master/audio)) - [Discord Status Button](https://discord.c99.nl/) * status-button (API) - [Disney](https://www.disney.com/) diff --git a/assets/json/airhorn.json b/assets/json/airhorn.json new file mode 100644 index 00000000..e359c852 --- /dev/null +++ b/assets/json/airhorn.json @@ -0,0 +1,16 @@ +[ + "clownfull.mp3", + "clownshort.mp3", + "clownspam.mp3", + "default.mp3", + "distant.mp3", + "echo.mp3", + "fourtap.mp3", + "highfartlong.mp3", + "highfartshort.mp3", + "midshort.mp3", + "reverb.mp3", + "spam.mp3", + "tripletap.mp3", + "truck.mp3" +] diff --git a/assets/sounds/airhorn/clownfull.mp3 b/assets/sounds/airhorn/clownfull.mp3 new file mode 100644 index 00000000..983d8a7f Binary files /dev/null and b/assets/sounds/airhorn/clownfull.mp3 differ diff --git a/assets/sounds/airhorn/clownshort.mp3 b/assets/sounds/airhorn/clownshort.mp3 new file mode 100644 index 00000000..019d97e0 Binary files /dev/null and b/assets/sounds/airhorn/clownshort.mp3 differ diff --git a/assets/sounds/airhorn/clownspam.mp3 b/assets/sounds/airhorn/clownspam.mp3 new file mode 100644 index 00000000..0f706dc0 Binary files /dev/null and b/assets/sounds/airhorn/clownspam.mp3 differ diff --git a/assets/sounds/airhorn/default.mp3 b/assets/sounds/airhorn/default.mp3 new file mode 100644 index 00000000..2bcba2d5 Binary files /dev/null and b/assets/sounds/airhorn/default.mp3 differ diff --git a/assets/sounds/airhorn/distant.mp3 b/assets/sounds/airhorn/distant.mp3 new file mode 100644 index 00000000..448acba8 Binary files /dev/null and b/assets/sounds/airhorn/distant.mp3 differ diff --git a/assets/sounds/airhorn/echo.mp3 b/assets/sounds/airhorn/echo.mp3 new file mode 100644 index 00000000..5b5133f7 Binary files /dev/null and b/assets/sounds/airhorn/echo.mp3 differ diff --git a/assets/sounds/airhorn/fourtap.mp3 b/assets/sounds/airhorn/fourtap.mp3 new file mode 100644 index 00000000..ef9e1c9d Binary files /dev/null and b/assets/sounds/airhorn/fourtap.mp3 differ diff --git a/assets/sounds/airhorn/highfartlong.mp3 b/assets/sounds/airhorn/highfartlong.mp3 new file mode 100644 index 00000000..f2d392d1 Binary files /dev/null and b/assets/sounds/airhorn/highfartlong.mp3 differ diff --git a/assets/sounds/airhorn/highfartshort.mp3 b/assets/sounds/airhorn/highfartshort.mp3 new file mode 100644 index 00000000..b038689c Binary files /dev/null and b/assets/sounds/airhorn/highfartshort.mp3 differ diff --git a/assets/sounds/airhorn/midshort.mp3 b/assets/sounds/airhorn/midshort.mp3 new file mode 100644 index 00000000..77b791f0 Binary files /dev/null and b/assets/sounds/airhorn/midshort.mp3 differ diff --git a/assets/sounds/airhorn/reverb.mp3 b/assets/sounds/airhorn/reverb.mp3 new file mode 100644 index 00000000..f9f34d40 Binary files /dev/null and b/assets/sounds/airhorn/reverb.mp3 differ diff --git a/assets/sounds/airhorn/spam.mp3 b/assets/sounds/airhorn/spam.mp3 new file mode 100644 index 00000000..e5a68d09 Binary files /dev/null and b/assets/sounds/airhorn/spam.mp3 differ diff --git a/assets/sounds/airhorn/tripletap.mp3 b/assets/sounds/airhorn/tripletap.mp3 new file mode 100644 index 00000000..ccc1ab8d Binary files /dev/null and b/assets/sounds/airhorn/tripletap.mp3 differ diff --git a/assets/sounds/airhorn/truck.mp3 b/assets/sounds/airhorn/truck.mp3 new file mode 100644 index 00000000..b27982ef Binary files /dev/null and b/assets/sounds/airhorn/truck.mp3 differ diff --git a/commands/other/airhorn.js b/commands/other/airhorn.js new file mode 100644 index 00000000..2112137f --- /dev/null +++ b/commands/other/airhorn.js @@ -0,0 +1,48 @@ +const Command = require('../../structures/Command'); +const path = require('path'); +const sounds = require('../../assets/json/airhorn'); + +module.exports = class AirhornCommand extends Command { + constructor(client) { + super(client, { + name: 'airhorn', + group: 'other', + memberName: 'airhorn', + description: 'Plays an airhorn sound in a voice channel.', + guildOnly: true, + throttling: { + usages: 1, + duration: 10 + }, + credit: [ + { + name: 'Discord', + url: 'https://discord.com/', + reason: 'Airhorn Sounds', + reasonURL: 'https://github.com/discord/airhornbot/tree/master/audio' + } + ] + }); + } + + async run(msg) { + const voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.say('Please enter a voice channel first.'); + if (!voiceChannel.permissionsFor(this.client.user).has(['CONNECT', 'SPEAK'])) { + return msg.say('Missing the "Connect" or "Speak" permission for the voice channel.'); + } + if (!voiceChannel.joinable) return msg.say('Your voice channel is not joinable.'); + if (this.client.voice.connections.has(voiceChannel.guild.id)) return msg.say('I am already playing a sound.'); + try { + const connection = await voiceChannel.join(); + const airhorn = sounds[Math.floor(Math.random() * sounds.length)]; + const dispatcher = connection.play(path.join(__dirname, '..', '..', 'assets', 'sounds', 'airhorn', airhorn)); + dispatcher.once('finish', () => voiceChannel.leave()); + dispatcher.once('error', () => voiceChannel.leave()); + return null; + } catch (err) { + voiceChannel.leave(); + throw err; + } + } +}; diff --git a/package.json b/package.json index 771d5b43..c6827a09 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "114.3.0", + "version": "114.4.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {