mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-10 03:00:18 +00:00
Fixing forgotten things
This commit is contained in:
parent
c3eca7267b
commit
c51e5ea3b8
@ -43,7 +43,7 @@ module.exports = {
|
|||||||
|
|
||||||
if (radio) {
|
if (radio) {
|
||||||
|
|
||||||
statisticsUpdate(client, msg.guild, radio);
|
client.funcs.statisticsUpdate(client, msg.guild, radio);
|
||||||
|
|
||||||
radio.connection.dispatcher.destroy();
|
radio.connection.dispatcher.destroy();
|
||||||
radio.station = station;
|
radio.station = station;
|
||||||
@ -110,19 +110,6 @@ function play(guild, client, url) {
|
|||||||
radio.textChannel.send(client.messageEmojis["play"] + message.play);
|
radio.textChannel.send(client.messageEmojis["play"] + message.play);
|
||||||
};
|
};
|
||||||
|
|
||||||
function statisticsUpdate(client, guild, radio) {
|
|
||||||
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(guild, radio.currentGuild);
|
|
||||||
}
|
|
||||||
|
|
||||||
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(guild, radio.currentGuild);
|
|
||||||
};
|
|
||||||
|
|
||||||
function searchStation(key, client) {
|
function searchStation(key, client) {
|
||||||
if (client.stations === null) return false;
|
if (client.stations === null) return false;
|
||||||
let foundStations = [];
|
let foundStations = [];
|
||||||
|
@ -8,7 +8,7 @@ module.exports = {
|
|||||||
execute(msg, args, client, Discord, command) {
|
execute(msg, args, client, Discord, command) {
|
||||||
const radio = client.radio.get(msg.guild.id);
|
const radio = client.radio.get(msg.guild.id);
|
||||||
if (client.funcs.check(client, msg, command)) {
|
if (client.funcs.check(client, msg, command)) {
|
||||||
statisticsUpdate(client, msg.guild, radio);
|
client.funcs.statisticsUpdate(client, msg.guild, radio);
|
||||||
radio.connection.dispatcher.destroy();
|
radio.connection.dispatcher.destroy();
|
||||||
radio.voiceChannel.leave();
|
radio.voiceChannel.leave();
|
||||||
client.radio.delete(msg.guild.id);
|
client.radio.delete(msg.guild.id);
|
||||||
@ -16,18 +16,3 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function statisticsUpdate(client, guild, radio) {
|
|
||||||
client.datastore.checkEntry(guild.id);
|
|
||||||
radio.currentGuild = client.datastore.getEntry(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(guild, radio.currentGuild);
|
|
||||||
}
|
|
||||||
|
|
||||||
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(guild, radio.currentGuild);
|
|
||||||
}
|
|
@ -7,7 +7,7 @@ module.exports = {
|
|||||||
if (!radio) return;
|
if (!radio) return;
|
||||||
if (newState.member.id === client.user.id && oldState.member.id === client.user.id) {
|
if (newState.member.id === client.user.id && oldState.member.id === client.user.id) {
|
||||||
if (newState.channel === null) {
|
if (newState.channel === null) {
|
||||||
statisticsUpdate(client, newState, radio);
|
client.funcs.statisticsUpdate(client, newState, radio);
|
||||||
return client.radio.delete(newState.guild.id);
|
return client.radio.delete(newState.guild.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ module.exports = {
|
|||||||
const connection = await oldState.channel.join();
|
const connection = await oldState.channel.join();
|
||||||
return radio.connection = connection;
|
return radio.connection = connection;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
statisticsUpdate(client, newState, radio);
|
client.funcs.statisticsUpdate(client, newState, radio);
|
||||||
radio.connection.dispatcher.destroy();
|
radio.connection.dispatcher.destroy();
|
||||||
radio.voiceChannel.leave();
|
radio.voiceChannel.leave();
|
||||||
client.radio.delete(oldState.guild.id);
|
client.radio.delete(oldState.guild.id);
|
||||||
@ -34,7 +34,7 @@ module.exports = {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!radio) return;
|
if (!radio) return;
|
||||||
if (radio.voiceChannel.members.size === 1) {
|
if (radio.voiceChannel.members.size === 1) {
|
||||||
statisticsUpdate(client, newState, radio);
|
client.funcs.statisticsUpdate(client, newState, radio);
|
||||||
radio.connection.dispatcher.destroy();
|
radio.connection.dispatcher.destroy();
|
||||||
radio.voiceChannel.leave();
|
radio.voiceChannel.leave();
|
||||||
client.radio.delete(newState.guild.id);
|
client.radio.delete(newState.guild.id);
|
||||||
|
Loading…
Reference in New Issue
Block a user