Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ===== SussyBot =====
- const version = 1.6;
- w.chat.send(`DominoBot Version ${version} - Type --help for commands`);
- // ===== Admin List =====
- const admins = ["Mike", "dominoguy_"]; // Add admin usernames here
- // ===== Random trivia/facts =====
- function getRandomFact() {
- return facts[Math.floor(Math.random() * facts.length)];
- }
- const facts = [
- "Honey never spoils. Archaeologists have found edible honey in ancient Egyptian tombs!",
- "Bananas are berries, but strawberries are not.",
- "Octopuses have three hearts and blue blood.",
- "There are more stars in the universe than grains of sand on Earth.",
- "A day on Venus is longer than a year on Venus."
- ];
- // ===== 8ball & 9ball answers =====
- const answers = [
- "It is certain","It is decidedly so","Without a doubt","Yes – definitely",
- "You may rely on it","As I see it, yes","Most likely","Outlook good","Yes","Signs point to yes",
- "Reply hazy, try again","Ask again later","Better not tell you now","Cannot predict now",
- "Concentrate and ask again","Don't count on it","My reply is no","My sources say no",
- "Outlook not so good","Very doubtful"
- ];
- const responses9 = [
- "The stars are aligned","The universe is conspiring in your favor","Trust your intuition",
- "The path is clear","Seek clarity within","Remain patient, the answer will come",
- "Possibilities abound, choose wisely","Obstacles may arise, but you have the strength to overcome them",
- "Embrace the unknown, it holds great potential"
- ];
- function getAnswer(){ return answers[Math.floor(Math.random()*answers.length)]; }
- function get9Answer(){ return responses9[Math.floor(Math.random()*responses9.length)]; }
- // ===== Count & cooldowns =====
- let count = Number(localStorage.getItem('count') || 0);
- const commandCooldowns = {};
- const cooldownDuration = 0;
- function isCooldownOver(user, command){
- const now = Date.now();
- if(!commandCooldowns[user]) commandCooldowns[user] = {};
- if(!commandCooldowns[user][command] || now - commandCooldowns[user][command] >= cooldownDuration){
- commandCooldowns[user][command] = now;
- return true;
- }
- return false;
- }
- // ===== Handle chat messages =====
- w.on("msg", (data) => {
- const user = data.nick || "anon";
- const msg = data.msg;
- if(!msg.startsWith("--")) return; // only commands
- const [command, ...args] = msg.slice(2).trim().split(/\s+/);
- const argsStr = args.join(" ");
- if(!isCooldownOver(user, command.toLowerCase())){
- const remaining = ((cooldownDuration - (Date.now() - commandCooldowns[user][command.toLowerCase()])) / 1000).toFixed(1);
- w.chat.send(`${user}, Wait ${remaining}s.`);
- return;
- }
- switch(command.toLowerCase()){
- // ===== Basic commands =====
- case "fact":
- w.chat.send(getRandomFact());
- break;
- case "8ball":
- w.chat.send(getAnswer());
- break;
- case "9ball":
- w.chat.send(get9Answer());
- break;
- case "time":
- w.chat.send(new Date().toString());
- break;
- case "count":
- count++;
- localStorage.setItem('count', count);
- w.chat.send(String(count));
- break;
- case "dice":
- case "roll":
- const sides = Number(args[0]) || 6;
- if(sides < 2 || sides > 100){
- w.chat.send(`${user}, choose between 2–100 sides.`);
- break;
- }
- const roll = Math.floor(Math.random() * sides) + 1;
- w.chat.send(`${user} rolled a ${roll} (1–${sides})`);
- break;
- // ===== Admin-only commands (case-insensitive, trimmed) =====
- case "save":
- if(!admins.some(a => a.toLowerCase() === user.trim().toLowerCase())){
- w.chat.send(`${user}, you don't have permission to use this command.`);
- break;
- }
- const state = { count };
- localStorage.setItem('sussyBotState', JSON.stringify(state));
- w.chat.send("Bot state saved successfully!");
- break;
- case "load":
- if(!admins.some(a => a.toLowerCase() === user.trim().toLowerCase())){
- w.chat.send(`${user}, you don't have permission to use this command.`);
- break;
- }
- const savedState = JSON.parse(localStorage.getItem('sussyBotState'));
- if(savedState){
- count = savedState.count || 0;
- localStorage.setItem('count', count);
- w.chat.send("Bot state loaded successfully!");
- } else w.chat.send("No saved state found.");
- break;
- // ===== Help =====
- case "help":
- const builtIn = "--8ball, --9ball, --time, --fact, --help, --save, --load, More commands to be added soon.";
- w.chat.send(`Available commands: ${builtIn}`);
- break;
- default:
- w.chat.send(`Unknown command: --${command}`);
- break;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment