Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const versionString = "Brisbane V3.3.3 by katiserie (C) 2025-2026";
- const admins = ["katiserie","e_g.","gimmickCellar"]; // include your realUsername in the list and exclude any unwanted admins
- const fishingChances = {"small_fish": 500, "big_fish": 300, "scrap_metal": 100, "gold_nugget": 5} // lower number = lower chance
- var shopItems = {"coin": 40, "fishing_rod": 100, "small_fish": 20, "big_fish": 50, "scrap_metal": 100, "gold_nugget": 1000} // any shop items lie here
- var prophetbot = {};
- var shopItemEntries = Object.entries(shopItems);
- var shopItemNames = [];
- for (i=0;i<shopItemEntries.length;i++) {
- shopItemNames[i] = shopItemEntries[i][0];
- }
- var prefix = "b!";
- var prefix2 = "β";
- var started = false;
- var tellonly = false;
- var savedPeople = [];
- var botUser = {nick: `Brisbane (${prefix2}help/${prefix}help)`, color: "#E4B3FF"}; // feel free to customize
- var pageSize = 3; // maximum of n items in a page (for pagination)
- var cooldowns = {general: 8, fishing: 48, work: 72};
- var cooldownMults = {location: {page: 0.25, global:0.25}, user: {}};
- var chatworld = window.location.href;
- var universal_cmd_enabled = false;
- function unixInSecs() { // returns current unix timestamp in seconds
- return Math.round(Date.now()/1000);
- }
- var startTimestamp = new Date(Date.now().toString());
- function newPerson(user, userid, bal, lastMsg) { // adds a new person to the database
- let personObject = {username: user, id: userid, name: null, balance: bal, timestamp: lastMsg, cooldowns: {work: 50, fish: 30, general: 10}, inventory: {}, banProps: {banned: false, until: 0}, tips: {cooldown: false}}
- if(personObject.username) {
- personObject.name = personObject.username;
- } else {
- personObject.name = personObject.id;
- }
- console.log(`New user created: [${userid}]${user}.`);
- return personObject;
- }
- function findUser(user2find,userid2find) { // finds user by id or realUsername
- let foundUser = savedPeople.find(({ username }) => username === user2find);
- if (foundUser == undefined) {
- foundUser = savedPeople.find(({ id }) => id === userid2find);
- }
- return foundUser;
- }
- function findByName(name2find) {
- let foundUser = savedPeople.find(({ name }) => name === name2find);
- return foundUser;
- }
- function randint(min,max) { // returns random integer
- return Math.round(Math.random()*(max-min))+min;
- }
- function handleBal(name, userid, bal, silent, loct, tell) { // handles the balance and creation of users
- let personModel = findByName(name);
- if(personModel != undefined) {
- bal = personModel.balance;
- }
- if(silent == true){
- console.log(`${name} has ${bal}H in their bank account.`,loct, tell, userid);
- } else {
- sendMsg(`${name} has ${bal}H in their bank account.`,loct, tell, userid);
- }
- if (personModel == undefined) {
- newPerson(name, userid, bal, unixInSecs());
- }
- }
- function handleProphecy(thing,victim,loc,tell,id) {
- if (prophetbot[thing] === undefined) {
- prophetbot[thing] = {};
- if (prophetbot[thing][victim] === undefined) prophetbot[thing][victim] = randint(0,100);
- } else {
- if (prophetbot[thing][victim] === undefined) prophetbot[thing][victim] = randint(0,100);
- }
- sendMsg(`[${victim} is ${prophetbot[thing][victim]}% ${thing}]`,loc,tell,id);
- }
- function sendMsg(msg, loct, tell, userid) { // sends message unless bot is offline
- console.log(`message: ${msg}, location: ${loct}, tell: ${tell}, id: ${userid}`)
- if (started && tell != "to_me" && tellonly == false) {
- socket.send(JSON.stringify({kind: "chat", nickname: botUser.nick, message: `${msg}`, location: loct, color: botUser.color}));
- } else if(started && tell == "to_me") {
- socket.send(JSON.stringify({kind: "chat", nickname: botUser.nick, message: `/tell ${userid} ${msg}`, location: loct, color: botUser.color}));
- } else if(started) {
- socket.send(JSON.stringify({kind: "chat", nickname: botUser.nick, message: `/tell ${userid} You must use the /tell command`, location: loct, color: botUser.color}));
- } else {
- console.log(`There was an attempt to send "${msg}" while the bot was offline`);
- }
- }
- function balMod(user,amount) { // changes a user's balance unless bot is offline
- if (started && !isNaN(safeParseInt(amount))) {
- user.balance = safeParseInt(user.balance) + safeParseInt(amount);
- console.log(`Script added ${amount} to ${user.name}'s bank account`)
- } else if (started) {
- console.error(`Could not add ${amount} to ${user.name}'s bank account`)
- }
- }
- function invAdd(item,amount,user,ModBal) {
- if (!isNaN(safeParseInt(amount)) && amount >= -Math.abs(amount)) {
- user.inventory[item] = (safeParseInt(amount) + safeParseInt(user.inventory[item]));
- if (ModBal) {balMod(user,-shopItems[item]*amount)};
- console.log(`Script bought ${amount} items.`)
- } else {
- console.error(`Could not add ${amount} to ${user.name}'s inventory.`)
- }
- if (isNaN(safeParseInt(user.inventory[item]))) {
- user.inventory[item] = amount;
- }
- }
- function safeParseInt(int) { // parseint which throws an error
- let parsedInt = parseInt(int);
- if (!isNaN(parsedInt)) {
- if (parsedInt == Infinity) {
- return parseInt(0);
- } else {
- return parseInt(parsedInt);
- }
- } else {
- console.error("THAT IS NOT WHERE A STRING GOES YOU IDIOT");
- return parseInt(0);
- }
- }
- w.on("chat", function (data) {
- if (data.id == 0) return;
- var loc = data.location;
- var persid = data.id;
- var totell = data.dataObj.privateMessage;
- var person2find = data.realUsername || data.id
- var person = findByName(person2find);
- var args = data.message.split(" ");
- var personName = args[1];
- var foundPerson = findByName(personName);
- var personBal = 0;
- let page = 1;
- let maxPage = 999;
- console.log(totell);
- if (person == undefined && data.dataObj.privateMessage != "from_me") {
- var bal = 50;
- person = newPerson(data.realUsername, data.id, bal, unixInSecs());
- savedPeople.push(person);
- }
- if (args[0].startsWith(prefix) || args[0].startsWith(prefix2)){
- cmd = args[0].replace(prefix,"");
- cmd = cmd.replace(prefix2,"");
- } else {
- cmd = undefined;
- }
- if(cmd != undefined && unixInSecs() > person.cooldowns.general) {
- person.cooldowns.general = unixInSecs() + cooldowns.general*cooldownMults.location[data.location]*(cooldownMults.user[person] || 1);
- switch (cmd.toLowerCase()) {
- case "bal":
- if (personName == null) {
- handleBal(person2find, findByName(person2find).id, findByName(person2find).balance,false,loc,totell,persid);
- } else {
- personBal = foundPerson.balance
- if (!personBal) return sendMsg("Nobody exists with that username or ID.");
- handleBal(personName, foundPerson.id, personBal, false,loc,totell,persid);
- }
- break;
- case "donate":
- let cashAmt = safeParseInt(args[2])
- if (personName == null) {
- sendMsg("You must specify a person to donate to.",loc,totell,persid)
- } else if (args[2] == null) {
- sendMsg("You must specify an amount to donate.",loc,totell,persid)
- } else if (personName == data.realUsername || personName == data.id) {
- sendMsg("You cannot donate to yourself.",loc,totell,persid)
- } else if (safeParseInt(cashAmt) < 0) {
- sendMsg("You cannot donate a negative amount of money to a person.",loc,totell,persid)
- } else if (safeParseInt(cashAmt) > safeParseInt(person.balance)) {
- sendMsg("You cannot donate more than you have in your bank account.",loc,totell,persid)
- } else if (cashAmt == Infinity) {
- sendMsg("You cannot donate an infinite amount of coins",loc,totell,persid)
- } else if (isNaN(cashAmt)) {
- sendMsg("Invalid amount of coins to donate.",loc,totell,persid)
- } else {
- balMod(person, -cashAmt);
- balMod(foundPerson, cashAmt);
- sendMsg(`You donated ${args[2]} to ${foundPerson.name}`,loc,totell,persid)
- }
- break;
- case "cf":
- case "coinflip":
- let bets = args.slice(1);
- let cfMsg = ``;
- if(!person.inventory["coin"]) {
- sendMsg(`To obtain a coin, execute ${prefix}buy coin (Cost: 40H).`,loc,totell,persid);
- } else if (bets.length > person.inventory["coin"]) {
- sendMsg(`You cannot flip more coins than you have in your inventory. \n execute ${prefix}buy coin to obtain one (40H).`,loc,totell,persid);
- } else if (bets.length > pageSize) {
- let betsAmt = {won: 0, lost: 0, error: 0}
- let totalAmt = 0;
- let amtWon = 0;
- for (betAmt of bets) {
- totalAmt += safeParseInt(betAmt);
- }
- if (totalAmt > person.balance) {
- sendMsg("You cannot bet more than you have in your bank account.",loc,totell,persid);
- } else {
- for (betAmt of bets) {
- betAmt = safeParseInt(betAmt);
- if (betAmt < 0 || betAmt == Infinity || isNaN(betAmt)) {
- betsAmt.error++
- } else {
- let rand = Math.random();
- if (rand >= 0.5) {
- betsAmt.won++
- amtWon += betAmt;
- } else {
- betsAmt.lost++
- amtWon -= betAmt;
- }
- }
- }
- }
- sendMsg(`Flipped ${betsAmt.length} coins. You had ${betsAmt.won} wins and ${betsAmt.lost} losses, amounting to ${amtWon}H. You encountered ${betsAmt.error} errors.`,loc,totell,persid);
- } else {
- let totalAmt = 0;
- for (betAmt of bets) {
- totalAmt += safeParseInt(betAmt);
- }
- if (totalAmt > person.balance) {
- sendMsg("You cannot bet more than you have in your bank account.",loc,totell,persid);
- } else {
- for (betAmt of bets) {
- betAmt = safeParseInt(betAmt);
- if (betAmt < 0) {
- cfMsg += "Not flipped: Negative bet amount.\n";
- } else if (betAmt == Infinity) {
- cfMsg += "Not flipped: Too large.\n";
- } else if (isNaN(betAmt)) {
- cfMsg += "Not flipped: Invalid bet amount.\n";
- } else {
- let rand = Math.random();
- if (rand >= 0.5) {
- cfMsg += `Coinflip won! Earned ${betAmt}H.\n`
- balMod(person, betAmt);
- } else {
- cfMsg += `Coinflip lost! Lost ${betAmt}H.\n`
- balMod(person, -betAmt);
- }
- }
- }
- }
- sendMsg(cfMsg,loc,totell,persid);
- }
- break;
- case "work":
- if (person.cooldowns.work-unixInSecs() <= 0) {
- console.log(person.cooldowns.work-unixInSecs());
- profit = randint(25,50);
- balMod(person,profit);
- person.cooldowns.work = unixInSecs() + cooldowns.work*cooldownMults.location[data.location]*(cooldownMults.user[person] || 1);
- sendMsg(`You have worked and earned ${profit}H. You can work again in ${person.cooldowns.work-unixInSecs()} seconds.`,loc,totell,persid)
- } else {
- sendMsg(`You can work again in ${person.cooldowns.work-unixInSecs()} seconds.`,loc,totell,persid)
- }
- break;
- case "baltop":
- let sortedPeople = savedPeople.slice().sort((a,b) => b.balance - a.balance);
- if (args[1]) page = args[1];
- maxPage = Math.ceil(page/pageSize);
- let leaderboardMsg = `Users by balance: \n`;
- if (page > maxPage) leaderboardMsg = `Invalid page.`;;
- for (let i = pageSize*(page-1); i < pageSize*page; i++) {
- leaderboardMsg+= `${i+1}. ${sortedPeople[i].name} - ${sortedPeople[i].balance}H \n`;
- }
- leaderboardMsg += `Page ${page.toString()} of ${Math.ceil(sortedPeople.length/pageSize).toString()}. `
- if (page == 1) {leaderboardMsg += `Use ${prefix}baltop [page] to view other pages.`};
- sendMsg(leaderboardMsg,loc,totell,persid);
- break;
- case "inv":
- let invMsg = ``;
- if (args[2]) page = args[2];
- maxPage = Math.ceil(page/pageSize);
- if (page > maxPage) invMsg = `Invalid page.`;
- if (personName == null) {
- let inventory = person.inventory;
- let partialInv = inventory.slice((page-1)*pageSize,page*pageSize);
- invMsg = `Your inventory (Page ${page} of ${Math.ceil(inventory.length/pageSize)}): \n`;
- if (person.inventory != {}) {
- for (let[key, value] of Object.entries(partialInv)) {
- invMsg += `${key} - ${value}\n`;
- }
- } else {
- invMsg += `No items, only us crickets 3:.`;
- }
- } else if (foundPerson) {
- let inventory = foundPerson.inventory;
- let partialInv = Object.entries(inventory).slice((page-1)*pageSize,page*pageSize);
- invMsg = `${foundPerson.name}'s inventory (Page ${page} of ${Math.ceil(inventory.length/pageSize)}): \n`
- if (person.inventory != {}) {
- for (let[key, value] of partialInv) {
- invMsg += `${key} - ${value}\n`;
- }
- } else {
- invMsg += `${foundPerson.name} has no items here.`;
- }
- } else {
- invMsg = `Could not find ${personName}.`;
- }
- sendMsg(invMsg,loc,totell,persid);
- break;
- case "shop":
- if (args[1]) page = args[1];
- let shopMsg;
- maxPage = Math.ceil(Object.entries(shopItems).length/pageSize);
- if (page > maxPage) shopMsg = `Invalid page.`;
- let partialShopItems = Object.entries(shopItems).slice((page-1)*pageSize,page*pageSize);
- shopMsg = `Items in shop (Page ${page} of ${Math.ceil(shopItems.length/pageSize)}): \n`
- for (let[key, value] of partialShopItems) {
- shopMsg += `${key} - ${value}\n`;
- }
- shopMsg += `${prefix}buy [item] to buy, b!shop [page] to view other pages.`
- sendMsg(shopMsg,loc,totell,persid)
- break;
- case "buy":
- item = args[1];
- amount = args[2] || 1;
- if (item == null) {
- sendMsg("You must specify an item to buy.",loc,totell,persid);
- } else if (shopItemNames.indexOf(args[1]) == -1) {
- sendMsg(`Item ${item} does not exist.`)
- } else if (shopItems[item]*amount > person.balance) {
- sendMsg(`You cannot afford ${amount} ${item}s.`,loc,totell,persid);
- } else {
- sendMsg(`Bought ${amount} ${item}s succesfully.`,loc,totell,persid)
- invAdd(item,amount,person,true);
- }
- break;
- case "sell":
- item = args[1];
- amount = args[2] || 1;
- if (item == null) {
- sendMsg("You must specify an item to sell.",loc,totell,persid);
- } else if (person.inventory[item] < amount) {
- sendMsg(`You do not have enough ${item}s to sell ${amount} of them.`,loc,totell,persid);
- } else {
- sendMsg(`Sold ${amount} ${item}s succesfully.`,loc,totell,persid)
- invAdd(item,-amount,person,true);
- }
- break;
- case "fish":
- fishChanceList = Object.values(fishingChances);
- fishChanceTotal = 0;
- caughtSmth = false;
- for (fishChance of fishChanceList) {
- fishChanceTotal += fishChance
- };
- if (person.inventory["fishing_rod"] >= 1 && person.cooldowns.fish-unixInSecs() <= 0) {
- fishChanceInt = randint(0, fishChanceTotal);
- totalValue = 0;
- for (let[key,value] of Object.entries(fishingChances)) {
- totalValue += value;
- if (fishChanceInt < totalValue) {
- caughtSmth = true;
- person.cooldowns.fish = unixInSecs() + cooldowns.fishing*cooldownMults.location[data.location]*(cooldownMults.user[person] || 1);
- invAdd(key,1,person,false);
- sendMsg(`Congrats! You have caught a ${key}. ${prefix}sell ${key} to sell. You can fish again in ${person.cooldowns.fish-unixInSecs()} seconds`,loc,totell,persid);
- break;
- }
- }
- if (!caughtSmth) {
- sendMsg(`Unfortunately, you haven't caught anything. Better luck next time!`,loc,totell,persid);
- }
- } else if (person.inventory["fishing_rod"] >= 1) {
- sendMsg(`You can fish again in ${person.cooldowns.fish-unixInSecs()} seconds.`,loc,totell,persid);
- } else {
- sendMsg("You must buy a fishing rod from the shop to fish.",loc,totell,persid);
- }
- break;
- case "paw":
- var victim = args.slice(1).join(" ");
- if (victim == null) {
- sendMsg("You must specify someone to paw at.",loc,totell,persid)
- } else {
- sendMsg(`${person.name} has pawed at ${victim} :3.`,loc,totell,persid)
- }
- break;
- case "claw":
- var victim = args.slice(1).join(" ");
- if (victim == null) {
- sendMsg("You must specify someone to claw at.",loc,totell,persid)
- } else {
- sendMsg(`${person.name} has clawed at ${victim} 3:<.`,loc,totell,persid)
- }
- break;
- case cmd.startsWith('how') ? cmd : false :
- let thing;
- var victim;
- if (cmd == "how") {
- thing = args[1];
- victim = args.slice(2).join(" ");
- } else {
- thing = cmd.replace("how","");
- victim = args.slice(1).join(" ");
- }
- if (thing == null) {
- sendMsg("You must specify something.",loc,totell,persid)
- } else if (victim == null) {
- sendMsg("You must specify someone.",loc,totell,persid);
- } else {
- handleProphecy(thing,victim,loc,totell,persid);
- }
- break;
- case "vers":
- sendMsg(versionString,loc,totell,persid);
- break;
- case "cooldowns":
- let cdMsg = ``;
- for (let[key,value] of Object.entries(cooldowns)) {
- cdMsg += `${key} cooldown: ${value*cooldownMults.location[data.location]*(cooldownMults.user[person] || 1)} \n`;
- }
- sendMsg(cdMsg,loc,totell,persid);
- break;
- case "rate":
- let rating;
- let ratingScore = randint(0,100);
- if (ratingScore > 98) {
- rating = "flawless";
- } else if (ratingScore > 90) {
- rating = "awesome";
- } else if (ratingScore > 85) {
- rating = "excellent";
- } else if (ratingScore > 80) {
- rating = "great";
- } else if (ratingScore > 60) {
- rating = "good";
- } else if (ratingScore > 40) {
- rating = "neutral";
- } else if (ratingScore > 25) {
- rating = "bad";
- } else if (ratingScore > 15) {
- rating = "awful";
- } else if (ratingScore > 5) {
- rating = "horrible";
- } else {
- rating = "catastrophic";
- }
- sendMsg(`I think ${args.slice(1).join(" ")} is ${rating}`,loc,totell,persid);
- break;
- case "choose":
- if (!args[1]) {
- sendMsg(`I don't have anything to choose, so I choose pikachu!`,loc,totell,persid);
- break;
- }
- sendMsg(`I choose ${args[randint(1,args.length)]}`,loc,totell,persid);
- break;
- case "ark":
- case "bark":
- let barkLetters = ["w","r","u","b"];
- let barkAmt = args[1] ? args[1] : 2;
- let barkingMsg = "";
- let letterAmt;
- for (i=1;i<=barkAmt;i++) {
- barkingMsg += (Math.random() > 0.5 ? "r" : "a");
- letterAmt = randint(3,6);
- for (j=1;j<=letterAmt;j++) {
- barkingMsg += barkLetters[randint(0,barkLetters.length-1)];
- }
- barkingMsg += (Math.random() > 0.5 ? "ff" : "");
- if (i!=barkAmt) barkingMsg += " ";
- }
- sendMsg(barkingMsg,loc,totell,persid);
- break;
- case "meow":
- let meowLetters = ["m","r","w","o","e","k","'","a"];
- let meowAmt = args[1] ? args[1] : 1;
- let meowingMsg = "";
- let letterAmt2;
- for (i=1;i<=meowAmt;i++) {
- meowingMsg += (Math.random() > 0.5 ? "m" : "r");
- letterAmt2 = randint(2,6);
- for (j=1;j<=letterAmt2;j++) {
- meowingMsg += meowLetters[randint(0,meowLetters.length-1)];
- }
- meowingMsg += (Math.random() > 0.5 ? "pp" : "");
- if (i!=meowAmt) meowingMsg += " ";
- }
- sendMsg(meowingMsg,loc,totell,persid);
- break;
- case "help":
- if(!args[1]) {
- sendMsg(`For commands, run the following after ${cooldowns.general*cooldownMults.location[data.location]*(cooldownMults.user[person] || 1)} seconds: ${prefix}help info, ${prefix}help economy, ${prefix}help transactions, ${prefix}help prophecy, ${prefix}help fun \n For admin commands, run ${prefix}adminhelp`,loc,totell,persid);
- } else {
- switch(args[1]){
- case "info":
- case "information":
- sendMsg(`Info: ${prefix}vers, ${prefix}help, ${prefix}cooldowns, ${prefix}bal, ${prefix}inv, ${prefix}baltop`,loc,totell,persid);
- break;
- case "eco":
- case "econ":
- case "economy":
- sendMsg(`Economy: ${prefix}coinflip, ${prefix}work, ${prefix}fish`,loc,totell,persid);
- break;
- case "money":
- case "transactions":
- sendMsg(`Transactions: ${prefix}donate, ${prefix}shop, ${prefix}buy, ${prefix}sell `,loc,totell,persid);
- break;
- case "prophecy":
- case "prophetbot":
- sendMsg(`Prophecy: ${prefix}how`,loc,totell,persid);
- break;
- case "fun":
- sendMsg(`Fun: ${prefix}paw, ${prefix}claw, ${prefix}kill, ${prefix}choose, ${prefix}rate`,loc,totell,persid);
- break;
- }
- }
- break;
- // start admin commands
- case "adminhelp":
- if (admins.indexOf(data.realUsername) == -1) {
- return;
- }
- sendMsg(`${prefix}start, ${prefix}prefix, ${prefix}announce, ${prefix}tellonly, ${prefix}config [option], ${prefix}ban, ${prefix}unban.`)
- break;
- case "start":
- if(admins.indexOf(data.realUsername) != -1) {
- if(started) {
- sendMsg("Bot has stopped.",loc,totell,persid);
- started = false;
- } else {
- started = true;
- sendMsg("Bot has started.",loc,totell,persid);
- }
- }
- break;
- case "sentience":
- if(admins.indexOf(data.realUsername) != -1) {
- sendMsg(`Sentience has been turned ${args[1]}.`,loc,totell,persid);
- } else {
- sendMsg(`Can't tell me when to be sentient, idiot!`,loc,totell,persid);
- }
- break;
- case "prefix":
- if(admins.indexOf(data.realUsername) != -1) {
- if(started) {
- let prefix = args[1];
- botUser = {nick: `Brisbane (${prefix}help)`, color: "#E4B3FF"}
- sendMsg(`This bot's new prefix is ${prefix}`,loc,totell,persid)
- }
- }
- break;
- case "announce":
- if(admins.indexOf(data.realUsername) != -1 && data.dataObj.privateMessage == "to_me") {
- let message = args.slice(1).join(" ");
- api_chat_send(message, {nick:botUser.nick, color:botUser.color, location:loc});
- } else if (admins.indexOf(data.realUsername) != -1) {
- api_chat_send(`/tell ${data.id} You have to use /tell with this command.`, {nick:botUser.nick, color:botUser.color, location:loc});
- }
- break;
- case "tellonly":
- if(admins.indexOf(data.realUsername) != -1) {
- if (tellonly) {
- tellonly = false
- sendMsg("You don't need to /tell the bot anymore.",loc,NaN,persid);
- } else {
- sendMsg("Please use /tell to interact with this bot (hover for id).",loc,NaN,persid);
- tellonly = true
- }
- }
- break;
- case "config":
- let option = args[1];
- if(admins.indexOf(data.realUsername) != -1) {
- let whichone = args[2];
- switch(option){
- case("cooldown"):
- case("cd"):
- if (!args[3]) {
- cooldowns.general = args[2];
- } else {
- cooldowns[whichone] = args[3];
- }
- case("cooldownmultiplier"):
- case("cooldownmult"):
- case("cdmult"):
- if (!args[3]) {
- cooldownMults.location.global = args[2];
- sendMsg(`Cooldown multiplier for global chat (location.global) has been changed to ${cooldownMults.location.global}x`,loc,totell,persid)
- } else {
- if (!isNaN(parseInt(args[3]))) cooldownMults[whichone][args[3]] = parseInt(args[4]);
- sendMsg(`Cooldown multiplier for ${whichone} ${args[3]} has been changed to ${cooldownMults[whichone][args[3]]}x`,loc,totell,persid)
- }
- }
- }
- break;
- case "ban":
- if(admins.indexOf(data.realUsername) != -1) {
- let banvictim = findByName(args[1]);
- if (banvictim == undefined) {
- sendMsg(`Could not ban ${args[1]}. User does not exist.`,loc,totell,persid);
- break;
- }
- banvictim.banProps.banned = true;
- banvictim.banProps.until = args[2] ? unixInSecs() + parseInt(args[2]) : Infinity;
- if (args[2]) {
- waitUntilUserIsUnbanned(banvictim);
- sendMsg(`${banvictim.username} has been banned for ${args[2]} seconds.`,loc,totell,persid);
- } else {
- sendMsg(`${banvictim.username} has been banned.`,loc,totell,persid);
- }
- }
- break;
- case "unban":
- let banvictim = findByName(args[1]);
- if(admins.indexOf(data.realUsername) != -1) {
- unbanUser(banvictim);
- sendMsg(`${banvictim.username} has been unbanned.`,loc,totell,persid);
- } else if (findByName(banvictim) == person) {
- sendMsg(`Bro really thought he could unban himself :skull:`,loc,"to_me",persid);
- }
- break;
- default:
- if (universal_cmd_enabled == true) {
- var victim = args.slice(1).join(" ");
- if (victim == " ") {
- sendMsg(`(UNOFFICIAL COMMAND) You must specify someone to ${cmd}.`,loc,totell,persid)
- } else {
- if(!cmd.endsWith("e")){
- sendMsg(`(UNOFFICIAL COMMAND) ${data.nickname || person.name} has ${cmd}ed ${victim}.`,loc,totell,persid)
- } else {
- sendMsg(`(UNOFFICIAL COMMAND) ${data.nickname || person.name} has ${cmd}d ${victim}.`,loc,totell,persid)
- }
- }
- } else {
- break;
- }
- }
- } else if (cmd != undefined && !person.tips.cooldown) {
- sendMsg(`To prevent spam, your interactions with Brisbane now have a ${cooldowns.general*cooldownMults.location[data.location]*(cooldownMults.user[person] || 1)}-second cooldown. For lower cooldowns go to ${chatworld}.`,loc,"to_me",persid);
- person.tips.cooldown = true;
- }
- });
- // code to handle bans (async)
- async function waitUntilUserIsUnbanned(user) {
- return await new Promise(resolve => {
- const interval = setInterval(() => {
- if (user.banProps.until < unixInSecs()) {
- clearInterval(interval);
- resolve(unbanUser(user));
- };
- }, 1000);
- });
- }
- function unbanUser(user) {
- user.banProps.banned = false;
- user.banProps.until = 0;
- }
- console.log("Started process for bot.");
Advertisement
Comments
-
- Wow this is Brisbane
-
- == NOTE == This is for brisbane 3.x! Source code for brisbane 4.x/5.x may be found on github!
Add Comment
Please, Sign In to add comment