MCPcopy Create free account
hub / github.com/codebymitch/TitanBot / getAllFiles

Function getAllFiles

src/handlers/commandLoader.js:34–51  ·  view source on GitHub ↗
(directory, fileList = [])

Source from the content-addressed store, hash-verified

32}
33
34async function getAllFiles(directory, fileList = []) {
35 const files = await fs.readdir(directory, { withFileTypes: true });
36
37 for (const file of files) {
38 const filePath = path.join(directory, file.name);
39
40 if (file.isDirectory()) {
41 if (file.name === 'modules') {
42 continue;
43 }
44 await getAllFiles(filePath, fileList);
45 } else if (file.name.endsWith('.js')) {
46 fileList.push(filePath);
47 }
48 }
49
50 return fileList;
51}
52
53export async function loadCommands(client) {
54 client.commands = new Collection();

Callers 1

loadCommandsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected