forked from DannyTech20/CREEPY_MD-V1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
antilink.js
68 lines (61 loc) · 2.05 KB
/
antilink.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//Created by Danny
//Dont add your commands they wont work😂
// Add a group to the anti-link list
const addAntiLinkGroup = (groupId, _dir) => {
const obj = { id: groupId, warnCount: 0, enabled: true }; // Default anti-link enabled
if (!_dir.some(group => group.id === groupId)) {
_dir.push(obj);
fs.writeFileSync('./database/antilink.json', JSON.stringify(_dir, null, 2));
}
};
// Check if anti-link is enabled for a group
const isAntiLinkEnabled = (groupId, _dir) => {
const group = _dir.find(group => group.id === groupId);
return group ? group.enabled : false;
};
// Enable anti-link for a group
const enableAntiLink = (groupId, _dir) => {
const group = _dir.find(group => group.id === groupId);
if (group) {
group.enabled = true;
fs.writeFileSync('./database/antilink.json', JSON.stringify(_dir, null, 2));
}
};
// Disable anti-link for a group
const disableAntiLink = (groupId, _dir) => {
const group = _dir.find(group => group.id === groupId);
if (group) {
group.enabled = false;
fs.writeFileSync('./database/antilink.json', JSON.stringify(_dir, null, 2));
}
};
// Increment the warning count for a group
const incrementWarnCount = (groupId, _dir) => {
const group = _dir.find(group => group.id === groupId);
if (group) {
group.warnCount += 1;
fs.writeFileSync('./database/antilink.json', JSON.stringify(_dir, null, 2));
}
};
// Get the warning count for a group
const getWarnCount = (groupId, _dir) => {
const group = _dir.find(group => group.id === groupId);
return group ? group.warnCount : 0;
};
// Reset the warning count for a group
const resetWarnCount = (groupId, _dir) => {
const group = _dir.find(group => group.id === groupId);
if (group) {
group.warnCount = 0;
fs.writeFileSync('./database/antilink.json', JSON.stringify(_dir, null, 2));
}
};
module.exports = {
addAntiLinkGroup,
isAntiLinkEnabled,
enableAntiLink,
disableAntiLink,
incrementWarnCount,
getWarnCount,
resetWarnCount
};