mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-22 22:13:16 +00:00
Moved funcs
This commit is contained in:
parent
889646a6d0
commit
5667e2f0a9
@ -14,22 +14,4 @@ module.exports = {
|
|||||||
.setFooter('EximiaBots by Warén Media', "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
.setFooter('EximiaBots by Warén Media', "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
return msg.channel.send(embed);
|
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 = 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("%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()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setTitle(client.messages.nowplayingTitle)
|
.setTitle(client.messages.nowplayingTitle)
|
||||||
@ -23,21 +23,4 @@ module.exports = {
|
|||||||
.setFooter('EximiaBots by Warén Media', "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
.setFooter('EximiaBots by Warén Media', "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
return msg.channel.send(embed);
|
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(currentGuild.statistics[stations[station].name]){
|
||||||
if(i > 0){
|
if(i > 0){
|
||||||
statistics += "**" + station + " " + stations[station].name + "** \n";
|
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";
|
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
||||||
} else {
|
} else {
|
||||||
statistics = "**" + station + " " + stations[station].name + "** \n";
|
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";
|
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
@ -38,22 +38,4 @@ module.exports = {
|
|||||||
.setFooter('EximiaBots by Warén Media', "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
.setFooter('EximiaBots by Warén Media', "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
return msg.channel.send(embed);
|
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.commands = new Collection();
|
||||||
this.commandAliases = new Collection();
|
this.commandAliases = new Collection();
|
||||||
this.radio = new Map();
|
this.radio = new Map();
|
||||||
|
|
||||||
this.funcs = {};
|
this.funcs = {};
|
||||||
|
this.funcs.check = require('../funcs/check.js');
|
||||||
|
this.funcs.msToTime = require('../funcs/msToTime.js');
|
||||||
|
|
||||||
this.config = require('../config.js');
|
this.config = require('../config.js');
|
||||||
this.messages = require('./messages.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'));
|
const commandFiles = fs.readdirSync(path.join(path.dirname(__dirname), 'commands')).filter(f => f.endsWith('.js'));
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
|
@ -13,7 +13,7 @@ module.exports = {
|
|||||||
inviteTitle: "Invite %client.user.username% to your Discord server!",
|
inviteTitle: "Invite %client.user.username% to your Discord server!",
|
||||||
listTitle: "Radio Stations",
|
listTitle: "Radio Stations",
|
||||||
nowplayingTitle: "Now Playing",
|
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!",
|
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!",
|
noQuery: "You need to use a number or search for a supported station!",
|
||||||
noPermsConnect: "I cannot connect to your voice channel.",
|
noPermsConnect: "I cannot connect to your voice channel.",
|
||||||
|
Loading…
Reference in New Issue
Block a user