Fixed database stop crash, made playing status use the current bot username
This commit is contained in:
parent
5fa5f21289
commit
9b4861ae4a
4 changed files with 12 additions and 11 deletions
11
app.js
11
app.js
|
@ -59,15 +59,8 @@ async function init() {
|
|||
handler.unload(command);
|
||||
}
|
||||
client.disconnect();
|
||||
const db = require("./utils/database.js");
|
||||
if (process.env.DB_DRIVER=== "mongo") {
|
||||
db.connection.disconnect(() => {
|
||||
process.exit(0);
|
||||
});
|
||||
} else if (process.env.DB_DRIVER=== "postgres") {
|
||||
db.connection.end();
|
||||
process.exit(0);
|
||||
}
|
||||
require("./utils/database.js").stop();
|
||||
process.exit(0);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ module.exports = async () => {
|
|||
// set activity (a.k.a. the gamer code)
|
||||
(async function activityChanger() {
|
||||
client.editStatus("dnd", {
|
||||
name: `${misc.random(messages)} | @esmBot help`,
|
||||
name: `${misc.random(messages)} | @${client.user.username} help`,
|
||||
});
|
||||
setTimeout(activityChanger, 900000);
|
||||
})();
|
||||
|
|
|
@ -23,7 +23,7 @@ const globalSchema = new mongoose.Schema({
|
|||
});
|
||||
const Global = mongoose.model("Global", globalSchema);
|
||||
|
||||
exports.connection = mongoose.connection;
|
||||
const connection = mongoose.connection;
|
||||
|
||||
exports.getGuild = async (query) => {
|
||||
return await Guild.findOne({ id: query });
|
||||
|
@ -134,4 +134,8 @@ exports.setup = async () => {
|
|||
}
|
||||
await global.save();
|
||||
}
|
||||
};
|
||||
|
||||
exports.stop = async () => {
|
||||
await connection.disconnect();
|
||||
};
|
|
@ -104,4 +104,8 @@ exports.setup = async () => {
|
|||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.stop = async () => {
|
||||
await connection.end();
|
||||
};
|
Loading…
Reference in a new issue