mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-09 23:40:18 +00:00
Added saveRadios function & imported funcs in Client.ts
This commit is contained in:
parent
235a02ca60
commit
60ef1cd138
@ -42,6 +42,8 @@ class RadioClient extends Client {
|
||||
this.funcs.searchStation = require("./client/funcs/searchStation.js");
|
||||
this.funcs.play = require("./client/funcs/play.js");
|
||||
this.funcs.listStations = require("./client/funcs/listStations.js");
|
||||
this.funcs.restoreRadios = require("./client/funcs/restoreRadios.js");
|
||||
this.funcs.saveRadios = require("./client/funcs/saveRadios.js");
|
||||
|
||||
console.log('RadioX ' + this.config.version);
|
||||
console.log('Internet Radio to your Discord guild');
|
||||
|
20
src/client/funcs/saveRadios.js
Normal file
20
src/client/funcs/saveRadios.js
Normal file
@ -0,0 +1,20 @@
|
||||
module.exports = async 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) {
|
||||
await client.funcs.statisticsUpdate(client, currentRadio.guild, currentRadio);
|
||||
await client.funcs.saveState(client, currentRadio.guild, currentRadio);
|
||||
currentRadio.connection?.destroy();
|
||||
currentRadio.audioPlayer?.stop();
|
||||
currentRadio.message?.delete();
|
||||
client.radio.delete(radio.value);
|
||||
}
|
||||
|
||||
radio = currentRadios.next();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user