forked from asdbee/ModMail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodmail.js
49 lines (43 loc) · 1.22 KB
/
modmail.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
let get = {};
get.updateDB = (channel, closed, log) => {
const getMail = require('./database/template.js');
getMail.findOne({ channelID: channel }).then((data) => {
(data.channelID = channel), (data.isClosed = closed), (data.logFile = log);
data.save();
});
};
get.configBan = (where, id, banned) => {
const getMail = require('./database/template.js');
if (where === 'fromChannel') {
getMail.findOne({ channelID: id }).then((data) => {
data.isBanned = banned;
data.save();
});
} else if (where === 'fromUser') {
getMail.findOne({ userID: id }).then((data) => {
data.isBanned = banned;
data.save();
});
}
};
get.getChannel = (cid) => {
const getMail = require('./database/template.js');
return getMail.findOne({ channelID: cid });
};
get.getModMail = (id) => {
const getMail = require('./database/template.js');
return getMail.findById(id);
};
get.createDB = (user, channel, closed, logFile, banned) => {
const createMail = require('./database/template.js');
const newMail = new createMail({
_id: user,
userID: user,
channelID: channel,
logFile: logFile,
isClosed: closed,
isBanned: banned,
});
newMail.save();
};
module.exports = { get };