smoothretro82

DominoBot 1.6

Dec 13th, 2025 (edited)
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.64 KB | None | 0 0
  1. // ===== SussyBot =====
  2. const version = 1.6;
  3. w.chat.send(`DominoBot Version ${version} - Type --help for commands`);
  4.  
  5. // ===== Admin List =====
  6. const admins = ["Mike", "dominoguy_"]; // Add admin usernames here
  7.  
  8. // ===== Random trivia/facts =====
  9. function getRandomFact() {
  10. return facts[Math.floor(Math.random() * facts.length)];
  11. }
  12.  
  13. const facts = [
  14. "Honey never spoils. Archaeologists have found edible honey in ancient Egyptian tombs!",
  15. "Bananas are berries, but strawberries are not.",
  16. "Octopuses have three hearts and blue blood.",
  17. "There are more stars in the universe than grains of sand on Earth.",
  18. "A day on Venus is longer than a year on Venus."
  19. ];
  20.  
  21. // ===== 8ball & 9ball answers =====
  22. const answers = [
  23. "It is certain","It is decidedly so","Without a doubt","Yes – definitely",
  24. "You may rely on it","As I see it, yes","Most likely","Outlook good","Yes","Signs point to yes",
  25. "Reply hazy, try again","Ask again later","Better not tell you now","Cannot predict now",
  26. "Concentrate and ask again","Don't count on it","My reply is no","My sources say no",
  27. "Outlook not so good","Very doubtful"
  28. ];
  29.  
  30. const responses9 = [
  31. "The stars are aligned","The universe is conspiring in your favor","Trust your intuition",
  32. "The path is clear","Seek clarity within","Remain patient, the answer will come",
  33. "Possibilities abound, choose wisely","Obstacles may arise, but you have the strength to overcome them",
  34. "Embrace the unknown, it holds great potential"
  35. ];
  36.  
  37. function getAnswer(){ return answers[Math.floor(Math.random()*answers.length)]; }
  38. function get9Answer(){ return responses9[Math.floor(Math.random()*responses9.length)]; }
  39.  
  40. // ===== Count & cooldowns =====
  41. let count = Number(localStorage.getItem('count') || 0);
  42. const commandCooldowns = {};
  43. const cooldownDuration = 0;
  44.  
  45. function isCooldownOver(user, command){
  46. const now = Date.now();
  47. if(!commandCooldowns[user]) commandCooldowns[user] = {};
  48. if(!commandCooldowns[user][command] || now - commandCooldowns[user][command] >= cooldownDuration){
  49. commandCooldowns[user][command] = now;
  50. return true;
  51. }
  52. return false;
  53. }
  54.  
  55. // ===== Handle chat messages =====
  56. w.on("msg", (data) => {
  57. const user = data.nick || "anon";
  58. const msg = data.msg;
  59.  
  60. if(!msg.startsWith("--")) return; // only commands
  61.  
  62. const [command, ...args] = msg.slice(2).trim().split(/\s+/);
  63. const argsStr = args.join(" ");
  64.  
  65. if(!isCooldownOver(user, command.toLowerCase())){
  66. const remaining = ((cooldownDuration - (Date.now() - commandCooldowns[user][command.toLowerCase()])) / 1000).toFixed(1);
  67. w.chat.send(`${user}, Wait ${remaining}s.`);
  68. return;
  69. }
  70.  
  71. switch(command.toLowerCase()){
  72. // ===== Basic commands =====
  73. case "fact":
  74. w.chat.send(getRandomFact());
  75. break;
  76. case "8ball":
  77. w.chat.send(getAnswer());
  78. break;
  79. case "9ball":
  80. w.chat.send(get9Answer());
  81. break;
  82. case "time":
  83. w.chat.send(new Date().toString());
  84. break;
  85. case "count":
  86. count++;
  87. localStorage.setItem('count', count);
  88. w.chat.send(String(count));
  89. break;
  90. case "dice":
  91. case "roll":
  92. const sides = Number(args[0]) || 6;
  93. if(sides < 2 || sides > 100){
  94. w.chat.send(`${user}, choose between 2–100 sides.`);
  95. break;
  96. }
  97.  
  98. const roll = Math.floor(Math.random() * sides) + 1;
  99. w.chat.send(`${user} rolled a ${roll} (1–${sides})`);
  100. break;
  101.  
  102. // ===== Admin-only commands (case-insensitive, trimmed) =====
  103. case "save":
  104. if(!admins.some(a => a.toLowerCase() === user.trim().toLowerCase())){
  105. w.chat.send(`${user}, you don't have permission to use this command.`);
  106. break;
  107. }
  108. const state = { count };
  109. localStorage.setItem('sussyBotState', JSON.stringify(state));
  110. w.chat.send("Bot state saved successfully!");
  111. break;
  112.  
  113. case "load":
  114. if(!admins.some(a => a.toLowerCase() === user.trim().toLowerCase())){
  115. w.chat.send(`${user}, you don't have permission to use this command.`);
  116. break;
  117. }
  118. const savedState = JSON.parse(localStorage.getItem('sussyBotState'));
  119. if(savedState){
  120. count = savedState.count || 0;
  121. localStorage.setItem('count', count);
  122. w.chat.send("Bot state loaded successfully!");
  123. } else w.chat.send("No saved state found.");
  124. break;
  125.  
  126.  
  127. // ===== Help =====
  128. case "help":
  129. const builtIn = "--8ball, --9ball, --time, --fact, --help, --save, --load, More commands to be added soon.";
  130. w.chat.send(`Available commands: ${builtIn}`);
  131. break;
  132.  
  133. default:
  134. w.chat.send(`Unknown command: --${command}`);
  135. break;
  136. }
  137. });
  138.  
Advertisement
Add Comment
Please, Sign In to add comment