2020-04-23 15:15:48 +00:00
|
|
|
// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license.
|
|
|
|
|
|
|
|
exports.conf = {
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: true,
|
|
|
|
aliases: [],
|
2020-04-28 09:35:11 +00:00
|
|
|
permLevel: 'User ',
|
2020-04-23 15:15:48 +00:00
|
|
|
requiredPerms: ['CONNECT', 'SPEAK'],
|
|
|
|
cooldown: 10000
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.help = {
|
|
|
|
name: 'movehere',
|
|
|
|
category: 'Music',
|
2020-04-24 19:06:17 +00:00
|
|
|
description: 'Moves the bot into your voice channel and/or text channel.',
|
2020-04-23 15:15:48 +00:00
|
|
|
usage: 'movehere',
|
|
|
|
parameters: ''
|
|
|
|
}
|
|
|
|
|
|
|
|
const music = require('../utils/music')
|
|
|
|
exports.run = async (client, message, args, level, data) => {
|
|
|
|
// get guild music data
|
2020-04-28 09:35:11 +00:00
|
|
|
const guild = music.getGuild(message.guild.id)
|
2020-04-23 15:15:48 +00:00
|
|
|
|
2020-04-28 09:35:11 +00:00
|
|
|
if (!guild.playing) {
|
2020-04-23 15:15:48 +00:00
|
|
|
return message.channel.send('<:error:466995152976871434> Nothing is playing.')
|
|
|
|
}
|
|
|
|
|
|
|
|
let textChannelChanged = false
|
2020-04-28 09:35:11 +00:00
|
|
|
let voiceChannelChanged = false
|
2020-04-23 15:15:48 +00:00
|
|
|
|
2020-04-28 09:35:11 +00:00
|
|
|
// change text channel
|
|
|
|
if (guild.channel.id !== message.channel.id) {
|
|
|
|
guild.channel = message.channel
|
2020-04-23 15:15:48 +00:00
|
|
|
|
|
|
|
textChannelChanged = true
|
|
|
|
}
|
|
|
|
|
|
|
|
// move to another voice channel
|
2020-04-28 09:35:11 +00:00
|
|
|
if (message.member.voice.channel && guild.voiceChannel && (message.member.voice.channel !== guild.voiceChannel.id)) {
|
|
|
|
guild.voiceChannel.leave()
|
|
|
|
guild.voiceChannel = message.member.voice.channel
|
|
|
|
guild.voiceChannel.join()
|
|
|
|
voiceChannelChanged = true
|
2020-04-23 15:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// response
|
2020-04-28 09:35:11 +00:00
|
|
|
if (textChannelChanged && voiceChannelChanged) {
|
2020-04-23 15:15:48 +00:00
|
|
|
return message.channel.send('<:success:466995111885144095> Music playback moved to your voice channel and music messages to your text channel.')
|
2020-04-24 19:06:17 +00:00
|
|
|
} else if (textChannelChanged) {
|
2020-04-23 15:15:48 +00:00
|
|
|
return message.channel.send('<:success:466995111885144095> Music module will send messages to your text channel.')
|
2020-04-28 09:35:11 +00:00
|
|
|
} else if (voiceChannelChanged) {
|
2020-04-23 15:15:48 +00:00
|
|
|
return message.channel.send('<:success:466995111885144095> Music playback moved to your voice channel.')
|
|
|
|
} else {
|
|
|
|
return message.channel.send('<:error:466995152976871434> Music is already playing in your voice channel!')
|
|
|
|
}
|
|
|
|
}
|