28 lines
1.1 KiB
JavaScript
Executable File
28 lines
1.1 KiB
JavaScript
Executable File
const { SlashCommandBuilder } = require('discord.js')
|
|
const { getVoiceConnection, joinVoiceChannel } = require('@discordjs/voice')
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName('papa')
|
|
.setDescription('Si papa m\'appelle, je le rejoins !'),
|
|
async execute(interaction) {
|
|
if (interaction.user.id !== '223831938346123275') return interaction.reply({ content: 'T\'es pas mon père, dégage !' })
|
|
|
|
let botChannel = interaction.guild.members.me.voice.channel
|
|
let papaChannel = interaction.member.voice.channel
|
|
|
|
if (!papaChannel && botChannel) {
|
|
getVoiceConnection(botChannel.guild.id).destroy()
|
|
return interaction.reply({ content: 'Je quitte le vocal, papa !' })
|
|
}
|
|
else if (!botChannel || botChannel.id !== papaChannel.id) {
|
|
joinVoiceChannel({
|
|
channelId: papaChannel.id,
|
|
guildId: papaChannel.guild.id,
|
|
adapterCreator: papaChannel.guild.voiceAdapterCreator,
|
|
})
|
|
return interaction.reply({ content: 'Je rejoins ton vocal, papa !' })
|
|
}
|
|
else return interaction.reply({ content: 'Je suis déjà dans ton vocal, papa !' })
|
|
}
|
|
} |