addc permiision update

This commit is contained in:
VALOU3336
2024-02-16 18:41:29 +01:00
parent 9d2208ba87
commit 49ebc08667
3 changed files with 61 additions and 4 deletions
+26
View File
@@ -0,0 +1,26 @@
const db = require('quick.db');
const GestionDb = new db.table("gestion");
const fs = require('fs');
const path = require('path');
module.exports = {
name: 'dbperm',
description: 'Mettre à jour les permissions par défaut dans la base de données',
async execute(message, args, client) {
const botId = message.client.user.id;
const permissionsPath = path.resolve(__dirname, '../permissions.json');
const permissionsJson = JSON.parse(fs.readFileSync(permissionsPath));
const currentPermissions = GestionDb.get(`${botId}.permissions`) || {};
for (const command in permissionsJson) {
if (!currentPermissions.hasOwnProperty(command)) {
GestionDb.set(`${botId}.permissions.${command}`, permissionsJson[command]);
}
}
message.reply('Les permissions ont été mises à jour avec succès.');
},
};
+24
View File
@@ -0,0 +1,24 @@
const fs = require('fs');
const path = require('path');
const db = require('quick.db');
const GestionDb = new db.table("gestion");
module.exports = {
name: 'permupdate',
description: 'Mettre à jour les permissions dans le fichier permissions.json',
async execute(message, args, client) {
const commands = Array.from(client.commands.keys());
const permissionsPath = path.resolve(__dirname, '../permissions.json');
const permissionsJson = JSON.parse(fs.readFileSync(permissionsPath));
commands.forEach(command => {
if (!permissionsJson.hasOwnProperty(command)) {
permissionsJson[command] = 5;
}
});
fs.writeFileSync(permissionsPath, JSON.stringify(permissionsJson, null, 2));
message.reply('Les permissions ont été mises à jour avec succès.');
},
};
+11 -4
View File
@@ -1,4 +1,7 @@
{
"2048": 0,
"permupdate": 4,
"dbperm": 4,
"clear": 4,
"help": 0,
"support": 0,
@@ -48,8 +51,8 @@
"tempmute": 5,
"mutelist": 5,
"banlist": 5,
"warn": 5,
"unwarn": 5,
"warn": 3,
"unwarn": 3,
"sanction": 5,
"kick": 5,
"addrole": 5,
@@ -95,7 +98,6 @@
"pfc": 0,
"vc": 0,
"flood": 0,
"2048": 0,
"findemoji": 0,
"guesspokemon": 0,
"slot": 0,
@@ -105,5 +107,10 @@
"wordle": 0,
"pdefault": 11,
"changelog": 0,
"mod": 10
"mod": 10,
"bunker": 5,
"play": 5,
"set": 5,
"poll": 5,
"userinfo": 5
}