mirror of
https://github.com/arthur-pbty/LazyBot.git
synced 2026-06-12 08:14:24 +02:00
add economi system
This commit is contained in:
@@ -24,6 +24,28 @@ module.exports = {
|
||||
);
|
||||
if (!command) return;
|
||||
|
||||
// Vérification du scope / guildCondition
|
||||
if (command.scope === "guild") {
|
||||
const guildId = message.guild ? message.guild.id : null;
|
||||
if (!guildId)
|
||||
return message
|
||||
.reply({ content: "Cette commande ne peut pas être utilisée en message privé." })
|
||||
.then((msg) => setTimeout(() => msg.delete(), 5000));
|
||||
if (typeof command.guildCondition === "function") {
|
||||
let allowed = false;
|
||||
try {
|
||||
allowed = await command.guildCondition(guildId);
|
||||
} catch (err) {
|
||||
console.error(`Erreur guildCondition pour la guild ${guildId}`, err);
|
||||
allowed = false;
|
||||
}
|
||||
if (!allowed)
|
||||
return message
|
||||
.reply({ content: "Cette commande est désactivée sur ce serveur." })
|
||||
.then((msg) => setTimeout(() => msg.delete(), 5000));
|
||||
}
|
||||
}
|
||||
|
||||
if (command.dm !== true && message.channel.type === 1)
|
||||
return message
|
||||
.reply({
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
module.exports = {
|
||||
name: "interactionCreate",
|
||||
async execute(client, interaction) {
|
||||
@@ -7,6 +6,24 @@ module.exports = {
|
||||
const command = client.commands.get(interaction.commandName);
|
||||
if (!command) return;
|
||||
|
||||
// Vérification du scope / guildCondition
|
||||
if (command.scope === "guild") {
|
||||
const guildId = interaction.guild ? interaction.guild.id : null;
|
||||
if (!guildId)
|
||||
return interaction.reply({ content: "Cette commande ne peut pas être utilisée en message privé.", ephemeral: true });
|
||||
if (typeof command.guildCondition === "function") {
|
||||
let allowed = false;
|
||||
try {
|
||||
allowed = await command.guildCondition(guildId);
|
||||
} catch (err) {
|
||||
console.error(`Erreur guildCondition pour la guild ${guildId}`, err);
|
||||
allowed = false;
|
||||
}
|
||||
if (!allowed)
|
||||
return interaction.reply({ content: "Cette commande est désactivée sur ce serveur.", ephemeral: true });
|
||||
}
|
||||
}
|
||||
|
||||
if (command.dm !== true && interaction.channel.type === 1)
|
||||
return interaction.reply({
|
||||
content: "Cette commande ne peut pas être utilisée en message privé.",
|
||||
|
||||
Reference in New Issue
Block a user