mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2025-07-01 07:43:38 +00:00
Formatting changes
This commit is contained in:
@ -4,4 +4,4 @@ module.exports = function (response) {
|
||||
} else {
|
||||
throw new Error(response.status + " " + response.statusText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,4 +7,4 @@ module.exports = function (devList, authorID){
|
||||
}
|
||||
});
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
@ -30,4 +30,4 @@ module.exports = function (client, interaction){
|
||||
components: [menu],
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -7,4 +7,4 @@ module.exports = function loadState(client, guild){
|
||||
data.state = {};
|
||||
client.datastore.updateEntry(guild, data);
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
@ -2,4 +2,4 @@ module.exports = function (area, text){
|
||||
let date = new Date();
|
||||
console.log('[' + area + '] – ' + date.toISOString());
|
||||
if(text) console.log(text + '\n');
|
||||
}
|
||||
}
|
||||
|
@ -9,4 +9,4 @@ module.exports = function msToTime(duration) {
|
||||
: +hours > 0
|
||||
? `${+hours < 10 ? `0${hours}` : hours}:${+minutes < 10 ? `0${minutes}` : minutes}:${+seconds < 10 ? `0${seconds}` : seconds}`
|
||||
: `${+minutes < 10 ? `0${minutes}` : minutes}:${+seconds < 10 ? `0${seconds}` : seconds}`;
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ module.exports = async function play(interaction, guild, client, url) {
|
||||
.addField(client.messages.nowplayingTitle, message.nowplayingDescription, true)
|
||||
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
|
||||
|
||||
const buttons = new Discord.MessageActionRow()
|
||||
.addComponents(
|
||||
new Discord.MessageButton()
|
||||
@ -87,10 +87,10 @@ module.exports = async function play(interaction, guild, client, url) {
|
||||
}
|
||||
|
||||
message.play = client.messages.play.replace("%radio.station.name%", radio.station.name);
|
||||
|
||||
|
||||
interaction?.reply({
|
||||
content: client.messageEmojis["play"] + message.play,
|
||||
ephemeral: true
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ module.exports = async function restoreRadios(client, guilds) {
|
||||
construct.connection = connection;
|
||||
let date = new Date();
|
||||
construct.startTime = date.getTime();
|
||||
|
||||
|
||||
client.funcs.play(null, guild, client, url, Discord);
|
||||
|
||||
client.datastore.checkEntry(guild.id);
|
||||
@ -59,4 +59,4 @@ module.exports = async function restoreRadios(client, guilds) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
module.exports = function saveRadios(client) {
|
||||
let currentRadios = client.radio.keys();
|
||||
let radio = currentRadios.next();
|
||||
|
||||
|
||||
while (!radio.done) {
|
||||
let currentRadio = client.radio.get(radio.value);
|
||||
currentRadio.guild = client.datastore.getEntry(radio.value).guild;
|
||||
|
||||
|
||||
if (currentRadio) {
|
||||
client.funcs.statisticsUpdate(client, currentRadio.guild, currentRadio);
|
||||
client.funcs.saveState(client, currentRadio.guild, currentRadio);
|
||||
@ -14,7 +14,7 @@ module.exports = function saveRadios(client) {
|
||||
currentRadio.message?.delete();
|
||||
client.radio.delete(radio.value);
|
||||
}
|
||||
|
||||
|
||||
radio = currentRadios.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
module.exports = function saveState(client, guild, radio){
|
||||
client.datastore.checkEntry(guild.id);
|
||||
|
||||
|
||||
let date = new Date();
|
||||
|
||||
let data = client.datastore.getEntry(guild.id);
|
||||
@ -15,4 +15,4 @@ module.exports = function saveState(client, guild, radio){
|
||||
data.state.station.owner = radio.station.owner;
|
||||
|
||||
client.datastore.updateEntry(guild, data);
|
||||
}
|
||||
}
|
||||
|
@ -59,4 +59,4 @@ module.exports = function searchStation(key, client) {
|
||||
}
|
||||
}
|
||||
return highestProbabilityStation;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,22 @@
|
||||
module.exports = function statisticsUpdate(client, guild, radio) {
|
||||
|
||||
|
||||
client.datastore.checkEntry(guild.id);
|
||||
|
||||
|
||||
radio.datastore = client.datastore.getEntry(guild.id);
|
||||
|
||||
|
||||
if(!radio.datastore.statistics[radio.station.name]){
|
||||
radio.datastore.statistics[radio.station.name] = {};
|
||||
radio.datastore.statistics[radio.station.name].time = 0;
|
||||
radio.datastore.statistics[radio.station.name].used = 0;
|
||||
client.datastore.updateEntry(guild, radio.datastore);
|
||||
}
|
||||
|
||||
|
||||
let date = new Date();
|
||||
radio.currentTime = date.getTime();
|
||||
radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime);
|
||||
radio.datastore.statistics[radio.station.name].time = parseInt(radio.datastore.statistics[radio.station.name].time)+parseInt(radio.playTime);
|
||||
|
||||
|
||||
radio.datastore.statistics[radio.station.name].used = parseInt(radio.datastore.statistics[radio.station.name].used)+1;
|
||||
client.datastore.updateEntry(guild, radio.datastore);
|
||||
client.datastore.calculateGlobal(client);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user