Skip to content

Commit

Permalink
Merge pull request #9 from Artivain/unstable
Browse files Browse the repository at this point in the history
v1.6.0
  • Loading branch information
GoudronViande24 authored Jan 8, 2022
2 parents 92da19e + 7242401 commit 0dbe8fb
Show file tree
Hide file tree
Showing 35 changed files with 591 additions and 172 deletions.
3 changes: 2 additions & 1 deletion ab-core/events/buttonInteraction.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { params } = require("../../config.json");
const { log } = require("../logger");

module.exports = {
name: "interactionCreate",
Expand Down Expand Up @@ -27,7 +28,7 @@ module.exports = {
await command.execute(interaction, params);
return;
} catch (err) {
console.error(err);
log("ButtonManager", err, "warn", true);
await interaction.reply({
content: "[ButtonManager] Il y a eu un problème lors de l'exécution de ce bouton...",
ephemeral: true,
Expand Down
13 changes: 7 additions & 6 deletions ab-core/events/contextInteraction.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const config = require("../../config.json").params;
const { log } = require("../logger");

module.exports = {
name: "interactionCreate",
Expand Down Expand Up @@ -34,7 +35,7 @@ module.exports = {
await command.execute(interaction, config);
return;
} catch (err) {
console.error(err);
log("InteractionManager", err, "warn", true);
await interaction.reply({
content: "Il y a eu un problème avec l'exécution de l'interaction...",
ephemeral: true,
Expand All @@ -55,7 +56,7 @@ module.exports = {
await command.execute(interaction, config);
return;
} catch (err) {
console.error(err);
log("InteractionManager", err, "warn", true);
await interaction.reply({
content: "Il y a eu un problème avec l'exécution de l'interaction...",
ephemeral: true,
Expand All @@ -64,10 +65,10 @@ module.exports = {
}
}

// Practically not possible, but we are still caching the bug.
// Practically not possible, but we are still catching the bug.
// Possible Fix is a restart!
else {
return console.log("[InteractionManager] Quelque chose de suspect est survenue avec le menu. Réception d'un type de menu inconnu.");
}
},
return log("InteractionManager", "Quelque chose de suspect est survenue avec le menu. Réception d'un type de menu inconnu.", "warn", true);
};
}
};
6 changes: 4 additions & 2 deletions ab-core/events/guildCreate.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const { log } = require("../logger");

module.exports = {
name: "guildCreate",

async execute(guild) {
console.log("[Artibot] Ajouté à un nouveau serveur:", guild.name)
log("Artibot", "Ajouté à un nouveau serveur: " + guild.name, "log", true);
}
}
};
6 changes: 4 additions & 2 deletions ab-core/events/guildDelete.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const { log } = require("../logger");

module.exports = {
name: "guildDelete",

async execute(guild) {
console.log("[Artibot] Retiré du serveur:", guild.name)
log("Artibot", "Retiré du serveur:" + guild.name, "log", true);
}
}
};
16 changes: 10 additions & 6 deletions ab-core/events/initGlobal.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
const { params } = require("../../config.json");
const logPrefix = "[GlobalManager]";
const { log } = require("../logger");
const logPrefix = "GlobalManager";

module.exports = {
name: "ready",
once: true,

execute(client) {
console.log(logPrefix, "Initialisation des modules");
log(logPrefix, "Initialisation des modules...", "info", true);
const length = client.global.size;

if (length == 0) {
console.log(logPrefix, "Aucun module à charger.");
log(logPrefix, "Aucun module à charger.", "log", true);
return
}
console.log(logPrefix, `Lancement de ${length} module${(length == 1) ? "" : "s"}:`);
};

log(logPrefix, `Lancement de ${length} module${(length == 1) ? "" : "s"}:`, "log", true);

client.global.forEach(module => {
console.log(logPrefix, "-", module.name);
log(logPrefix, " - " + module.name, "log", true);
setTimeout(() => {
module.execute(client, params);
}, 1000);
Expand Down
3 changes: 2 additions & 1 deletion ab-core/events/messageCreate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { Collection, MessageEmbed } = require("discord.js");
const { prefix, ownerId } = require("../../config.json");
const { log } = require("../logger");
const config = require("../../config.json").params;

// Prefix regex, we will use to match in mention prefix.
Expand Down Expand Up @@ -136,7 +137,7 @@ module.exports = {
try {
command.execute(message, args, config);
} catch (error) {
console.error(error);
log("CommandManager", error, "warn", true);
message.reply({
content: "Il y a eu une erreur lors de l'exécution de cette commande.",
});
Expand Down
6 changes: 4 additions & 2 deletions ab-core/events/onReadyMessage.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const { log } = require("../logger");

module.exports = {
name: "ready",
once: true,

execute(client) {
console.log(`[Artibot] Prêt! Connecté en tant que ${client.user.tag}`);
},
log("Artibot", `Prêt! Connecté en tant que ${client.user.tag}`, "info", true);
}
};
13 changes: 7 additions & 6 deletions ab-core/events/selectInteraction.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { log } = require("../logger");
const {params} = require("../../config.json");

module.exports = {
Expand All @@ -17,21 +18,21 @@ module.exports = {

if (!command) {
await require("../messages/defaultSelectError").execute(interaction);
return;
}
return
};

// A try to execute the interaction.

try {
await command.execute(interaction, params);
return;
} catch (err) {
console.error(err);
log("ButtonManager", err, "warn", true);
await interaction.reply({
content: "Il y a eu une erreur avec l'exécution de cette option du menu.",
ephemeral: true,
});
return;
}
},
return
};
}
};
9 changes: 5 additions & 4 deletions ab-core/events/slashCreate.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { log } = require("../logger");
const config = require("../../config.json").params;

module.exports = {
Expand All @@ -22,11 +23,11 @@ module.exports = {
try {
await command.execute(interaction, config);
} catch (err) {
console.error(err);
log("SlashManager", err, "warn", true);
await interaction.reply({
content: "Il y a eu une erreur avec l'exécution de cette commande.",
ephemeral: true,
ephemeral: true
});
}
},
};
}
};
2 changes: 1 addition & 1 deletion ab-core/events/slashInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ module.exports = {
};
});
}
}
};
11 changes: 6 additions & 5 deletions ab-core/events/triggerCreate.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { log } = require("../logger");
const {params} = require("../../config.json");

module.exports = {
Expand Down Expand Up @@ -26,16 +27,16 @@ module.exports = {
} catch (error) {
// If checks fail, reply back!

console.error(error);
log("TriggerManager", error, "warn", true);
message.reply({
content: "Il y a eu une erreur avec l'exécution d'un trigger!",
});
}
};

check = 1;
return false;
}
return false
};
});
});
},
}
};
10 changes: 5 additions & 5 deletions ab-core/events/updateBotName.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { log } = require("../logger");

module.exports = {
name: "ready",
once: true,
Expand All @@ -6,9 +8,7 @@ module.exports = {
const config = require("../../config.json").params;
if (client.user.username != config.botName) {
client.user.setUsername(config.botName)
.then(
console.log("[Artibot] Nom du bot mis à jour pour", config.botName)
);
}
},
.then(log("Artibot", "Nom du bot mis à jour pour " + config.botName, "log", true));
};
}
};
Loading

0 comments on commit 0dbe8fb

Please sign in to comment.