Advertisement
Earthcomputer

scriptlist.js

Aug 1st, 2018
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var parts = message.getContent().split(" ");
  2. if (parts.length < 2) {
  3.     channel.message("```\n" + parts[0] + " <commandName> [scriptUrl]\n```");
  4.     return;
  5. }
  6.  
  7. var scripts = storage.get("scriptList");
  8. if (scripts == "null") {
  9.     scripts = {};
  10. } else {
  11.     scripts = JSON.parse(scripts);
  12. }
  13. if (parts.length < 3) {
  14.     if (parts[1] in scripts)
  15.         delete scripts[parts[1]];
  16.     channel.message("Removed script from list");
  17. } else {
  18.     scripts[parts[1]] = parts[2];
  19.     channel.message("Added script to list");
  20. }
  21.  
  22. storage.set("scriptList", JSON.stringify(scripts));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement