mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 18:29:14 +02:00
Airhorn, Voice Group, Cow sound
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -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,
|
||||
@@ -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(', ')}`,
|
||||
Reference in New Issue
Block a user