MCPcopy Create free account
hub / github.com/Slayer128/Carltech-Bot / ajouterUtilisateurAvecWarnCount

Function ajouterUtilisateurAvecWarnCount

lib/warn.js:28–45  ·  view source on GitHub ↗
(jid)

Source from the content-addressed store, hash-verified

26
27// Function to add or update the warning count for a user (jid)
28async function ajouterUtilisateurAvecWarnCount(jid) {
29 try {
30 const data = loadWarnData();
31
32 // If the jid is already in the data, increment the warn count
33 if (data[jid]) {
34 data[jid].warn_count += 1;
35 } else {
36 // Otherwise, create a new entry with a warn_count of 1
37 data[jid] = { warn_count: 1 };
38 }
39
40 saveWarnData(data);
41 console.log(`Utilisateur ${jid} ajouté ou mis à jour avec un warn_count de ${data[jid].warn_count}.`);
42 } catch (error) {
43 console.error("Erreur lors de l'ajout ou de la mise à jour de l'utilisateur :", error);
44 }
45}
46
47// Function to get the warning count for a user (jid)
48async function getWarnCountByJID(jid) {

Callers

nothing calls this directly

Calls 2

loadWarnDataFunction · 0.85
saveWarnDataFunction · 0.85

Tested by

no test coverage detected