iiFireKingii

Help (JS) Database (enmap)

Jan 17th, 2020
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. const Dev = ["حط ايديك هنا"]
  2. const Enmap = require("enmap");
  3. const db = new Enmap({name: "fireking"});
  4. client["on"]('message', message => {
  5. db["ensure"]("help", {
  6. publiccommand: [],
  7. admincommand: [],
  8. gamecommand: []
  9. });
  10. if(message["author"]["bot"]) return undefined;
  11. let args = message["content"]["split"](" ");
  12. if(args[0]["toLowerCase"]() == prefix + `help`) {
  13. if(db["get"]("onoff", "oo") == "off") return message["channel"]["send"]("**❌ | Help is disabled**");
  14. let pc = db["get"]("help", "publiccommand")["join"]("\n")
  15. let ac = db["get"]("help", "admincommand")["join"]("\n")
  16. let gc = db["get"]("help", "gamecommand")["join"]("\n")
  17. message["channel"]["send"](`**Public Command:
  18. ${pc || "No command"}
  19. \`\`-\`\`
  20. Admin Command:
  21. ${ac || "No command"}
  22. \`\`-\`\`
  23. Game Command:
  24. ${gc || "No command"}
  25. \`\`-\`\`**`)
  26. } else if(args[0]["toLowerCase"]() == `enable-help`) {
  27. if(!Dev["includes"](message["author"]["id"])) return undefined;
  28. db["set"]("onoff", "on", "oo")
  29. message["channel"]["send"]("**✅ | Done**")
  30. } else if(args[0]["toLowerCase"]() == prefix + `disable-help`) {
  31. if(!Dev["includes"](message["author"]["id"])) return undefined;
  32. db["set"]("onoff", "off", "oo")
  33. message["channel"]["send"]("**✅ | Done**")
  34. } else if(args[0]["toLowerCase"]() == prefix + `add-public-command`) {
  35. let com = message["content"]["split"](" ")["slice"](1)["join"](" ");
  36. if(!Dev["includes"](message["author"]["id"])) return undefined;
  37. if(!com) return message["channel"]["send"](`**✅ | Using: \`\`${prefix}add-public-command [command | description]\`\`**`);
  38. db["pushIn"]('help', "publiccommand", com);
  39. message["channel"]["send"]("**✅ | Done**")
  40. } else if(args[0]["toLowerCase"]() == prefix + `add-admin-command`) {
  41. let com = message["content"]["split"](" ")["slice"](1)["join"](" ");
  42. if(!Dev["includes"](message["author"]["id"])) return undefined;
  43. if(!com) return message["channel"]["send"](`**✅ | Using: \`\`${prefix}add-admin-command [command | description]\`\`**`);
  44. db["pushIn"]('help', "admincommand", com);
  45. message["channel"]["send"]("**✅ | Done**")
  46. } else if(args[0]["toLowerCase"]() == prefix + `add-game-command`) {
  47. let com = message["content"]["split"](" ")["slice"](1)["join"](" ");
  48. if(!Dev["includes"](message["author"]["id"])) return undefined;
  49. if(!com) return message["channel"]["send"](`**✅ | Using: \`\`${prefix}add-game-command [command | description]\`\`**`);
  50. db["pushIn"]('help', "gamecommand", com);
  51. message["channel"]["send"]("**✅ | Done**")
  52. } else if(args[0]["toLowerCase"]() == prefix + `remove-public-command`) {
  53. let com = message["content"]["split"](" ")["slice"](1)["join"](" ");
  54. if(!Dev["includes"](message["author"]["id"])) return undefined;
  55. if(!com) return message["channel"]["send"](`**✅ | Using: \`\`${prefix}remove-public-command [command | description]\`\`**`);
  56. if(!db["get"]("help", "publiccommand")["includes"](com)) return message["channel"]["send"]("**❌ | I can't find this command**");
  57. db["remove"]("help", com, "publiccommand");
  58. message["channel"]["send"]("**✅ | Done**")
  59. } else if(args[0]["toLowerCase"]() == prefix + `remove-admin-command`) {
  60. let com = message["content"]["split"](" ")["slice"](1)["join"](" ");
  61. if(!Dev["includes"](message["author"]["id"])) return undefined;
  62. if(!com) return message["channel"]["send"](`**✅ | Using: \`\`${prefix}remove-admin-command [command | description]\`\`**`);
  63. if(!db["get"]("help", "admincommand")["includes"](com)) return message["channel"]["send"]("**❌ | I can't find this command**");
  64. db["remove"]("help", com, "admincommand");
  65. message["channel"]["send"]("**✅ | Done**")
  66. } else if(args[0]["toLowerCase"]() == prefix + `remove-game-command`) {
  67. let com = message["content"]["split"](" ")["slice"](1)["join"](" ");
  68. if(!Dev["includes"](message["author"]["id"])) return undefined;
  69. if(!com) return message["channel"]["send"](`**✅ | Using: \`\`${prefix}remove-game-command [command | description]\`\`**`);
  70. if(!db["get"]("help", "gamecommand")["includes"](com)) return message["channel"]["send"]("**❌ | I can't find this command**");
  71. db["remove"]("help", com, "gamecommand");
  72. message["channel"]["send"]("**✅ | Done**")
  73. }
  74. });
Advertisement
Add Comment
Please, Sign In to add comment