mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-07 06:45:18 +02:00
best configuration for embed , blrank and alias et ajout du system des blword ( badword)
This commit is contained in:
@@ -28,6 +28,11 @@ module.exports = {
|
||||
if (!command) {
|
||||
return message.reply(`La commande ${commandName} n'existe pas.`);
|
||||
}
|
||||
const aliasCheck = isAliasUnique(client, newAlias);
|
||||
if (!aliasCheck.isUnique) {
|
||||
return message.reply(`Cet alias est déjà utilisé par la commande \`${aliasCheck.conflictCommand}\`.`);
|
||||
}
|
||||
|
||||
|
||||
let data = await new Promise((resolve, reject) => {
|
||||
db.get('SELECT value FROM gestion WHERE id = ?', [botId], (err, row) => {
|
||||
@@ -45,7 +50,7 @@ module.exports = {
|
||||
|
||||
for (const cmd in data.alias) {
|
||||
if (data.alias[cmd][newAlias]) {
|
||||
return message.reply('Cet alias est déjà utilisé pour une autre commande.');
|
||||
return message.reply(`Cet alias est déjà utilisé par la commande \`${cmd}\`.`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,4 +123,15 @@ module.exports = {
|
||||
return message.reply('Sous-commande invalide. Veuillez utiliser add, remove, ou list.');
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
function isAliasUnique(client, newAlias) {
|
||||
for (const command of client.commands.values()) {
|
||||
if (command.name === newAlias) {
|
||||
return { isUnique: false, conflictCommand: command.name };
|
||||
}
|
||||
if (command.aliases && command.aliases.includes(newAlias)) {
|
||||
return { isUnique: false, conflictCommand: command.name };
|
||||
}
|
||||
}
|
||||
return { isUnique: true };
|
||||
}
|
||||
Reference in New Issue
Block a user