Closed AnshumanMahato closed 2 years ago
Awesome, I will look on it tomorrow. Good job !
@AnshumanMahato Delete everything inside legacy code (include the folder)
@cachecleanerjeet sure. Will do it tomorrow 😊
@cachecleanerjeet, I removed the Legacy Code directory as was asked by you
@AnshumanMahato Delete everything inside legacy code (include the folder)
@AnshumanMahato Please change the version in package.json
(1.5.0 > 2.0.0)
@cachecleanerjeet done
@cachecleanerjeet
Changelog
Command Handler
Added a Command Handler function in place of the current if-else based command management structure. This makes command handling dynamic and also allows for better code management. Though the current if-else system is functional, it has some drawbacks:
The command handler resolves these issues. It dynamically loads all the command files at runtime from the command folder in a Map.
When the user gives the command message, the handler separates the commands and the arguments. Then it checks for the command and executes it if available. If it's not, then the user is notified.
Hence we don't need to update the main.js to add new commands. All we need to do is create a command file and add it to the command folder. We don't need to update the main.js and help.js every time. "main.js" does not require any updating in most cases, and help.js is automatically generated. It makes the system more modular as now commands are separate independent entities. The template for command files is present in the command_template.js
Issues
Note
Previous version of the code is saved in the Legacy Code directory for reference purposes...