mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-15 15:56:27 +02:00
addc permiision update
This commit is contained in:
@@ -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.');
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -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
@@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
"2048": 0,
|
||||||
|
"permupdate": 4,
|
||||||
|
"dbperm": 4,
|
||||||
"clear": 4,
|
"clear": 4,
|
||||||
"help": 0,
|
"help": 0,
|
||||||
"support": 0,
|
"support": 0,
|
||||||
@@ -48,8 +51,8 @@
|
|||||||
"tempmute": 5,
|
"tempmute": 5,
|
||||||
"mutelist": 5,
|
"mutelist": 5,
|
||||||
"banlist": 5,
|
"banlist": 5,
|
||||||
"warn": 5,
|
"warn": 3,
|
||||||
"unwarn": 5,
|
"unwarn": 3,
|
||||||
"sanction": 5,
|
"sanction": 5,
|
||||||
"kick": 5,
|
"kick": 5,
|
||||||
"addrole": 5,
|
"addrole": 5,
|
||||||
@@ -95,7 +98,6 @@
|
|||||||
"pfc": 0,
|
"pfc": 0,
|
||||||
"vc": 0,
|
"vc": 0,
|
||||||
"flood": 0,
|
"flood": 0,
|
||||||
"2048": 0,
|
|
||||||
"findemoji": 0,
|
"findemoji": 0,
|
||||||
"guesspokemon": 0,
|
"guesspokemon": 0,
|
||||||
"slot": 0,
|
"slot": 0,
|
||||||
@@ -105,5 +107,10 @@
|
|||||||
"wordle": 0,
|
"wordle": 0,
|
||||||
"pdefault": 11,
|
"pdefault": 11,
|
||||||
"changelog": 0,
|
"changelog": 0,
|
||||||
"mod": 10
|
"mod": 10,
|
||||||
|
"bunker": 5,
|
||||||
|
"play": 5,
|
||||||
|
"set": 5,
|
||||||
|
"poll": 5,
|
||||||
|
"userinfo": 5
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user