This repository has been archived on 2022-09-24. You can view files and clone it, but cannot push or open issues or pull requests.
Codsworth/commands/stop.js

20 lines
643 B
JavaScript

const { canModifyQueue, LOCALE } = require("../util/Util");
const i18n = require("i18n");
i18n.setLocale(LOCALE);
module.exports = {
name: "stop",
description: i18n.__('stop.description'),
execute(message) {
const queue = message.client.queue.get(message.guild.id);
if (!queue) return message.reply(i18n.__("stop.errorNotQueue")).catch(console.error);
if (!canModifyQueue(message.member)) return i18n.__("common.errorNotChannel");
queue.songs = [];
queue.connection.dispatcher.end();
queue.textChannel.send(i18n.__mf("stop.result", { author: message.author })).catch(console.error);
}
};