Airhorn Command

This commit is contained in:
Dragon Fire
2020-05-04 23:01:54 -04:00
parent bd83ef0b6e
commit e9e031fb92
18 changed files with 69 additions and 2 deletions
+4 -1
View File
@@ -132,7 +132,7 @@ in the appropriate channel's topic to use it.
## Commands ## Commands
Total: 410 Total: 411
### Utility: ### Utility:
@@ -567,6 +567,7 @@ Total: 410
### Other: ### Other:
* **airhorn:** Plays an airhorn sound in a voice channel.
* **cleverbot:** Talk to Cleverbot. (Owner-Only) * **cleverbot:** Talk to Cleverbot. (Owner-Only)
* **phone-book:** Looks up phone-enabled servers. * **phone-book:** Looks up phone-enabled servers.
* **phone:** Starts a phone call with a random server. * **phone:** Starts a phone call with a random server.
@@ -733,6 +734,8 @@ here.
* owo (Code) * owo (Code)
- [Digital Equipment Corporation](http://gordonbell.azurewebsites.net/digital/timeline/tmlnhome.htm) - [Digital Equipment Corporation](http://gordonbell.azurewebsites.net/digital/timeline/tmlnhome.htm)
* dec-talk (Original DECTalk Software) * 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/) - [Discord Status Button](https://discord.c99.nl/)
* status-button (API) * status-button (API)
- [Disney](https://www.disney.com/) - [Disney](https://www.disney.com/)
+16
View File
@@ -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"
]
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.
Binary file not shown.
Binary file not shown.
+48
View File
@@ -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;
}
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiao", "name": "xiao",
"version": "114.3.0", "version": "114.4.0",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Xiao.js", "main": "Xiao.js",
"scripts": { "scripts": {