mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-03 23:36:35 +02:00
26 lines
908 B
JavaScript
26 lines
908 B
JavaScript
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.');
|
|
},
|
|
}; |