Moved funcs

This commit is contained in:
Christer Warén
2020-04-02 08:13:51 +03:00
parent 889646a6d0
commit 5667e2f0a9
7 changed files with 28 additions and 61 deletions

View File

@ -1,20 +0,0 @@
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) {
msg.channel.send(client.messageEmojis["error"] + client.messages.notPlaying);
return false;
}
if (msg.member.voice.channel !== radio.voiceChannel) {
msg.channel.send(client.messageEmojis["error"] + client.messages.wrongVoiceChannel);
return false;
}
if(!command.permission == 'none'){
if (!permissions.has(command.permission)) {
message.noPerms = client.messages.noPerms.replace("%command.permission%", command.permission);
msg.channel.send(client.messageEmojis["error"] + message.noPerms);
return false;
} else return true;
} else return true;
};

View File

@ -14,10 +14,13 @@ module.exports = class extends Client {
this.commands = new Collection();
this.commandAliases = new Collection();
this.radio = new Map();
this.funcs = {};
this.funcs.check = require('../funcs/check.js');
this.funcs.msToTime = require('../funcs/msToTime.js');
this.config = require('../config.js');
this.messages = require('./messages.js');
this.funcs.check = require('./check.js');
const commandFiles = fs.readdirSync(path.join(path.dirname(__dirname), 'commands')).filter(f => f.endsWith('.js'));
for (const file of commandFiles) {

View File

@ -13,7 +13,7 @@ module.exports = {
inviteTitle: "Invite %client.user.username% to your Discord server!",
listTitle: "Radio Stations",
nowplayingTitle: "Now Playing",
nowplayingDescription: "**%radio.station.name%** \n Owner: %radio.station.owner% \n %msToTime(completed, \"hh:mm:ss\")%",
nowplayingDescription: "**%radio.station.name%** \n Owner: %radio.station.owner% \n %client.funcs.msToTime(completed, \"hh:mm:ss\")%",
noVoiceChannel: "You need to be in a voice channel to play radio!",
noQuery: "You need to use a number or search for a supported station!",
noPermsConnect: "I cannot connect to your voice channel.",