mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2026-10-29 21:55:01 +00:00
Folder re-structuring
This commit is contained in:
1 parent
5667e2f0a9
commit
f300d9c0df
21 files changed
+35
-35
No files matched your search
@@ -2,7 +2,7 @@ const { Client, Collection } = require('discord.js');
|
|||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const events = '../events/';
|
const events = './events/';
|
||||||
const Datastore = require('./datastore.js');
|
const Datastore = require('./datastore.js');
|
||||||
|
|
||||||
module.exports = class extends Client {
|
module.exports = class extends Client {
|
||||||
@@ -16,15 +16,16 @@ module.exports = class extends Client {
|
|||||||
this.radio = new Map();
|
this.radio = new Map();
|
||||||
|
|
||||||
this.funcs = {};
|
this.funcs = {};
|
||||||
this.funcs.check = require('../funcs/check.js');
|
this.funcs.check = require('./funcs/check.js');
|
||||||
this.funcs.msToTime = require('../funcs/msToTime.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');
|
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) {
|
for (const file of commandFiles) {
|
||||||
const command = require(`../commands/${file}`);
|
const command = require(`./commands/${file}`);
|
||||||
command.uses = 0;
|
command.uses = 0;
|
||||||
this.commands.set(command.name, command);
|
this.commands.set(command.name, command);
|
||||||
this.commandAliases.set(command.alias, command);
|
this.commandAliases.set(command.alias, command);
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -32,6 +32,6 @@ module.exports = {
|
|||||||
.then(res => res.json());
|
.then(res => res.json());
|
||||||
}, 3600000);
|
}, 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);
|
|
||||||
|
|
||||||
}
|
|
||||||
File renamed without changes.
File renamed without changes.
@@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
File renamed without changes.
Reference in new issue
Block a user