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: [],
|
|
|
|
permLevel: 'Moderator',
|
|
|
|
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-24 19:06:17 +00:00
|
|
|
const mGuild = music.getGuild(message.guild.id)
|
2020-04-23 15:15:48 +00:00
|
|
|
|
2020-04-24 19:06:17 +00:00
|
|
|
if (!mGuild.playing) {
|
2020-04-23 15:15:48 +00:00
|
|
|
return message.channel.send('<:error:466995152976871434> Nothing is playing.')
|
|
|
|
}
|
|
|
|
|
|
|
|
// change text channel
|
|
|
|
let textChannelChanged = false
|
|
|
|
|
2020-04-24 19:06:17 +00:00
|
|
|
if (mGuild.channel.id !== message.channel.id) {
|
2020-04-23 15:15:48 +00:00
|
|
|
mGuild.channel = message.channel
|
|
|
|
|
|
|
|
textChannelChanged = true
|
|
|
|
}
|
|
|
|
|
|
|
|
// move to another voice channel
|
|
|
|
let voiceChannelMoved = false
|
|
|
|
|
2020-04-24 19:06:17 +00:00
|
|
|
if (message.voice.channel && mGuild.voiceChannel && (message.voice.channel !== mGuild.voiceChannel.id)) {
|
2020-04-23 15:15:48 +00:00
|
|
|
// TODO: this
|
|
|
|
|
|
|
|
voiceChannelMoved = true
|
|
|
|
}
|
|
|
|
|
|
|
|
// response
|
2020-04-24 19:06:17 +00:00
|
|
|
if (textChannelChanged && voiceChannelMoved) {
|
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-24 19:06:17 +00:00
|
|
|
} else if (voiceChannelMoved) {
|
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!')
|
|
|
|
}
|
|
|
|
}
|