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

@ -2,11 +2,11 @@ module.exports = function (client, msg, command) {
let message = {};
const radio = client.radio.get(msg.guild.id);
const permissions = msg.channel.permissionsFor(msg.author);
if (!radio || !radio.playing){
if (!radio) {
msg.channel.send(client.messageEmojis["x"] + client.messages.notPlaying);
return false;
}
if (msg.member.voice.channel !== radio.voiceChannel){
if (msg.member.voice.channel !== radio.voiceChannel) {
msg.channel.send(client.messageEmojis["x"] + client.messages.wrongVoiceChannel);
return false;
}

View File

@ -14,7 +14,6 @@ module.exports = class extends Client {
this.commandAliases = new Collection();
this.radio = new Map();
this.funcs = {};
this.dispatcher = {};
this.config = require('../config.js');
this.messages = require('./messages.js');
this.funcs.check = require('./check.js');

View File

@ -1,26 +1,26 @@
module.exports = {
name: 'emojis',
async execute(client, Discord) {
async execute(client) {
let customEmojis = {
list: "<:RadioXList:688541155519889482>",
play: "<:RadioXPlay:688541155712827458>",
stop: "<:RadioXStop:688541155377414168>",
x: "<:RadioXX:688541155792781320>"
};
let fallbackEmojis = {
list: "📜",
play: "▶️",
stop: "⏹️",
x: "❌"
};
client.messageEmojis = {};
for(customEmojiName in customEmojis){
for (customEmojiName in customEmojis) {
customEmojiID = customEmojis[customEmojiName].replace(/[^0-9]+/g, '');
customEmoji = client.emojis.cache.get(customEmojiID);
if(customEmoji){
if (customEmoji) {
client.messageEmojis[customEmojiName] = customEmojis[customEmojiName];
} else {
client.messageEmojis[customEmojiName] = fallbackEmojis[customEmojiName];