Skip to content

Commit

Permalink
Merge pull request #42 from codding-nepale/patch-1
Browse files Browse the repository at this point in the history
fix: linux path
  • Loading branch information
Cleboost authored Sep 1, 2024
2 parents 919cccc + 74dad0d commit f2d8463
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions handlers/load/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ export default async (client: CustomClient): Promise<void> => {

for (const button of buttons) {
const btn: Button = (await import(path.join(__dirname, '..', '..', basePath, button))).default;

if (!btn.customID) {
console.log(`The button ${button} has no customID`);
continue;
}
if (button.includes('\\')) btn.customID = button.split('\\')[0] + ':' + btn.customID;

const directoryName = path.dirname(button).split(path.sep).pop();
if (directoryName && directoryName !== '.') btn.customID = `${directoryName}:${btn.customID}`;

client.buttons?.set(btn.customID, btn);
}
resolve();
});
}
}

0 comments on commit f2d8463

Please sign in to comment.