Fix presence updating without restarting bot

Use a discord collection instead of reading from a config file
This commit is contained in:
SileNce5k 2021-08-30 13:34:46 +02:00
parent 32862a825f
commit d91b2c748c
No known key found for this signature in database
GPG key ID: C507260E7F2583AD
4 changed files with 13 additions and 7 deletions

View file

@ -1,10 +1,12 @@
const fs = require('fs');
module.exports = function (presenceType, presenceText){
module.exports = function (presenceType, presenceText, client){
const configPath = "./data/config.json";
let config = JSON.parse(fs.readFileSync(configPath));
config.presenceType = presenceType;
config.presenceText = presenceText;
client.settings.set("presenceType", presenceType);
client.settings.set("presenceText", presenceText);
fs.writeFileSync(configPath, JSON.stringify(config, null, 4));