MCPcopy Create free account
hub / github.com/Xchristech2/Zenitsu-Bot / loadUserGroupData

Function loadUserGroupData

lib/index.js:5–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3
4// Function to load user and group data from JSON file
5function loadUserGroupData() {
6 try {
7 const dataPath = path.join(__dirname, '../data/userGroupData.json');
8 if (!fs.existsSync(dataPath)) {
9 // Create the file with default structure if it doesn't exist
10 const defaultData = {
11 antibadword: {},
12 antilink: {},
13 welcome: {},
14 goodbye: {},
15 chatbot: {},
16 warnings: {},
17 sudo: []
18 };
19 fs.writeFileSync(dataPath, JSON.stringify(defaultData, null, 2));
20 return defaultData;
21 }
22 const data = JSON.parse(fs.readFileSync(dataPath, 'utf8'));
23 return data;
24 } catch (error) {
25 console.error('Error loading user group data:', error);
26 return {
27 antibadword: {},
28 antilink: {},
29 welcome: {},
30 goodbye: {},
31 chatbot: {},
32 warnings: {}
33 };
34 }
35}
36
37// Function to save user and group data to JSON file
38function saveUserGroupData(data) {

Callers 15

setAntilinkFunction · 0.70
getAntilinkFunction · 0.70
removeAntilinkFunction · 0.70
setAntitagFunction · 0.70
getAntitagFunction · 0.70
removeAntitagFunction · 0.70
incrementWarningCountFunction · 0.70
resetWarningCountFunction · 0.70
isSudoFunction · 0.70
addSudoFunction · 0.70
removeSudoFunction · 0.70
getSudoListFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected