forked from embee/woomy
begin polishing up music modules
This commit is contained in:
parent
caeeafa3bb
commit
a31dc02568
2 changed files with 13 additions and 42 deletions
|
@ -6,13 +6,13 @@ exports.conf = {
|
||||||
aliases: [],
|
aliases: [],
|
||||||
permLevel: 'User',
|
permLevel: 'User',
|
||||||
requiredPerms: ['CONNECT', 'SPEAK'],
|
requiredPerms: ['CONNECT', 'SPEAK'],
|
||||||
cooldown: 10000
|
cooldown: 2000
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.help = {
|
exports.help = {
|
||||||
name: 'movehere',
|
name: 'movehere',
|
||||||
category: 'Music',
|
category: 'Music',
|
||||||
description: 'Moves the bot into your voice channel and/or text channel.',
|
description: 'Moves music related messages to the channel the this command is ran in.',
|
||||||
usage: 'movehere',
|
usage: 'movehere',
|
||||||
parameters: ''
|
parameters: ''
|
||||||
}
|
}
|
||||||
|
@ -26,32 +26,11 @@ exports.run = async (client, message, args, level, data) => {
|
||||||
return message.channel.send('<:error:466995152976871434> Nothing is playing.')
|
return message.channel.send('<:error:466995152976871434> Nothing is playing.')
|
||||||
}
|
}
|
||||||
|
|
||||||
let textChannelChanged = false
|
if (guild.channel.id === message.channel.id) {
|
||||||
let voiceChannelChanged = false
|
return message.channel.send('<:error:466995152976871434> Music messages are already being sent to this channel.')
|
||||||
|
}
|
||||||
|
|
||||||
// change text channel
|
|
||||||
if (guild.channel.id !== message.channel.id) {
|
|
||||||
guild.channel = message.channel
|
guild.channel = message.channel
|
||||||
|
|
||||||
textChannelChanged = true
|
message.channel.send('<:success:466995111885144095> Music messages will now be sent to this channel.')
|
||||||
}
|
|
||||||
|
|
||||||
// move to another voice channel
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
// response
|
|
||||||
if (textChannelChanged && voiceChannelChanged) {
|
|
||||||
return message.channel.send('<:success:466995111885144095> Music playback moved to your voice channel and music messages to your text channel.')
|
|
||||||
} else if (textChannelChanged) {
|
|
||||||
return message.channel.send('<:success:466995111885144095> Music module will send messages to your text channel.')
|
|
||||||
} else if (voiceChannelChanged) {
|
|
||||||
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!')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,27 +37,19 @@ module.exports.run = (client, message, args, level) => {
|
||||||
const newPosition = +args[1]
|
const newPosition = +args[1]
|
||||||
|
|
||||||
if (isNaN(oldPosition) === true) {
|
if (isNaN(oldPosition) === true) {
|
||||||
return message.channel.send('That isn\'t a number! You need to tell me the songs position in the queue (1, 2, etc.)')
|
return message.channel.send('<:error:466995152976871434> That isn\'t a number! You need to tell me the songs position in the queue (1, 2, etc.)')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNaN(newPosition) === true) {
|
if (isNaN(newPosition) === true) {
|
||||||
return message.channel.send('That isn\'t a number! You need to tell me the songs position in the queue (1, 2, etc.)')
|
return message.channel.send('<:error:466995152976871434> That isn\'t a number! You need to tell me the songs position in the queue (1, 2, etc.)')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldPosition < 1) {
|
if (oldPosition < 1 || oldPosition >= queue.length) {
|
||||||
return message.channel.send('This number is too low!')
|
return message.channel.send('<:error:466995152976871434> Invalid song ID.')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newPosition < 1) {
|
if (newPosition < 1 || newPosition >= queue.length) {
|
||||||
return message.channel.send('This number is too low!')
|
return message.channel.send('<:error:466995152976871434> Invalid song ID.')
|
||||||
}
|
|
||||||
|
|
||||||
if (oldPosition >= queue.length) {
|
|
||||||
return message.channel.send('This number is too high!')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newPosition >= queue.length) {
|
|
||||||
return message.channel.send('This number is too high!')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const songName = queue[oldPosition].video.title
|
const songName = queue[oldPosition].video.title
|
||||||
|
|
Loading…
Reference in a new issue