NewBouncer

MINI Bot to MPP

目前为 2022-09-18 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name NewBouncer
  3. // @namespace https://greasyfork.org/
  4. // @version 0.1
  5. // @description MINI Bot to MPP
  6. // @author COdER#3389
  7. // @icon https://mpphust.ga/assets/icon%20(48).png
  8. // @include *://multiplayerpiano.com/*
  9. // @include *://mppclone.com/*
  10. // @include *://mpp.terrium.net/*
  11. // @include *://piano.ourworldofpixels.com/*
  12. // @grant none
  13. // ==/UserScript==
  14. //local vars mmmmk
  15. var prefix = "//" //prefix of the bot mmmmk
  16. var botName = "NewBouncer" //Name of the bot mmmmk
  17. var botnameintial = `${botName} (${prefix}help)` //The finished name, Prefix and bot name combined mmmmk
  18. var botColor = "#0084ff" //HEX CODE mmmmk
  19. Admins = [
  20. '6e2a13f359d5639f10ea38dd', // Circuits
  21. 'e7155a1cbadf448bc02837b4', // Tsu
  22. 'a196b458fe0fdc736ee1ebb5', // WATERMELOOOOOOOOOOOOOOOOOOOOOON
  23. 'circuits', // circuits but mpp176
  24. 'efbbd39c3a83d269b48212dac96bd405', // danny but mpp176
  25. 'da45fff2a6fef315cc229c4b0239ebf4' // fliːt ˈweɪ but mpp176
  26. ]
  27. Custom = [
  28. 'bbf47ebb5351a8c1d23a3756', // bheese
  29. '081c0c7405bdce8bb5344ab2' // mero
  30. ]
  31. MPP.client.sendArray([{
  32. m: "userset",
  33. set: {
  34. name: botnameintial,
  35. color: botColor
  36. }
  37. }]);
  38. function run(code) {
  39. if (new String(code) == "[object Object]" == false && new String(code) == "[object JSON]" == false) {
  40. try {
  41. return '► ' + eval(code);
  42. } catch (error) {
  43. return '► ❌ ' + error + ''
  44. }
  45. }
  46. if (new String(code) == "[object Object]" || new String(code) == "[object JSON]") {
  47. try {
  48. return '► ' + JSON.stringify(eval(code));
  49. } catch (error) {
  50. return '► ❌ ' + error + ' '
  51. }
  52. }
  53. }
  54.  
  55. var follow = "server"
  56. MPP.client.on('m', m => {
  57. if (m.id == follow) {
  58. MPP.client.sendArray([{
  59. m: "m",
  60. "x": m.x,
  61. "y": m.y
  62. }]);
  63. }
  64. })
  65.  
  66. var idgetter = "server"
  67. // program to reverse a string
  68.  
  69. function reverseString(str) {
  70.  
  71. // empty string
  72. let newString = "";
  73. for (let i = str.length - 1; i >= 0; i--) {
  74. newString += str[i];
  75. }
  76. return newString;
  77. }
  78.  
  79. MPP.client.on("a", function(msg) {
  80. //MSG vars
  81. var isAdmins = (Admins.indexOf(msg.p._id) !== -1);
  82. var isCustom = (Custom.indexOf(msg.p._id) !== -1);
  83. var args = msg.a.split(" ");
  84. var args2 = msg.a.split("");
  85. var cmd = args[0].toLowerCase();
  86. var cmd2 = args2[0].toLowerCase();
  87. args = args.slice(1);
  88. var sendChat = function(msg) {
  89. MPP.chat.send(msg)
  90. };
  91. var botsname = "NewBouncer"
  92. var name = msg.p.name;
  93. var element = ["Hello.", `I'm ${botsname}, and you are ${name}`, "I'm good. How about you?", "Maybe.", "Sure.", "I guess so.", "and?", "Ok.", "Nice.", "Thanks.", "No.", `${msg.a.substring(7).trim()}? Ok.`, `${msg.a.substring(7).trim()}? Nice!`, `${msg.a.substring(7).trim()}? Fine.`, `${msg.a.substring(7).trim()}? I guess not.`, `${msg.a.substring(7).trim()}? Sure.`, "I think so.", "I dont really know about that.", "My favorite song? Checkpoints by Nitro Fun & Hyper Potions.", "Nice try.", "Don't.", "Yes.", "Why?"];
  94. var randomresponse = element[Math.floor(Math.random() * element.length)];
  95. var cfolders = "(hidden)";
  96. const string = msg.a.substring(9).trim()
  97. const result = reverseString(string);
  98. const number = msg.a.substring(12).trim()
  99. function makeid(length) {
  100. var result = '';
  101. var characters = ['abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()[]{}~`´|/?;:><-_+=çêéèÈÉÊáÁàÀãÃâÂëËäÄúùÙÚüÜ'];
  102. var charactersLength = characters.length;
  103. for ( var i = 0; i < length; i++ ) {
  104. result += characters.charAt(Math.floor(Math.random() * charactersLength));
  105. }
  106. return result;
  107. }
  108. const codelangs = [
  109. "APL",
  110. "C",
  111. "C#",
  112. "C++",
  113. "Python",
  114. "pygame",
  115. "Brainfuck",
  116. "CSS",
  117. "JavaScript",
  118. "Ruby",
  119. "Node.JS",
  120. "JSON",
  121. "Asterisk",
  122. "Clojure",
  123. "ClojureScript",
  124. "Java",
  125. "Embedded JavaScript",
  126. "Embedded Ruby",
  127. "Modelica",
  128. "PowerShell",
  129. "Q",
  130. "R",
  131. "D",
  132. "F#",
  133. "Z#",
  134. "TypeScript",
  135. "TypeScript-JSX"
  136. ]
  137. var rct = codelangs[Math.floor(Math.random() * codelangs.length)]
  138. var commands = ["help", "crownholderid", "systeminfo", "follow", "roominfo", "rules", "codetype"];
  139. var admincmds = ["//js, //sayraw, //kickban, //unban, //givecrown"];
  140. var noperms = "❎ You don't have permission to use this command.";
  141. var perms = "✅ You have permission to use this command.";
  142. if (cmd === "//js") {
  143. if (isAdmins) {
  144. var input = msg.a.split(" ").slice(1).join(" ");
  145. if (!input) {
  146. return sendChat(run(input))
  147. }
  148. sendChat(run(input))
  149. } else {
  150. sendChat(`❎ You don't have permission to use this command.`)
  151. }
  152. }
  153. if (cmd === ">") {
  154. if (isAdmins) {
  155. var input = msg.a.split(" ").slice(1).join(" ");
  156. if (!input) {
  157. return sendChat(run(input))
  158. }
  159. sendChat(run(input))
  160. } else {
  161. sendChat(`❎ You don't have permission to use this command.`)
  162. }
  163. }
  164. if (cmd === "//sayraw") {
  165. if (isAdmins) {
  166. if (args.length == 0) {
  167. sendChat("No text specified.");
  168. } else {
  169. sendChat(msg.a.substring(8).trim())
  170. }
  171. } else {
  172. sendChat(noperms);
  173. }
  174. }
  175. if (cmd === "//stringtest") {
  176. if (isAdmins) {
  177. sendChat(perms)
  178. sendChat(makeid(10))
  179. } else {
  180. sendChat(noperms + " Also, this command generates 10 characters.")
  181. }
  182. }
  183. if (cmd === "//reverse" | cmd === "//esrever") {
  184. if (isAdmins) {
  185. if (args.length == 0) {
  186. sendChat("No text to reverse. | Usage: //reverse (text) | .eciN .esreveR");
  187. } else {
  188. sendChat(`${result}`)
  189. }
  190. } else {
  191. if (args.length == 0) {
  192. sendChat("No text to reverse. | Usage: //reverse (text) | .eciN .esreveR");
  193. } else {
  194. sendChat(`Reversed String: ${result}`)
  195. }
  196. }
  197. }
  198. if (cmd === "//kickban") {
  199. if (isAdmins) {
  200. if (args.length == 0) {
  201. sendChat("Usage: //kickban (id) | Duration of kickban is 5 hours.");
  202. } else {
  203. MPP.client.sendArray([{m: 'kickban', ms: 18000000, _id: `${msg.a.substring(9).trim()}`}]);
  204. sendChat("");
  205. }
  206. } else {
  207. sendChat("❎ You don't have permission to use this command.")
  208. }
  209. }
  210. if (cmd === "//unban") {
  211. if (isAdmins) {
  212. if (args.length == 0) {
  213. sendChat("Usage: //unban (id) | Unbans people. Huh.");
  214. } else {
  215. MPP.client.sendArray([{m: 'unban', ms: 18000000, _id: `${msg.a.substring(7).trim()}`}]);
  216. sendChat("Unbanned.");
  217. }
  218. } else {
  219. sendChat("❎ You don't have permission to use this command.")
  220. }
  221. }
  222. if (cmd == "//givecrown") {
  223. if (isAdmins) {
  224. if (args.length == 0) {
  225. sendChat("Usage: //givecrown (id)");
  226. } else {
  227. MPP.client.sendArray([{m: 'chown', id: msg.a.substring(11).trim()}])
  228. MPP.chat.send("Done.");
  229. }
  230. } else {
  231. sendChat("❎ You don't have permission to use this command.")
  232. }
  233. }
  234. if (cmd === "//color") {
  235. var input = msg.a.split(" ").slice(1).join(" ");
  236. if (args.length == 0) {
  237. sendChat(`${msg.p.color}`)
  238. } else {
  239. var targetfrommsg = MPP.client.findParticipantByName[input]; {
  240. sendChat(`[${targetfrommsg._id}] ${targetfrommsg.name}'s color is ${targetfrommsg.color}`)
  241. }
  242. }
  243. }
  244. if (cmd === "//id") {
  245. sendChat(`${msg.p._id}`)
  246. }
  247. if (cmd === `${prefix}follow`) {
  248. var input = msg.a.split(" ").slice(1).join(" ");
  249. sendChat(`Following: [${msg.p._id}] ${msg.p.name}`);
  250. follow = msg.p._id;
  251. return;
  252. var target = MPP.client.ppl[input] | MPP.client.findParticipantByName(input); {
  253. if (!target) {
  254. return sendChat(`User not found or the user is not in this room.`);
  255. }
  256. follow = target._id
  257. sendChat(`Following: [${target._id}] ${target.name}`)
  258. }
  259. }
  260. if (cmd === "//crownholderid") {
  261. sendChat(`${MPP.client.channel.crown.participantId}`);
  262. }
  263. if (cmd === "//codetype") {
  264. sendChat(`${rct}`);
  265. }
  266. if (cmd === "//roominfo") {
  267. sendChat(`Room Info | Room Name: ${MPP.client.channel._id} | Room User Limit: ${MPP.client.channel.settings.limit} | BG Colors: 1. ${MPP.client.channel.settings.color} 2. ${MPP.client.channel.settings.color2} | Chat is Enabled: ${MPP.client.channel.settings.chat} | Room is visible: ${MPP.client.channel.settings.visible} | Crown Holder _ID: ${MPP.client.channel.crown.participantId}`);
  268. }
  269. if (cmd === "//skull") {
  270. if (args.length == 0) {
  271. sendChat("Usage: //skull (msg)");
  272. } else {
  273. sendChat(name + ": " + msg.a.substring(7).trim() + " 💀");
  274. }
  275. }
  276. if (cmd === "//thonk") {
  277. if (args.length == 0) {
  278. sendChat("Usage: //thonk (msg)");
  279. } else {
  280. sendChat(name + ": " + msg.a.substring(7).trim() + " 🤔");
  281. }
  282. }
  283. if (cmd === "//help") {
  284. var cmds = "//" + commands[0];
  285. for (i = 1; i < commands.length; i++) {
  286. cmds += ", //" + commands[i];
  287. }
  288. sendChat("Normal commands are: " + cmds);
  289. sendChat("Admin commands are: " + admincmds);
  290. }
  291. });
  292. MPP.chat.send(`${botName} is Online! ✅`);