mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2025-07-01 17:43:38 +00:00
Moved funcs
This commit is contained in:
20
funcs/check.js
Normal file
20
funcs/check.js
Normal file
@ -0,0 +1,20 @@
|
||||
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;
|
||||
};
|
17
funcs/msToTime.js
Normal file
17
funcs/msToTime.js
Normal file
@ -0,0 +1,17 @@
|
||||
module.exports = function msToTime(duration, format) {
|
||||
var seconds = Math.floor((duration / 1000) % 60),
|
||||
minutes = Math.floor((duration / (1000 * 60)) % 60),
|
||||
hours = Math.floor((duration / (1000 * 60 * 60)) % 24);
|
||||
days = Math.floor((duration / (1000 * 60 * 60 * 24)) % 24);
|
||||
|
||||
days = (days < 10) ? "0" + days : days;
|
||||
hours = (hours < 10) ? "0" + hours : hours;
|
||||
minutes = (minutes < 10) ? "0" + minutes : minutes;
|
||||
seconds = (seconds < 10) ? "0" + seconds : seconds;
|
||||
|
||||
if (format === "hh:mm:ss") {
|
||||
return `${hours}:${minutes}:${seconds}`;
|
||||
} else if (format === "dd:hh:mm:ss") {
|
||||
return `${days}:${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user