mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-22 22:43:17 +00:00
Moved funcs
This commit is contained in:
parent
889646a6d0
commit
5667e2f0a9
@ -15,21 +15,3 @@ module.exports = {
|
||||
return msg.channel.send(embed);
|
||||
}
|
||||
};
|
||||
|
||||
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}`;
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ module.exports = {
|
||||
|
||||
message.nowplayingDescription = client.messages.nowplayingDescription.replace("%radio.station.name%", radio.station.name);
|
||||
message.nowplayingDescription = message.nowplayingDescription.replace("%radio.station.owner%", radio.station.owner);
|
||||
message.nowplayingDescription = message.nowplayingDescription.replace("%msToTime(completed, \"hh:mm:ss\")%", msToTime(completed, "hh:mm:ss"));
|
||||
message.nowplayingDescription = message.nowplayingDescription.replace("%client.funcs.msToTime(completed, \"hh:mm:ss\")%", client.funcs.msToTime(completed, "hh:mm:ss"));
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.nowplayingTitle)
|
||||
@ -24,20 +24,3 @@ module.exports = {
|
||||
return msg.channel.send(embed);
|
||||
}
|
||||
};
|
||||
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}`;
|
||||
}
|
||||
}
|
@ -18,11 +18,11 @@ module.exports = {
|
||||
if(currentGuild.statistics[stations[station].name]){
|
||||
if(i > 0){
|
||||
statistics += "**" + station + " " + stations[station].name + "** \n";
|
||||
statistics += "Time: " + msToTime(currentGuild.statistics[stations[station].name].time, "hh:mm:ss") + "\n";
|
||||
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time, "hh:mm:ss") + "\n";
|
||||
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
||||
} else {
|
||||
statistics = "**" + station + " " + stations[station].name + "** \n";
|
||||
statistics += "Time: " + msToTime(currentGuild.statistics[stations[station].name].time, "hh:mm:ss") + "\n";
|
||||
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time, "hh:mm:ss") + "\n";
|
||||
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
||||
}
|
||||
i++;
|
||||
@ -39,21 +39,3 @@ module.exports = {
|
||||
return msg.channel.send(embed);
|
||||
}
|
||||
};
|
||||
|
||||
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}`;
|
||||
}
|
||||
}
|
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}`;
|
||||
}
|
||||
}
|
@ -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) {
|
||||
|
@ -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.",
|
||||
|
Loading…
Reference in New Issue
Block a user