-
Notifications
You must be signed in to change notification settings - Fork 12
[Reviewed] fix: add folder existence checks (Item 3) #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,10 @@ const path = require('path'); | |||||||||||||||||
|
|
||||||||||||||||||
| const commands = []; | ||||||||||||||||||
| const commandsPath = path.join(__dirname, 'commands'); | ||||||||||||||||||
| if (!fs.existsSync(commandsPath)) { | ||||||||||||||||||
| console.warn(`[WARNING] Commands directory missing at ${commandsPath}. Auto-creating it.`); | ||||||||||||||||||
| fs.mkdirSync(commandsPath, { recursive: true }); | ||||||||||||||||||
|
Comment on lines
7
to
+10
|
||||||||||||||||||
| const commandsPath = path.join(__dirname, 'commands'); | |
| if (!fs.existsSync(commandsPath)) { | |
| console.warn(`[WARNING] Commands directory missing at ${commandsPath}. Auto-creating it.`); | |
| fs.mkdirSync(commandsPath, { recursive: true }); | |
| const commandsPath = path.join(__dirname, 'slashcommands'); | |
| if (!fs.existsSync(commandsPath)) { | |
| console.error(`[ERROR] Slash commands directory missing at ${commandsPath}. Aborting command deployment.`); | |
| process.exit(1); |
Copilot
AI
Apr 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title/description says "Fixes #3", but the referenced Issue #3 is about adding an /avatar slash command. This change is about directory existence checks (matching bounty-board item #21.3 instead). Please update the PR metadata (title/body/linked issue) so it closes the correct issue and doesn’t incorrectly resolve the avatar feature request.
Copilot
AI
Apr 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider failing fast (non-zero exit) when the commands directory is missing or when no command files are found, rather than auto-creating the directory and continuing. As written, a CI/CD misconfiguration (wrong working dir, missing volume mount, etc.) can silently deploy an empty command set and wipe existing registered commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fs.mkdirSync(eventsPath, { recursive: true })can still throw (e.g., read-only filesystem, missing permissions). Since the intent is "warn and keep running", wrap the mkdir in try/catch (and consider returning early or exiting) so the bot doesn’t crash with an unhandled exception when it can’t create the directory.