eximiabots-radiox/src/client/funcs/saveState.js
2021-09-03 01:21:55 +03:00

18 lines
569 B
JavaScript

module.exports = function saveState(client, guild, radio){
client.datastore.checkEntry(guild.id);
let date = new Date();
let data = client.datastore.getEntry(guild.id);
data.state = {};
data.state.channels = {};
data.state.channels.text = radio.textChannel.id;
data.state.channels.voice = radio.voiceChannel.id;
data.state.date = date.toISOString();
data.state.station = {};
data.state.station.name = radio.station.name;
data.state.station.owner = radio.station.owner;
client.datastore.updateEntry(guild, data);
}