mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 05:49:49 +02:00
Remove Voice-based Commands
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class DECTalkCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'dec-talk',
|
||||
aliases: ['text-to-speech', 'tts'],
|
||||
group: 'voice',
|
||||
memberName: 'dec-talk',
|
||||
description: 'The world\'s best Text-to-Speech.',
|
||||
guildOnly: true,
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
userPermissions: ['CONNECT', 'SPEAK'],
|
||||
clientPermissions: ['ADD_REACTIONS', 'READ_MESSAGE_HISTORY'],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text do you want to say?',
|
||||
type: 'string',
|
||||
max: 1024
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { text }) {
|
||||
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.voiceConnections.has(voiceChannel.guild.id)) return msg.say('I am already playing a sound.');
|
||||
try {
|
||||
const connection = await voiceChannel.join();
|
||||
const { url } = await request
|
||||
.get('http://tts.cyzon.us/tts')
|
||||
.query({ text });
|
||||
const dispatcher = connection.play(url);
|
||||
await msg.react('🔉');
|
||||
dispatcher.once('finish', () => voiceChannel.leave());
|
||||
dispatcher.once('error', () => voiceChannel.leave());
|
||||
return null;
|
||||
} catch (err) {
|
||||
voiceChannel.leave();
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,22 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class LeaveVoiceChannelCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'leave-voice-channel',
|
||||
aliases: ['leave-vc'],
|
||||
group: 'voice',
|
||||
memberName: 'leave',
|
||||
description: 'Leaves a voice channel, in case the bot gets stuck.',
|
||||
guildOnly: true,
|
||||
userPermissions: ['MOVE_MEMBERS']
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
if (!this.client.voiceConnections.has(msg.guild.id)) return msg.reply('I am not in a voice channel...');
|
||||
const { channel } = this.client.voiceConnections.get(msg.guild.id);
|
||||
channel.leave();
|
||||
return msg.say(`Left **${channel.name}**.`);
|
||||
}
|
||||
};
|
||||
@@ -1,54 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { list } = require('../../util/Util');
|
||||
const path = require('path');
|
||||
const sounds = require('../../assets/json/soundboard');
|
||||
|
||||
module.exports = class SoundboardCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'soundboard',
|
||||
aliases: ['sound'],
|
||||
group: 'voice',
|
||||
memberName: 'soundboard',
|
||||
description: 'Plays a sound in your voice channel.',
|
||||
details: `**Sounds:** ${Object.keys(sounds).join(', ')}`,
|
||||
guildOnly: true,
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
userPermissions: ['CONNECT', 'SPEAK'],
|
||||
clientPermissions: ['ADD_REACTIONS', 'READ_MESSAGE_HISTORY'],
|
||||
args: [
|
||||
{
|
||||
key: 'sound',
|
||||
prompt: `What sound would you like to play? Either ${list(Object.keys(sounds), 'or')}.`,
|
||||
type: 'string',
|
||||
oneOf: Object.keys(sounds),
|
||||
parse: sound => sound.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { sound }) {
|
||||
const voiceChannel = msg.member.voice.channel;
|
||||
if (!voiceChannel) return msg.reply('Please enter a voice channel first.');
|
||||
if (!voiceChannel.permissionsFor(this.client.user).has(['CONNECT', 'SPEAK'])) {
|
||||
return msg.reply('Missing the "Connect" or "Speak" permission for the voice channel.');
|
||||
}
|
||||
if (!voiceChannel.joinable) return msg.reply('Your voice channel is not joinable.');
|
||||
if (this.client.voiceConnections.has(voiceChannel.guild.id)) return msg.reply('I am already playing a sound.');
|
||||
try {
|
||||
const connection = await voiceChannel.join();
|
||||
const dispatcher = connection.play(path.join(__dirname, '..', '..', 'assets', 'sounds', sounds[sound]));
|
||||
await msg.react('🔉');
|
||||
dispatcher.once('finish', () => voiceChannel.leave());
|
||||
dispatcher.once('error', () => voiceChannel.leave());
|
||||
return null;
|
||||
} catch (err) {
|
||||
voiceChannel.leave();
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user