woomy/commands/stop.js

36 lines
943 B
JavaScript
Raw Normal View History

2020-04-21 09:14:49 +00:00
// 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: 'stop',
category: 'Music',
description: 'Stops music, clears the queue and disconnects from the voice channel.',
usage: 'stop',
params: ''
}
const { getGuild } = require('../utils/music')
exports.run = async (client, message) => {
const guild = getGuild(message.guild.id)
if (guild.queue.length < 1 || !guild.playing || !guild.dispatcher) return message.channel.send('Nothing is playing.')
if (!message.member.voice.channel) return message.channel.send('You need to be in voice channel to use this command!')
2020-04-22 09:00:57 +00:00
guild.dispatcher.end('silent')
guild.queue = []
2020-04-21 09:14:49 +00:00
guild.playing = false
guild.paused = false
2020-04-22 09:00:57 +00:00
guild.skippers = []
2020-04-21 09:14:49 +00:00
message.channel.send('Playback stopped!')
}