mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-14 03:50:18 +00:00
Fixed some errors
This commit is contained in:
parent
1147093788
commit
9648e828e6
@ -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) {
|
||||||
client.funcs.statisticsUpdate(client, newState, radio);
|
client.funcs.statisticsUpdate(client, newState.guild, 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) {
|
||||||
client.funcs.statisticsUpdate(client, newState, radio);
|
client.funcs.statisticsUpdate(client, newState.guild, 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) {
|
||||||
client.funcs.statisticsUpdate(client, newState, radio);
|
client.funcs.statisticsUpdate(client, newState.guild, 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);
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
module.exports = function statisticsUpdate(client, currentState, radio) {
|
module.exports = function statisticsUpdate(client, guild, radio) {
|
||||||
|
|
||||||
client.datastore.checkEntry(currentState.guild.id);
|
client.datastore.checkEntry(guild.id);
|
||||||
|
|
||||||
radio.currentGuild = client.datastore.getEntry(currentState.guild.id);
|
radio.currentGuild = client.datastore.getEntry(guild.id);
|
||||||
|
|
||||||
if(!radio.currentGuild.statistics[radio.station.name]){
|
if(!radio.currentGuild.statistics[radio.station.name]){
|
||||||
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].time = 0;
|
||||||
radio.currentGuild.statistics[radio.station.name].used = 0;
|
radio.currentGuild.statistics[radio.station.name].used = 0;
|
||||||
client.datastore.updateEntry(currentState.guild, radio.currentGuild);
|
client.datastore.updateEntry(guild, radio.currentGuild);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!radio.connection.dispatcher){
|
if(!radio.connection.dispatcher){
|
||||||
@ -21,6 +21,6 @@ module.exports = function statisticsUpdate(client, currentState, radio) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
radio.currentGuild.statistics[radio.station.name].used = parseInt(radio.currentGuild.statistics[radio.station.name].used)+1;
|
radio.currentGuild.statistics[radio.station.name].used = parseInt(radio.currentGuild.statistics[radio.station.name].used)+1;
|
||||||
client.datastore.updateEntry(currentState.guild, radio.currentGuild);
|
client.datastore.updateEntry(guild, radio.currentGuild);
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user