Skip to content

Handle non existent commands during development#214

Open
xLuxy wants to merge 1 commit intoTCCPP:mainfrom
xLuxy:features/command-improvement
Open

Handle non existent commands during development#214
xLuxy wants to merge 1 commit intoTCCPP:mainfrom
xLuxy:features/command-improvement

Conversation

@xLuxy
Copy link
Copy Markdown
Contributor

@xLuxy xLuxy commented Mar 17, 2026

Currently, when freestanding is set to true and you try to use a command which is not registered the bot will throw an exception. (I've used the modlogs command for testing)

This PR fixes that by adding a missing return statement.

As a small improvement to this, i've also added a response to whenever a command has not been registered which can help during development.

Context:

🛑 [2026.03.17 20:18:25.763] [error] TypeError: Cannot read properties of undefined (reading 'options')
    at CommandHandler.handle_slash_comand (file:///D:/dev/wheatley/build/src/command-handler.js:157:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
    at async CommandHandler.on_interaction (file:///D:/dev/wheatley/build/src/command-handler.js:331:17)
Error
  TypeError: Cannot read properties of undefined (reading 'options')
      at CommandHandler.handle_slash_comand (file:///D:/dev/wheatley/build/src/command-handler.js:157:28)
      at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
      at async CommandHandler.on_interaction (file:///D:/dev/wheatley/build/src/command-handler.js:331:17)
  Trace
      at M.error (file:///D:/dev/wheatley/build/src/utils/debugging-and-logging.js:61:17)
      at Wheatley.critical_error (file:///D:/dev/wheatley/build/src/wheatley.js:229:15)
      at CommandHandler.on_interaction (file:///D:/dev/wheatley/build/src/command-handler.js:405:31)
      at process.processTicksAndRejections (node:internal/process/task_queues:104:5)

@xLuxy xLuxy force-pushed the features/command-improvement branch from 28cb601 to 288d210 Compare March 17, 2026 19:21
@sonarqubecloud
Copy link
Copy Markdown

@xLuxy xLuxy changed the title Fix non existent command handling from crashing the bot Handle non existent commands during development Mar 17, 2026
@Rinzii
Copy link
Copy Markdown
Contributor

Rinzii commented Mar 18, 2026

Iirc #210 partially already handles this, but I'd say this should expand on what I did in that PR well so PR is still valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants