mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-09 23:40:18 +00:00
Folder re-structuring
This commit is contained in:
parent
5667e2f0a9
commit
f300d9c0df
@ -2,7 +2,7 @@ const { Client, Collection } = require('discord.js');
|
||||
const Discord = require('discord.js');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const events = '../events/';
|
||||
const events = './events/';
|
||||
const Datastore = require('./datastore.js');
|
||||
|
||||
module.exports = class extends Client {
|
||||
@ -16,15 +16,16 @@ module.exports = class extends Client {
|
||||
this.radio = new Map();
|
||||
|
||||
this.funcs = {};
|
||||
this.funcs.check = require('../funcs/check.js');
|
||||
this.funcs.msToTime = require('../funcs/msToTime.js');
|
||||
this.funcs.check = require('./funcs/check.js');
|
||||
this.funcs.msToTime = require('./funcs/msToTime.js');
|
||||
this.funcs.statisticsUpdate = require('./funcs/statisticsUpdate.js');
|
||||
|
||||
this.config = require('../config.js');
|
||||
this.config = require('./config.js');
|
||||
this.messages = require('./messages.js');
|
||||
|
||||
const commandFiles = fs.readdirSync(path.join(path.dirname(__dirname), 'commands')).filter(f => f.endsWith('.js'));
|
||||
const commandFiles = fs.readdirSync(path.join('commands')).filter(f => f.endsWith('.js'));
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`../commands/${file}`);
|
||||
const command = require(`./commands/${file}`);
|
||||
command.uses = 0;
|
||||
this.commands.set(command.name, command);
|
||||
this.commandAliases.set(command.alias, command);
|
@ -32,6 +32,6 @@ module.exports = {
|
||||
.then(res => res.json());
|
||||
}, 3600000);
|
||||
|
||||
require(`../struct/emojis.js`).execute(client);
|
||||
require(`./emojis.js`).execute(client);
|
||||
}
|
||||
}
|
@ -43,30 +43,3 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function statisticsUpdate(client, currentState, radio) {
|
||||
|
||||
client.datastore.checkEntry(currentState.guild.id);
|
||||
|
||||
radio.currentGuild = client.datastore.getEntry(currentState.guild.id);
|
||||
|
||||
if(!radio.currentGuild.statistics[radio.station.name]){
|
||||
radio.currentGuild.statistics[radio.station.name] = {};
|
||||
radio.currentGuild.statistics[radio.station.name].time = 0;
|
||||
radio.currentGuild.statistics[radio.station.name].used = 0;
|
||||
client.datastore.updateEntry(currentState.guild, radio.currentGuild);
|
||||
}
|
||||
|
||||
if(!radio.connection.dispatcher){
|
||||
let date = new Date();
|
||||
radio.currentTime = date.getTime();
|
||||
radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime);
|
||||
radio.currentGuild.statistics[radio.station.name].time = parseInt(radio.currentGuild.statistics[radio.station.name].time)+parseInt(radio.playTime);
|
||||
} else {
|
||||
radio.currentGuild.statistics[radio.station.name].time = parseInt(radio.currentGuild.statistics[radio.station.name].time)+parseInt(radio.connection.dispatcher.streamTime.toFixed(0));
|
||||
}
|
||||
|
||||
radio.currentGuild.statistics[radio.station.name].used = parseInt(radio.currentGuild.statistics[radio.station.name].used)+1;
|
||||
client.datastore.updateEntry(currentState.guild, radio.currentGuild);
|
||||
|
||||
}
|
26
client/funcs/statisticsUpdate.js
Normal file
26
client/funcs/statisticsUpdate.js
Normal file
@ -0,0 +1,26 @@
|
||||
module.exports = function statisticsUpdate(client, currentState, radio) {
|
||||
|
||||
client.datastore.checkEntry(currentState.guild.id);
|
||||
|
||||
radio.currentGuild = client.datastore.getEntry(currentState.guild.id);
|
||||
|
||||
if(!radio.currentGuild.statistics[radio.station.name]){
|
||||
radio.currentGuild.statistics[radio.station.name] = {};
|
||||
radio.currentGuild.statistics[radio.station.name].time = 0;
|
||||
radio.currentGuild.statistics[radio.station.name].used = 0;
|
||||
client.datastore.updateEntry(currentState.guild, radio.currentGuild);
|
||||
}
|
||||
|
||||
if(!radio.connection.dispatcher){
|
||||
let date = new Date();
|
||||
radio.currentTime = date.getTime();
|
||||
radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime);
|
||||
radio.currentGuild.statistics[radio.station.name].time = parseInt(radio.currentGuild.statistics[radio.station.name].time)+parseInt(radio.playTime);
|
||||
} else {
|
||||
radio.currentGuild.statistics[radio.station.name].time = parseInt(radio.currentGuild.statistics[radio.station.name].time)+parseInt(radio.connection.dispatcher.streamTime.toFixed(0));
|
||||
}
|
||||
|
||||
radio.currentGuild.statistics[radio.station.name].used = parseInt(radio.currentGuild.statistics[radio.station.name].used)+1;
|
||||
client.datastore.updateEntry(currentState.guild, radio.currentGuild);
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user