IllusionaryOne

Untitled

Jun 1st, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. If I were adding a way to let each individual have their own command, in a hurry, and to be customizable, and not overwritten each release, I would probably do something like the following to minimize the amount of changes to the core processing:
  2.  
  3. 1) Clone customCommands.js as scripts/custom/customUserCommands.js
  4. 2) Rename the commands for addcom and delcom and editcom.
  5. 3) Store the commands in a new database table - store with a section of the user, key of the command, value of what to execute.
  6. 4) Get rid of pricecom and all other items that are not needed.
  7. 5) Do not bind to command, place that in a function instead. This function will need to check not just what the event object is that is passed, but will need to query the DB by section for the user to get commands that they created and are allowed to run. Returns true if a command was found and executed, false if not.
  8. 6) If you wish to create commands on behalf of the user, then the add/del/edit related commands have to be modified to do so.
  9. 7) Modify init.js api-command @event handler to call the function that was created to handle this. Place near the top of the function, before any checks are done. If the function returns true, exit the function.
  10.  
  11. This probably isn't the best way to implement it, just a quick idea off the cuff.
Advertisement
Add Comment
Please, Sign In to add comment