[Reviewed] fix: update commands path in deploy-commands.js (Item 1)#32
Open
slendereater-sketch wants to merge 1 commit into
Open
[Reviewed] fix: update commands path in deploy-commands.js (Item 1)#32slendereater-sketch wants to merge 1 commit into
slendereater-sketch wants to merge 1 commit into
Conversation
This was referenced Apr 29, 2026
TrivCodez
requested changes
Apr 29, 2026
Contributor
TrivCodez
left a comment
There was a problem hiding this comment.
🔍 Pull Request Review — Issue #1
Thanks for fixing the incorrect path, @slendereater-sketch. This is an important bug fix that resolves a core setup issue.
🔍 Changes Reviewed
- Path fix:
commands→slashcommandsis correct and matches the actual directory structure - Files modified:
src/deploy-commands.js(1 line change)
🚨 Critical — BLOCKING MERGE
Missing Directory Existence Check
- If the
slashcommands/directory doesn't exist,fs.readdirSync()will throwENOENTand crash the deployment script - This is especially important for a deployment script that new users might run before creating any commands
- Fix Required: Add defensive error handling:
const commandsPath = path.join(__dirname, 'slashcommands');
+// Check if directory exists before reading
+if (!fs.existsSync(commandsPath)) {
+ console.warn(`[Warning]: ${commandsPath} does not exist. No commands to deploy.`);
+ return;
+}
+
const commandFiles = fs.readdirSync(commandsPath).filter(f => f.endsWith('.js'));Alternative: Wrap in try/catch:
let commandFiles;
try {
commandFiles = fs.readdirSync(commandsPath).filter(f => f.endsWith('.js'));
} catch (error) {
console.error(`[Error]: Failed to read commands directory:`, error.message);
process.exit(1);
}🟡 Minor Issues
No newline at EOF
- Ensures consistency across project files
- Add final newline to avoid
"\ No newline at end of file"marker
💡 Suggestions
Error Message Clarity
- Current generic
console.error(error)in catch block doesn't provide context - Improve to:
console.error('[Error]: Failed to deploy commands:', error.message);
✅ Good
- Simple, targeted fix that addresses the core issue
- Clean diff with no unnecessary changes
- Aligns with the project's bounty issue #21 Item #1
🔍 Verification Steps
- Run
node src/deploy-commands.jswhensrc/slashcommands/exists → success - Run
node src/deploy-commands.jswhensrc/slashcommands/is missing → should warn, not crash
⚖️ Verdict: REQUEST CHANGES
The path correction is correct, but the script needs defensive error handling to prevent crashes on missing directories. This is critical for user experience, especially for new bot developers setting up the project for the first time.
This was referenced Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Item 1 in Issue #21. The deployment script was referencing a non-existent 'commands' directory instead of 'slashcommands'.