eximiabots-radiox/src/client/funcs/saveState.js

18 lines
569 B
JavaScript
Raw Normal View History

2021-09-02 22:21:55 +00:00
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);
}