diff --git a/Xiao.js b/Xiao.js index 9390721b..d724b38d 100644 --- a/Xiao.js +++ b/Xiao.js @@ -24,6 +24,7 @@ client.registry ['events', 'Events'], ['search', 'Search'], ['games', 'Games'], + ['voice', 'Voice Channel'], ['image-edit', 'Image Manipulation'], ['avatar-edit', 'Avatar Manipulation'], ['text-edit', 'Text Manipulation'], 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/json/soundboard.json b/assets/json/soundboard.json index 22ede927..bce62bdf 100644 --- a/assets/json/soundboard.json +++ b/assets/json/soundboard.json @@ -1,9 +1,9 @@ { - "airhorn": "airhorn.mp3", "alarm": "alarm.mp3", "ayaya": "ayaya.mp3", "car crash": "car-crash.mp3", "cat": "cat.mp3", + "cow": "cow.mp3", "doh": "doh.mp3", "dun-dun-dun": "dun-dun-dun.mp3", "eat my shorts": "eat-my-shorts.mp3", diff --git a/assets/sounds/airhorn.mp3 b/assets/sounds/airhorn.mp3 deleted file mode 100644 index 88fd671d..00000000 Binary files a/assets/sounds/airhorn.mp3 and /dev/null differ 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/assets/sounds/cow.mp3 b/assets/sounds/cow.mp3 new file mode 100644 index 00000000..cc47634a Binary files /dev/null and b/assets/sounds/cow.mp3 differ diff --git a/commands/voice/airhorn.js b/commands/voice/airhorn.js new file mode 100644 index 00000000..ef449110 --- /dev/null +++ b/commands/voice/airhorn.js @@ -0,0 +1,40 @@ +const { Command } = require('discord.js-commando'); +const path = require('path'); +const sounds = require('../../assets/json/airhorn'); + +module.exports = class AirhornCommand extends Command { + constructor(client) { + super(client, { + name: 'airhorn', + group: 'voice', + memberName: 'airhorn', + description: 'Plays an airhorn sound in your voice channel.', + guildOnly: true, + throttling: { + usages: 1, + duration: 10 + } + }); + } + + async run(msg) { + const channel = msg.member.voiceChannel; + if (!channel) return msg.reply('Please enter a voice channel first.'); + if (!channel.permissionsFor(this.client.user).has(['CONNECT', 'SPEAK'])) { + return msg.reply('Missing the "Connect" or "Speak" permission for the voice channel.'); + } + if (!channel.joinable) return msg.reply('Your voice channel is not joinable.'); + if (this.client.voiceConnections.has(channel.guild.id)) return msg.reply('I am already playing a sound.'); + try { + const connection = await channel.join(); + const airhorn = sounds[Math.floor(Math.random() * sounds.length)]; + const dispatcher = connection.play(path.join(__dirname, '..', '..', 'assets', 'sounds', 'airhorn', airhorn)); + dispatcher.once('finish', () => channel.leave()); + dispatcher.once('error', () => channel.leave()); + return null; + } catch (err) { + channel.leave(); + throw err; + } + } +}; diff --git a/commands/text-edit/dec-talk.js b/commands/voice/dec-talk.js similarity index 98% rename from commands/text-edit/dec-talk.js rename to commands/voice/dec-talk.js index 18ed7e67..b7af38c0 100644 --- a/commands/text-edit/dec-talk.js +++ b/commands/voice/dec-talk.js @@ -6,7 +6,7 @@ module.exports = class DECTalkCommand extends Command { super(client, { name: 'dec-talk', aliases: ['moon-base-alpha', 'text-to-speech', 'tts'], - group: 'text-edit', + group: 'voice', memberName: 'dec-talk', description: 'The world\'s best Text-to-Speech.', guildOnly: true, diff --git a/commands/other/soundboard.js b/commands/voice/soundboard.js similarity index 97% rename from commands/other/soundboard.js rename to commands/voice/soundboard.js index 4e14d314..c8025b20 100644 --- a/commands/other/soundboard.js +++ b/commands/voice/soundboard.js @@ -7,8 +7,8 @@ module.exports = class SoundboardCommand extends Command { constructor(client) { super(client, { name: 'soundboard', - aliases: ['sound', 'foley'], - group: 'other', + aliases: ['sound'], + group: 'voice', memberName: 'soundboard', description: 'Plays a sound in your voice channel.', details: `**Sounds**: ${Object.keys(sounds).join(', ')}`, diff --git a/package.json b/package.json index e2b4b3fa..84b0cb14 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "66.4.4", + "version": "66.5.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {