mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 18:29:14 +02:00
Join/Leave Voice Commands
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class JoinCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'join',
|
||||
aliases: ['join-voice-channel', 'join-vc', 'join-voice', 'join-channel'],
|
||||
group: 'voice',
|
||||
memberName: 'join',
|
||||
description: 'Joins your voice channel.',
|
||||
guarded: true,
|
||||
userPermissions: ['CONNECT']
|
||||
});
|
||||
}
|
||||
|
||||
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', 'VIEW_CHANNEL'])) {
|
||||
return msg.say('I am missing the "Connect", "Speak", or "View Channel" permission for this 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 in a voice channel.');
|
||||
await voiceChannel.join();
|
||||
return msg.reply(`Joined **${voiceChannel.name}**!`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user