sl1029

Brisbane 1.0

Jul 26th, 2026
28
1
Never
3
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 1 0
  1. const admins = ["katiserie"]; // include your realUsername in the list and exclude any unwanted admins
  2. var started = false;
  3. var savedPeople = {};
  4. function randint(min,max) {
  5. return Math.round(Math.random()*(max-min))+min;
  6. }
  7. function handleBal(name, length, silent) {
  8. if(silent){
  9. console.log(`${name} has ${length}H in their bank account.`);
  10. } else {
  11. sendMsg(`${name} has ${length}H in their bank account.`);
  12. }
  13. if (!savedPeople[name]) savedPeople[name] = length;
  14. }
  15. function sendMsg(msg) {
  16. if (started) {
  17. api_chat_send(msg, {nick: "Brisbane (!help)", color: "#E4B3FF"});
  18. } else {
  19. console.log(`There was an attempt to send "${msg}" while the bot was offline`);
  20. }
  21. }
  22. function balMod(user,amount) {
  23. if (started) {
  24. savedPeople[user] = savedPeople[user] + amount;
  25. console.log(`Script added ${amount} to ${user}'s bank account`)
  26. }
  27. }
  28. function safeParseInt(int) {
  29. let parsedInt = parseInt(int);
  30. if (parsedInt != NaN) {
  31. return parsedInt;
  32. } else {
  33. console.error("THAT IS NOT WHERE A STRING GOES YOU IDIOT")
  34. }
  35. }
  36.  
  37. w.on("chat", function (data) {
  38. if (data.id == 0) return;
  39. var person = data.realUsername || data.id;
  40. var args = data.message.split(" ");
  41. var personName = args[1];
  42. var personLength = savedPeople[personName];
  43. if (!savedPeople[person]) {
  44. var bal = 100;
  45. handleBal(person, bal, true);
  46. }
  47. switch (args[0].toLowerCase()) {
  48. case "!bal":
  49. if (personName == null) {
  50. if (data.realUsername) {
  51. handleBal(data.realUsername, savedPeople[data.realUsername], false);
  52. } else {
  53. handleBal(data.id, savedPeople[data.id], false);
  54. }
  55. } else {
  56. if (!personLength) return sendMsg("Nobody exists with that username or ID.");
  57. handleBal(personName, personLength, false);
  58. }
  59. break;
  60. case "!donate":
  61. let cashAmt = safeParseInt(args[2])
  62. let negCashAmt = -cashAmt
  63. if (personName == null) {
  64. sendMsg("You must specify a person to donate to.")
  65. } else if (args[2] == null) {
  66. sendMsg("You must specify an amount to donate.")
  67. } else if (personName == data.realUsername || personName == data.id) {
  68. sendMsg("You cannot donate to yourself.")
  69. } else if (safeParseInt(cashAmt) < 0) {
  70. sendMsg("You cannot donate a negative amount of money to a person.")
  71. } else if (safeParseInt(cashAmt) > safeParseInt(personLength)) {
  72. sendMsg("You cannot donate more than you have in your bank account.")
  73. } else {
  74. balMod(person, negCashAmt);
  75. balMod(personName, cashAmt);
  76. sendMsg(`You donated ${args[2]} to ${personName}`)
  77. }
  78. break;
  79. case "!cf":
  80. let betAmt = safeParseInt(personName);
  81. if (betAmt < 0) {
  82. sendMsg("You cannot coin flip a negative amount of money.")
  83. } else if (betAmt > safeParseInt(personLength)) {
  84. sendMsg("You cannot coin flip more than you have in your bank account.")
  85. } else {
  86. let rand = Math.random();
  87. if (rand >= 0.5) {
  88. sendMsg(`You won the coinflip and recieved ${personName}H.`)
  89. balMod(person, betAmt);
  90. } else {
  91. sendMsg(`You lost the coinflip and lost ${personName}H.`)
  92. balMod(person, -betAmt);
  93. }
  94. }
  95. break;
  96. case "!help":
  97. sendMsg("Commands: !help, !bal, !donate, !cf");
  98. break;
  99.  
  100. }
  101. if (args[0].toLowerCase() == "!start" && admins.indexOf(data.realUsername) != -1) {
  102. if(started) {
  103. sendMsg("Admin has stopped the bot.")
  104. started = false;
  105. } else {
  106. started = true;
  107. sendMsg("Admin has started the bot.")
  108. }
  109. }
  110. });
  111.  
  112. console.log("Started bot.");
Advertisement
Comments
Add Comment
Please, Sign In to add comment