Skip to content

Commit

Permalink
fix: linux path
Browse files Browse the repository at this point in the history
  • Loading branch information
codding-nepale authored Aug 31, 2024
1 parent 734a3c5 commit 74dad0d
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 74dad0d

Please sign in to comment.