#Code yielding
6 messages · Page 1 of 1 (latest)
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
const {promisify} = require("util");
const Ascil = require("ascii-table");
const {glob} = require("glob");
const PG = promisify(glob);
module.exports = async (client, PG, Ascii) => {
const table = new Ascii("Buttons Hanlder");
console.log(table.toString());
const buttonsFolder = await PG(`${process.cwd()}/src/helper/buttons/**/*.js`);
console.log(buttonsFolder);
buttonsFolder.map(async (button) => {
const buttonFile = require(button);
console.log(button, buttonFile)
if (!buttonFile.id) return;
client.buttons.set(buttonFile.id, buttonFile);
table.addRow(buttonFile.id, "✅");
});
console.log(table.toString());
};
The code does not run past
const buttonsFolder = await PG(`${process.cwd()}/src/helper/buttons/**/*.js`);
are you sure you don't have any errors
isn't glob async already, why promisify it?
Yes there are no errors but, I made new code to make it more like my event handlder and it works now