Fix to load commands code #8

Closed
opened 2026-01-06 03:35:13 +01:00 by csxkdv · 1 comment
Owner
  • Currently, the bot works by loading commands that are in folder src/commands. But after a certain amount of files it can be overwhelming to read.

  • This opens the possibility of folders inside commands folder (src/commands/economy, src/commands/testing).

  • Therefore, the current code can fail upon loading commands.

  • A fix should be made to load commands either from commands folder and its subfolders

- Currently, the bot works by loading commands that are in folder `src/commands`. But after a certain amount of files it can be overwhelming to read. - This opens the possibility of folders inside `commands` folder (`src/commands/economy`, `src/commands/testing`). - Therefore, the current code can fail upon loading commands. - A fix should be made to load commands either from `commands` folder and its subfolders
csxkdv added this to the FrugalityBot - Code project 2026-01-06 03:35:13 +01:00
csxkdv changed title from Commands folder can fail if folders are created inside it to Fix to load commands code 2026-01-06 03:37:15 +01:00
csxkdv added a new dependency 2026-01-06 18:30:06 +01:00
csxkdv removed a dependency 2026-01-06 18:30:13 +01:00
csxkdv moved this to In progress in FrugalityBot - Code on 2026-01-06 18:59:39 +01:00
Author
Owner

Fixed by updating the Dir lookup.

Dir["#{File.dirname(__FILE__)}/commands/**/*.rb"].each

This looks for .rb files inside src/commands and src/commands/subfolder.

Fixed by updating the Dir lookup. `Dir["#{File.dirname(__FILE__)}/commands/**/*.rb"].each` This looks for `.rb` files inside `src/commands` and `src/commands/subfolder`.
csxkdv moved this to Approved in FrugalityBot - Code on 2026-01-06 19:09:57 +01:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: csxkdv/FrugalityBot#8