feat: mise à jour du code
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { Collection } = require("discord.js");
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { Collection } = require('discord.js');
|
||||
|
||||
function loadButtons(client) {
|
||||
const interactionsPath = path.join(__dirname, "../interactions");
|
||||
const interactionsPath = path.join(__dirname, '../interactions');
|
||||
client.buttons = new Collection();
|
||||
|
||||
if (!fs.existsSync(interactionsPath)) return client.buttons;
|
||||
|
||||
const files = fs.readdirSync(interactionsPath).filter(f => f.endsWith(".js"));
|
||||
const files = fs
|
||||
.readdirSync(interactionsPath)
|
||||
.filter((f) => f.endsWith('.js'));
|
||||
|
||||
for (const file of files) {
|
||||
const button = require(path.join(interactionsPath, file));
|
||||
@@ -33,4 +35,4 @@ async function handleButton(interaction, client) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { loadButtons, handleButton };
|
||||
module.exports = { loadButtons, handleButton };
|
||||
|
||||
Reference in New Issue
Block a user