removed some unnecessary variables and general clean up

This commit is contained in:
MatteZ02
2020-03-22 17:10:46 +02:00
committed by Christer Warén
parent 093549770d
commit 011e221748
15 changed files with 42 additions and 59 deletions

View File

@ -7,13 +7,13 @@ module.exports = {
if (!msg.content.startsWith(prefix)) return;
if (!args[0]) return;
const commandName = args[0].toLowerCase();
if (commandName === 'none') return;
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName);
if (!command && msg.content !== `${prefix}`) return;
const permissions = msg.channel.permissionsFor(msg.client.user);
if (!permissions.has('EMBED_LINKS')) return msg.channel.send(client.messages.noPermsEmbed);
try {
command.uses++;
command.execute(msg, args, client, Discord, prefix, command);
command.execute(msg, args, client, Discord, command);
} catch (error) {
msg.reply(client.messages.runningCommandFailed);
console.error(error);

View File

@ -31,7 +31,7 @@ module.exports = {
client.stations = await fetch('https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json')
.then(res => res.json());
}, 3600000);
require(`../struct/emojis.js`).execute(client, Discord);
require(`../struct/emojis.js`).execute(client);
}
}

View File

@ -7,8 +7,6 @@ module.exports = {
if (!radio) return;
if (newState.member.id === client.user.id && oldState.member.id === client.user.id) {
if (newState.channel === null) {
radio.songs = [];
radio.looping = false;
return client.radio.delete(newState.guild.id);
}
@ -18,8 +16,6 @@ module.exports = {
const connection = await oldState.channel.join();
return radio.connection = connection;
} catch (error) {
radio.songs = [];
radio.looping = false;
radio.connection.dispatcher.destroy();
radio.voiceChannel.leave();
client.radio.delete(msg.guild.id);
@ -36,8 +32,6 @@ module.exports = {
setTimeout(() => {
if (!radio) return;
if (radio.voiceChannel.members.size === 1) {
radio.songs = [];
radio.looping = false;
radio.connection.dispatcher.destroy();
radio.voiceChannel.leave();
client.radio.delete(newState.guild.id);