woomy/commands/pause.js
2020-04-29 21:21:34 +10:00

37 lines
1,011 B
JavaScript

// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license.
exports.conf = {
enabled: true,
guildOnly: true,
aliases: [],
permLevel: 'User',
requiredPerms: [],
cooldown: 2000
}
exports.help = {
name: 'pause',
category: 'Music',
description: 'Pauses the music that is currently playing.',
usage: 'pause',
parameters: ''
}
const { getGuild } = require('../utils/music')
exports.run = async (client, message, args, level, data) => {
const guild = getGuild(message.guild.id)
if (guild.paused === true) {
return message.channel.send('<:error:466995152976871434> The music has already been paused! Run resume to start the music again.')
}
if (guild.queue.length < 1 || guild.playing === false) {
return message.channel.send('<:error:466995152976871434> Nothing is playing!')
}
guild.playing = false
guild.paused = true
guild.dispatcher.pause()
message.channel.send('<:pause:467639357961142273> Music playback has been paused.')
}