18 lines
508 B
JavaScript
18 lines
508 B
JavaScript
const { mongoose } = require('../db-connection');
|
|
const StaffSettings = mongoose.model('StaffSettings');
|
|
|
|
async function getNotifyDm(userId) {
|
|
const doc = await StaffSettings.findOne({ userId }).lean();
|
|
return doc ? doc.notifyDm : false;
|
|
}
|
|
|
|
async function setNotifyDm(userId, guildId, value) {
|
|
await StaffSettings.findOneAndUpdate(
|
|
{ userId },
|
|
{ $set: { notifyDm: value, guildId, updatedAt: new Date() } },
|
|
{ upsert: true, new: true }
|
|
);
|
|
}
|
|
|
|
module.exports = { getNotifyDm, setNotifyDm };
|