RubixYT1

DianondBot v7.14.4 textwall

Mar 25th, 2026
120
1
Never
12
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 65.41 KB | None | 1 0
  1. !async function() {
  2. "use strict";
  3. if ("undefined" == typeof w) console.error("TextWall API (w) not found! Make sure you're on tw.2s4.me");
  4. else {
  5. const o = {
  6. save: function(e, s) { try { return localStorage.setItem("diamondbot_" + e, JSON.stringify(s)), !0 } catch (e) { return console.error("Failed to save to storage:", e), !1 } },
  7. load: function(e, s = null) { try { var t = localStorage.getItem("diamondbot_" + e); return t ? JSON.parse(t) : s } catch (e) { return console.error("Failed to load from storage:", e), s } },
  8. remove: function(e) { try { return localStorage.removeItem("diamondbot_" + e), !0 } catch (e) { return console.error("Failed to remove from storage:", e), !1 } }
  9. },
  10. a = {
  11. version: "7.14.4",
  12. username: "diamondbot",
  13. color: 0,
  14. prefix: "\\",
  15. authorizedUsers: o.load("authorizedUsers", ["Diamond26", "KiwiTest"]),
  16. defaultAuthorities: o.load("defaultAuthorities", ["Diamond26", "KiwiTest"]),
  17. bannedUsers: o.load("bannedUsers", []),
  18. bannedIds: o.load("bannedIds", []),
  19. messageDelay: 150,
  20. position: { x: 0, y: 0 },
  21. heightSafetyEnabled: !0,
  22. lastAuthorityMessage: "",
  23. authorityEchoEnabled: !1,
  24. echoColorEnabled: !1
  25. },
  26. s = {
  27. wall: "", subwall: "", perms: 0, isRegistered: !1, isAdmin: !1, readonly: !1, hidecursors: !1, disablechat: !1, disablecolor: !1, disablebraille: !1, members: [], walllist: [], activeTimers: new Map, activeCounts: new Map, commandCooldowns: new Map, messageQueue: [], isProcessingQueue: !1, lastMessageTime: 0, cursors: new Map, adminUsers: new Set, processedMessages: new Set, lastSayUser: null, userPositions: new Map, userIds: new Map, isShuttingDown: !1, isTyping: !1, countdownActive: !1, clearingArea: !1
  28. },
  29. r = { "#000000": 0, "#ffffff": 1, "#ff0000": 2, "#00ff00": 3, "#0000ff": 4, "#ffff00": 5, "#ff00ff": 6, "#00ffff": 7, "#808080": 8, "#ff8800": 9, "#8800ff": 10, "#0088ff": 11, "#88ff00": 12, "#ff0088": 13, "#884400": 14, "#448800": 15 },
  30. n = ["to", "tp", "colorid", "addauth", "removeauth", "disablehs", "echoauth", "echocolor", "csay", "ban", "unban", "banid", "unbanid", "type", "cleararea", "wallwarp"],
  31. i = [
  32. { version: "7.14.4", changes: "Added \\rate command, addDefaultAuth/addAuth console cmds, invisible char in help" },
  33. { version: "7.14.3.1", changes: "Confirmed Diamond26 default authority, version bump" },
  34. { version: "7.14.3", changes: "Updated default authority Diamond25->Diamond26, added \\ping command" },
  35. { version: "7.14.2", changes: "Progress bar for tcountdown, stop option added" },
  36. { version: "7.14.1", changes: "Switched to getCharInfoXY for character detection" },
  37. { version: "7.14", changes: "\\cleararea only clears non-spaces, \\wallwarp command added" },
  38. { version: "7.13.4", changes: "Updated cursor detection using Array.from(w.cursors)" },
  39. { version: "7.13.3", changes: "10ms cleararea cooldown, w.cursors detection" },
  40. { version: "7.13.2", changes: "\\cleararea command, unbanName console command" },
  41. { version: "7.13.1", changes: "\\tcountdown and \\userlist commands added" },
  42. { version: "7.13", changes: "Cursor Y coordinate flipped, \\chl command added" },
  43. { version: "7.12", changes: "\\echocolor command, HEX-only colors, authority color echo" },
  44. { version: "7.11", changes: "Color syntax support with <start #HEX>text<end>" },
  45. { version: "7.10", changes: "\\tp command using w.tp() function" },
  46. { version: "7.9", changes: "Help cooldown 0.7s, thelp step 1, page command update" },
  47. { version: "7.8", changes: "Bug fixes and performance improvements" },
  48. { version: "7.7", changes: "Enhanced security and ban system" },
  49. { version: "7.6", changes: "Timer system improvements" },
  50. { version: "7.5", changes: "Authority system enhancements" },
  51. { version: "7.4", changes: "Added height safety toggle" },
  52. { version: "7.3", changes: "Colored say command (csay)" },
  53. { version: "7.2", changes: "Ban system with ID support" },
  54. { version: "7.1", changes: "Echo authority messages feature" },
  55. { version: "7.0", changes: "Major rewrite with improved architecture" }
  56. ],
  57. h = {
  58. 1: [
  59. { cmd: "help", desc: "Show command pages", auth: !1 },
  60. { cmd: "thelp", desc: "Type help on wall", auth: !1 },
  61. { cmd: "fullcmd", desc: "Get full command list location", auth: !1 },
  62. { cmd: "info", desc: "Show bot information", auth: !1 },
  63. { cmd: "chl", desc: "Show changelog", auth: !1 }
  64. ],
  65. 2: [
  66. { cmd: "ping", desc: "Responds with Pong!", auth: !1 },
  67. { cmd: "rate", desc: "Rate something out of 10", auth: !1 },
  68. { cmd: "calculate", desc: "Calculate p1^p2", auth: !1 },
  69. { cmd: "calc2", desc: "Calculate p1^^p2 (tetration)", auth: !1 },
  70. { cmd: "rng", desc: "Random number between min and max", auth: !1 }
  71. ],
  72. 3: [
  73. { cmd: "say", desc: "Make bot say something", auth: !1 },
  74. { cmd: "timer", desc: "Set a timer (h m s)", auth: !1 },
  75. { cmd: "count", desc: "Count from 1 to n with cooldown", auth: !1 },
  76. { cmd: "tcountdown", desc: "Type countdown with progress bar", auth: !1 },
  77. { cmd: "status", desc: "Show bot status", auth: !1 }
  78. ],
  79. 4: [
  80. { cmd: "pos", desc: "Show cursor position (x,y coordinates)", auth: !1 },
  81. { cmd: "type", desc: "Type characters on wall (Authority)", auth: !0 },
  82. { cmd: "page", desc: "Show detailed page info", auth: !1 },
  83. { cmd: "members", desc: "List wall members", auth: !1 },
  84. { cmd: "walls", desc: "List available subwalls", auth: !1 }
  85. ],
  86. 5: [
  87. { cmd: "authlist", desc: "Show authorized users", auth: !1 },
  88. { cmd: "userlist", desc: "Show all online users in wall", auth: !1 },
  89. { cmd: "to", desc: "Teleport bot to X Y (Authority)", auth: !0 },
  90. { cmd: "tp", desc: "Teleport to X Y using w.tp (Authority)", auth: !0 },
  91. { cmd: "colorid", desc: "Change bot color (Authority)", auth: !0 }
  92. ],
  93. 6: [
  94. { cmd: "cleararea", desc: "Clear non-space chars (Authority)", auth: !0 },
  95. { cmd: "csay", desc: "Say colored text (Authority)", auth: !0 },
  96. { cmd: "addauth", desc: "Add user to authority list (Authority)", auth: !0 },
  97. { cmd: "removeauth", desc: "Remove user from authority (Authority)", auth: !0 },
  98. { cmd: "ban", desc: "Ban user from using bot (Authority)", auth: !0 }
  99. ],
  100. 7: [
  101. { cmd: "unban", desc: "Unban user/ID (Authority)", auth: !0 },
  102. { cmd: "banid", desc: "Ban user by ID (Authority)", auth: !0 },
  103. { cmd: "unbanid", desc: "Unban user by ID (Authority)", auth: !0 },
  104. { cmd: "banlist", desc: "Show banned users (Authority)", auth: !0 },
  105. { cmd: "disableHS", desc: "Toggle height safety (Authority)", auth: !0 }
  106. ],
  107. 8: [
  108. { cmd: "echoauth", desc: "Toggle authority echo (Authority)", auth: !0 },
  109. { cmd: "echocolor", desc: "Toggle color echo (Authority)", auth: !0 },
  110. { cmd: "wallwarp", desc: "Warp to wall/subwall (Authority)", auth: !0 }
  111. ]
  112. };
  113.  
  114. class t {
  115. constructor(e) {
  116. this.config = e;
  117. this.state = s;
  118. this.eventHandlers = {};
  119. this.running = !0;
  120. }
  121.  
  122. async init() {
  123. console.log("===================================");
  124. console.log(` TextWall Bot v${this.config.version} Initializing `);
  125. console.log("===================================");
  126. await e();
  127. this.setupEventListeners();
  128. this.setUsername(this.config.username);
  129. this.setColor(this.config.color);
  130. this.teleportCursor(0, 0);
  131. setTimeout(() => {
  132. this.sendMessage(`${this.config.username} v${this.config.version} online! Type ${this.config.prefix}help for commands`);
  133. }, 2e3);
  134. console.log("[OK] Bot initialized successfully!");
  135. console.log("[OK] Prefix: " + this.config.prefix);
  136. console.log("[OK] Authorized users: " + this.config.authorizedUsers.join(", "));
  137. console.log("[OK] Default authorities: " + this.config.defaultAuthorities.join(", "));
  138. console.log("[OK] Banned users: " + this.config.bannedUsers.length);
  139. console.log("[OK] Banned IDs: " + this.config.bannedIds.length);
  140. console.log("[OK] Type window.showCommands() to see all commands in console");
  141. console.log("[OK] Color syntax: <start #HEXCOLOR>text<end>");
  142. console.log("[OK] Y coordinates are flipped (negated)");
  143. console.log("===================================");
  144. }
  145.  
  146. setupEventListeners() {
  147. this.eventHandlers = {
  148. join: e => this.onJoin(e),
  149. alert: e => this.onAlert(e),
  150. msg: e => this.onMessage(e),
  151. edit: e => this.onEdit(e),
  152. protect: e => this.onProtect(e),
  153. clear: e => this.onClear(e),
  154. cursor: e => this.onCursor(e),
  155. cursorleft: e => this.onCursorLeft(e),
  156. perms: e => this.onPerms(e),
  157. memberadded: e => this.onMemberAdded(e),
  158. memberlist: e => this.onMemberList(e),
  159. walllist: e => this.onWallList(e),
  160. readonly: e => this.onReadonly(e),
  161. hidecursors: e => this.onHideCursors(e),
  162. disablechat: e => this.onDisableChat(e),
  163. disablecolor: e => this.onDisableColor(e),
  164. disablebraille: e => this.onDisableBraille(e),
  165. nametaken: () => this.onNameTaken(),
  166. passfail: () => this.onPassFail(),
  167. tokenfail: () => this.onTokenFail(),
  168. regclosed: () => this.onRegClosed(),
  169. namechanged: e => this.onNameChanged(e),
  170. accountdeleted: () => this.onAccountDeleted(),
  171. pong: e => this.onPong(e)
  172. };
  173. for (var [e, s] of Object.entries(this.eventHandlers)) w && w.on && w.on(e, s);
  174. console.log(`[OK] Registered ${Object.keys(this.eventHandlers).length} event listeners`);
  175. }
  176.  
  177. cleanup() {
  178. this.running = !1;
  179. this.state.countdownActive = !1;
  180. this.state.clearingArea = !1;
  181. for (var [e, s] of Object.entries(this.eventHandlers)) w && w.off && w.off(e, s);
  182. this.state.activeTimers.forEach(e => { clearTimeout(e.timeout); e.intervalId && clearInterval(e.intervalId); });
  183. this.state.activeCounts.forEach(e => { e.intervalId && clearInterval(e.intervalId); });
  184. console.log("[OK] Bot cleaned up");
  185. }
  186.  
  187. isAuthorized(e, s) { return s ? (this.state.adminUsers.add(e), !0) : this.config.authorizedUsers.includes(e); }
  188. isBanned(e) { return this.config.bannedUsers.includes(e); }
  189. isIdBanned(e) { return this.config.bannedIds.includes(e); }
  190.  
  191. getUserId(e) {
  192. for (var [s, t] of this.state.cursors.entries())
  193. if (t.name === e) return s;
  194. return this.state.userIds.get(e) || null;
  195. }
  196.  
  197. getCursorPosition(s) {
  198. if (this.state.userPositions.has(s)) return this.state.userPositions.get(s);
  199. try {
  200. if ("undefined" != typeof w && w.cursors)
  201. for (let e = 0; e < Array.from(w.cursors).length; e++) {
  202. var t = Array.from(w.cursors)[e][1];
  203. if (t && t.n === s && t.l) return [t.l[0], -t.l[1]];
  204. }
  205. } catch (e) { console.error("[CURSOR POS ERROR]", e); }
  206. for (var e of this.state.cursors.values())
  207. if (e.name === s) return e.location;
  208. return null;
  209. }
  210.  
  211. containsAuthorityCommand(e) {
  212. var s, t = e.toLowerCase();
  213. for (s of n)
  214. if (t.includes("" + this.config.prefix + s)) return !0;
  215. return !1;
  216. }
  217.  
  218. hasColorSyntax(e) { return /<start\s+#[0-9a-fA-F]{6}>([^<]*)<end>/i.test(e); }
  219.  
  220. parseColoredMessage(e) {
  221. var s, t = /<start\s+(#[0-9a-fA-F]{6})>([^<]*)<end>/gi, o = [];
  222. let n = 0;
  223. for (; null !== (s = t.exec(e));) {
  224. s.index > n && o.push({ text: e.substring(n, s.index), color: null });
  225. var i = s[1].toLowerCase(), a = s[2], i = r[i];
  226. o.push({ text: a, color: void 0 !== i ? i : null });
  227. n = s.index + s[0].length;
  228. }
  229. return n < e.length && o.push({ text: e.substring(n), color: null }), 0 === o.length ? [{ text: e, color: null }] : o;
  230. }
  231.  
  232. onJoin(e) { this.state.wall = e.wall || ""; this.state.subwall = e.subwall || ""; console.log(`[JOINED] ${this.state.wall}/` + this.state.subwall); }
  233. onAlert(e) { console.log("[ALERT] " + e.message); }
  234.  
  235. onMessage(e) {
  236. var s, t, o, n;
  237. e && e.msg && (e.nick === this.config.username || (s = e.msg.trim(), t = e.nick || "Unknown", o = e.isAdmin || !1, (n = e.id || null) && t && this.state.userIds.set(t, n), n = t + `-${s}-` + Date.now(), this.state.processedMessages.has(n)) || (this.state.processedMessages.add(n), 100 < this.state.processedMessages.size && (n = Array.from(this.state.processedMessages)).slice(0, n.length - 100).forEach(e => { this.state.processedMessages.delete(e); }), o && this.state.adminUsers.add(t), this.isAuthorized(t, o) ? (console.log(`[AUTHORITY] ${t} ~ ` + s), this.config.echoColorEnabled && !s.startsWith(this.config.prefix) && !s.includes("[AUTHORITY COLOR]") && this.hasColorSyntax(s) ? this.sendMessage(`[AUTHORITY COLOR] ${t} ~ ` + s) : !this.config.authorityEchoEnabled || s.startsWith(this.config.prefix) || s.includes("[AUTHORITY]") || this.hasColorSyntax(s) || this.config.lastAuthorityMessage === t + ":" + s || (this.config.lastAuthorityMessage = t + ":" + s, this.sendMessage(`[AUTHORITY] ${t} ~ ` + s))) : console.log(`[MSG] ${t}${e.isRegistered ? " (R)" : ""}: ` + s), s.startsWith(this.config.prefix) && this.handleCommand(s, t, e)));
  238. }
  239.  
  240. onEdit(e) { e.edits && 0 < e.edits.length && console.log(`[EDIT] ${e.edits.length} edit(s) made`); }
  241. onProtect(e) { console.log(`[PROTECT] Chunk ${e.cell} protection: ` + (e.protect ? "ON" : "OFF")); }
  242. onClear(e) { console.log(`[CLEAR] Area cleared: (${e.x1},${e.y1}) to (${e.x2},${e.y2})`); }
  243.  
  244. onCursor(e) {
  245. var s;
  246. e.id && (s = e.l ? [e.l[0], -e.l[1]] : [0, 0], this.state.cursors.set(e.id, { name: e.n || "", location: s, color: e.c || 0 }), e.n && (this.state.userPositions.set(e.n, s), this.state.userIds.set(e.n, e.id)), e.n === this.config.username) && e.l && (this.config.position.x = e.l[0], this.config.position.y = -e.l[1]);
  247. }
  248.  
  249. onCursorLeft(e) { var s = this.state.cursors.get(e); s && s.name && this.state.userPositions.delete(s.name); this.state.cursors.delete(e); }
  250. onPerms(e) { this.state.perms = e; console.log(`[PERMS] ${["User", "Member", "Owner"][e] || "Unknown"} (${e})`); }
  251. onMemberAdded(e) { console.log("[MEMBER+] " + e); this.state.members.includes(e) || this.state.members.push(e); }
  252. onMemberList(e) { this.state.members = e || []; console.log("[MEMBERS] " + (this.state.members.join(", ") || "None")); }
  253. onWallList(e) { this.state.walllist = e || []; console.log(`[WALLS] ${e.length / 2} wall(s) available`); }
  254. onReadonly(e) { (this.state.readonly = e) && console.log("[STATE] Wall is now READONLY"); }
  255. onHideCursors(e) { (this.state.hidecursors = e) && console.log("[STATE] Cursors are now HIDDEN"); }
  256. onDisableChat(e) { (this.state.disablechat = e) && console.log("[STATE] Chat is DISABLED"); }
  257. onDisableColor(e) { (this.state.disablecolor = e) && console.log("[STATE] Colors are DISABLED"); }
  258. onDisableBraille(e) { (this.state.disablebraille = e) && console.log("[STATE] Braille is DISABLED"); }
  259. onNameTaken() { console.log("[ERROR] Name is already taken!"); }
  260. onPassFail() { console.log("[ERROR] Invalid password!"); }
  261. onTokenFail() { console.log("[ERROR] Invalid token!"); }
  262. onRegClosed() { console.log("[ERROR] Registration is closed!"); }
  263. onNameChanged(e) { console.log("[OK] Name changed to: " + e); this.config.username = e; }
  264. onAccountDeleted() { console.log("[ERROR] Account has been deleted!"); }
  265. onPong(e) {}
  266.  
  267. handleCommand(e, s, t) {
  268. var o, n, i, a, r = t.id || this.getUserId(s);
  269. r && this.isIdBanned(r) ? this.sendMessage("ERR: your id banned from using bot.") : this.isBanned(s) ? this.sendMessage("You're banned.") : ([r, ...e] = e.slice(this.config.prefix.length).split(/\s+/), o = (r = r.toLowerCase()) + "-" + (this.state.lastSayUser = s), n = this.state.commandCooldowns.get(o) || 0, i = Date.now(), a = this.isAuthorized(s, t.isAdmin), i - n < 2e3 && !a || (this.state.commandCooldowns.set(o, i), this.executeCommand(r, e, s, t)));
  270. }
  271.  
  272. executeCommand(e, s, t, o) {
  273. const n = this.isAuthorized(t, o.isAdmin);
  274. e = {
  275. ping: () => this.cmdPing(),
  276. rate: () => this.cmdRate(s),
  277. help: () => this.cmdHelp(s),
  278. thelp: () => this.cmdTypeHelp(s),
  279. fullcmd: () => this.cmdFullcmd(),
  280. info: () => this.cmdInfo(),
  281. chl: () => this.cmdChangelog(s),
  282. calculate: () => this.cmdCalculate(s),
  283. calc2: () => this.cmdTetration(s),
  284. rng: () => this.cmdRandom(s),
  285. timer: () => this.cmdTimer(s),
  286. say: () => this.cmdSay(s, t, o.isAdmin),
  287. count: () => this.cmdCount(s),
  288. tcountdown: () => this.cmdTypeCountdown(s),
  289. status: () => this.cmdStatus(),
  290. pos: () => this.cmdPosition(s, t),
  291. page: () => this.cmdPage(s),
  292. members: () => this.cmdMembers(),
  293. walls: () => this.cmdWalls(),
  294. authlist: () => this.cmdAuthList(),
  295. userlist: () => this.cmdUserList(),
  296. to: () => n ? this.cmdTeleport(s) : this.sendMessage("Permission invalid - Authority required"),
  297. tp: () => n ? this.cmdTp(s) : this.sendMessage("Permission invalid - Authority required"),
  298. type: () => n ? this.cmdType(s) : this.sendMessage("Permission invalid - Authority required"),
  299. colorid: () => n ? this.cmdColor(s) : this.sendMessage("Permission invalid"),
  300. cleararea: () => n ? this.cmdClearArea(s) : this.sendMessage("Permission invalid - Authority required"),
  301. csay: () => n ? this.cmdColoredSay(s) : this.sendMessage("Permission invalid - Authority required"),
  302. addauth: () => n ? this.cmdAddAuth(s) : this.sendMessage("Permission invalid - Authority required"),
  303. removeauth: () => n ? this.cmdRemoveAuth(s) : this.sendMessage("Permission invalid - Authority required"),
  304. ban: () => n ? this.cmdBan(s) : this.sendMessage("Permission invalid - Authority required"),
  305. unban: () => n ? this.cmdUnban(s) : this.sendMessage("Permission invalid - Authority required"),
  306. banid: () => n ? this.cmdBanId(s) : this.sendMessage("Permission invalid - Authority required"),
  307. unbanid: () => n ? this.cmdUnbanId(s) : this.sendMessage("Permission invalid - Authority required"),
  308. banlist: () => n ? this.cmdBanList() : this.sendMessage("Permission invalid - Authority required"),
  309. disablehs: () => n ? this.cmdDisableHeightSafety() : this.sendMessage("Permission invalid - Authority required"),
  310. echoauth: () => n ? this.cmdToggleEcho() : this.sendMessage("Permission invalid - Authority required"),
  311. echocolor: () => n ? this.cmdToggleEchoColor() : this.sendMessage("Permission invalid - Authority required"),
  312. wallwarp: () => n ? this.cmdWallWarp(s) : this.sendMessage("Permission invalid - Authority required")
  313. }[e];
  314. e && e();
  315. }
  316.  
  317. cmdPing() {
  318. this.sendMessage("Pong!");
  319. }
  320.  
  321. cmdRate(e) {
  322. if (e.length < 1) this.sendMessage(`Usage: ${this.config.prefix}rate [something]`);
  323. else {
  324. var s = e.join(" "),
  325. t = Math.floor(Math.random() * 11);
  326. this.sendMessage(`I rate ${s} as ${t}/10`);
  327. }
  328. }
  329.  
  330. cmdHelp(e) {
  331. var s, e = e[0];
  332. void 0 === e || !isNaN(e) && Number.isInteger(Number(e)) ? (e = parseInt(e) || 1, s = Object.keys(h).length, e < 1 || s < e ? this.sendMessage(`Invalid number. Use ${this.config.prefix}help 1-` + s) : (this.sendMessage(`Commands Page ${e}/${s}:`), h[e].forEach((e, s) => { setTimeout(() => { this.sendMessage(`${this.config.prefix}\u200B${e.cmd}${e.auth ? " [A]" : ""} - ` + e.desc); }, 700 * (s + 1)); }))) : this.sendMessage("Invalid number.");
  333. }
  334.  
  335. cmdChangelog(e) {
  336. var s, t, o, e = e[0];
  337. void 0 === e || !isNaN(e) && Number.isInteger(Number(e)) ? (s = Math.ceil(i.length / 5), (e = parseInt(e) || 1) < 1 || s < e ? this.sendMessage(`Invalid number. Use ${this.config.prefix}chl 1-` + s) : (o = 5 * (e - 1), t = Math.min(5 + o, i.length), o = i.slice(o, t), this.sendMessage(`Changelog Page ${e}/${s}:`), o.forEach((e, s) => { setTimeout(() => { this.sendMessage(`v${e.version}: ` + e.changes); }, 700 * (s + 1)); }))) : this.sendMessage("Invalid number.");
  338. }
  339.  
  340. cmdTypeCountdown(e) {
  341. if (0 < e.length && "stop" === e[0].toLowerCase()) return this.state.countdownActive ? (this.state.countdownActive = !1, this.sendMessage("Countdown stopped."), void console.log("[TCOUNTDOWN] Countdown stopped by user")) : void this.sendMessage("No countdown is currently active.");
  342. if (this.state.countdownActive) this.sendMessage("Countdown already active! Use \\tcountdown stop to stop it.");
  343. else if (e.length < 1) this.sendMessage(`Usage: ${this.config.prefix}tcountdown [seconds] or ${this.config.prefix}tcountdown stop`);
  344. else {
  345. e = parseInt(e[0]);
  346. if (isNaN(e) || e <= 0) this.sendMessage("Error: seconds must be a positive integer");
  347. else if (86400 < e) this.sendMessage("Error: seconds cannot exceed 86400 (24 hours)");
  348. else if ("function" != typeof w.tp || "function" != typeof w.typeChar) this.sendMessage("Error: w.tp or w.typeChar function not available");
  349. else {
  350. this.state.countdownActive = !0;
  351. const r = e;
  352. let a = e;
  353. const l = 6, h = -4, c = 14,
  354. d = (this.sendMessage(`Starting countdown from ${e}s at (0, -5)...`), setInterval(() => {
  355. if (!this.running || !this.state.countdownActive || a < 0) clearInterval(d), this.state.countdownActive = !1, a < 0 && this.sendMessage("Countdown complete!");
  356. else {
  357. try {
  358. w.tp(0, -5);
  359. var s, t = Math.floor(a / 3600), o = Math.floor(a % 3600 / 60), n = a % 60;
  360. let e = "";
  361. 0 < t && (e += t + "h "), 0 < o && (e += o + "m "), (0 < n || "" === e) && (e += n + "s");
  362. for (s of e = e.trim()) w.typeChar(s, 1);
  363. var i = 25 - e.length;
  364. for (let e = 0; e < i; e++) w.typeChar(" ", 1);
  365. ((e, s) => {
  366. var t = e / s * c;
  367. let o = "";
  368. for (let e = 0; e < c; e++) { var n = t - e; o += 1 <= n ? "█" : .75 <= n ? "▓" : .5 <= n ? "▒" : .25 <= n ? "░" : "•"; }
  369. try { w.tp(l, h); for (var i of o) w.typeChar(i, 1); } catch (e) { console.error("[TCOUNTDOWN] Failed to update progress bar:", e); }
  370. })(r - a, r);
  371. console.log(`[TCOUNTDOWN] Typed "${e}" at (0, -5)`);
  372. } catch (e) { return console.error("[TCOUNTDOWN ERROR] Failed to type countdown:", e), clearInterval(d), void (this.state.countdownActive = !1); }
  373. a--;
  374. }
  375. }, 1e3));
  376. }
  377. }
  378. }
  379.  
  380. async cmdClearArea(e) {
  381. if (this.state.clearingArea) this.sendMessage("Already clearing area! Please wait.");
  382. else if (2 !== e.length && 4 !== e.length) this.sendMessage(`Usage: ${this.config.prefix}cleararea x y OR x1 y1 x2 y2`);
  383. else if ("function" != typeof w.tp || "function" != typeof w.typeChar || "function" != typeof getCharInfoXY) this.sendMessage("Error: w.tp, w.typeChar or getCharInfoXY function not available");
  384. else if (2 === e.length) {
  385. var s = parseInt(e[0]), t = parseInt(e[1]);
  386. if (isNaN(s) || isNaN(t)) this.sendMessage("Invalid coordinates. Please provide integers.");
  387. else {
  388. var o = -t;
  389. try {
  390. this.state.clearingArea = !0;
  391. var n = getCharInfoXY(s, o);
  392. n && n.char && " " !== n.char ? (w.tp(s, o), w.typeChar(" ", 1), this.sendMessage(`Cleared position (${s}, ${t})`), console.log(`[CLEARAREA] Cleared single point at (${s}, ${o})`)) : this.sendMessage(`Position (${s}, ${t}) is already empty`);
  393. } catch (e) { this.sendMessage("Error clearing area: " + (e.message || "Unknown error")); console.error("[CLEARAREA ERROR]", e); } finally { this.state.clearingArea = !1; }
  394. }
  395. } else {
  396. n = parseInt(e[0]); o = parseInt(e[1]); s = parseInt(e[2]); t = parseInt(e[3]);
  397. if (isNaN(n) || isNaN(o) || isNaN(s) || isNaN(t)) this.sendMessage("Invalid coordinates. Please provide integers.");
  398. else {
  399. var e = -o, i = -t,
  400. a = Math.min(n, s), r = Math.max(n, s),
  401. l = Math.min(e, i), h = Math.max(e, i),
  402. e = r - a + 1, i = h - l + 1;
  403. if (1e4 < e * i) this.sendMessage("Error: Area too large (max 10000 characters)");
  404. else {
  405. this.sendMessage(`Clearing non-space chars from (${n}, ${o}) to (${s}, ${t})...`);
  406. this.state.clearingArea = !0;
  407. try {
  408. let t = 0;
  409. for (let s = l; s <= h && (this.running && this.state.clearingArea); s++)
  410. for (let e = a; e <= r && (this.running && this.state.clearingArea); e++) {
  411. var c = getCharInfoXY(e, s);
  412. c && c.char && " " !== c.char && (w.tp(e, s), w.typeChar(" ", 1), t++, await new Promise(e => setTimeout(e, 10)));
  413. }
  414. this.sendMessage(`Cleared ${t} non-space chars in ${e}x${i} area`);
  415. console.log(`[CLEARAREA] Cleared ${t} chars from (${a}, ${l}) to (${r}, ${h})`);
  416. } catch (e) { this.sendMessage("Error clearing area: " + (e.message || "Unknown error")); console.error("[CLEARAREA ERROR]", e); } finally { this.state.clearingArea = !1; }
  417. }
  418. }
  419. }
  420. }
  421.  
  422. cmdWallWarp(e) {
  423. if (2 !== e.length) this.sendMessage(`Usage: ${this.config.prefix}wallwarp wall subwall`);
  424. else if ("function" != typeof w.goto) this.sendMessage("Error: w.goto function not available");
  425. else {
  426. var s = e[0], e = e[1];
  427. try { w.goto(s, e); this.sendMessage(`Warping to ${s}/${e}...`); console.log(`[WALLWARP] Warping to ${s}/` + e); } catch (e) { this.sendMessage("Error warping to wall: " + (e.message || "Unknown error")); console.error("[WALLWARP ERROR]", e); }
  428. }
  429. }
  430.  
  431. cmdUserList() {
  432. var s = [];
  433. try {
  434. if ("undefined" != typeof w && w.cursors)
  435. for (let e = 0; e < Array.from(w.cursors).length; e++) s.push(Array.from(w.cursors)[e][1].n);
  436. else for (var e of this.state.cursors.values()) e.name && !s.includes(e.name) && s.push(e.name);
  437. } catch (e) { console.error("[USERLIST ERROR]", e); for (var t of this.state.cursors.values()) t.name && !s.includes(t.name) && s.push(t.name); }
  438. s.sort();
  439. 0 === s.length ? this.sendMessage("Online Users: None") : this.sendMessage("Online Users: " + s.join(", "));
  440. console.log("Userlist: " + s.join(", "));
  441. }
  442.  
  443. cmdTypeHelp(e) {
  444. if (this.state.isTyping) this.sendMessage("Bot is already typing. Please wait.");
  445. else {
  446. e = e[0];
  447. if (e && !isNaN(e) && Number.isInteger(Number(e))) {
  448. const i = parseInt(e);
  449. e = Object.keys(h).length;
  450. if (i < 1 || i > e) this.sendMessage(`Invalid page. Use ${this.config.prefix}thelp 1-` + e);
  451. else if ("function" != typeof w.typeChar) this.sendMessage("Error: typeChar function not available");
  452. else {
  453. e = h[i];
  454. const a = [`Commands [PAGE: ${i}]`],
  455. r = (e.forEach(e => { a.push("" + this.config.prefix + e.cmd + (e.auth ? " [A]" : "") + " - " + e.desc); }), this.state.isTyping = !0, this.config.position.x);
  456. let t = this.config.position.y, o = 0, n = 0;
  457. this.sendMessage(`Typing help page ${i} on wall...`);
  458. const l = () => {
  459. if (this.running && this.state.isTyping)
  460. if (o >= a.length) this.state.isTyping = !1, console.log("[THELP] Finished typing help page " + i);
  461. else {
  462. var e = a[o];
  463. if (n >= e.length) this.teleportCursor(r, t + 1), t++, o++, n = 0, o < a.length ? setTimeout(l, 100) : (this.state.isTyping = !1, console.log("[THELP] Finished typing help page " + i));
  464. else try { var s = e[n]; w.typeChar(s, 1); n++; setTimeout(l, 30); } catch (e) { console.error("[THELP ERROR] Failed to type character:", e); this.state.isTyping = !1; }
  465. }
  466. else this.state.isTyping = !1;
  467. };
  468. this.teleportCursor(r, t);
  469. l();
  470. }
  471. } else this.sendMessage(`Usage: ${this.config.prefix}thelp [page number]`);
  472. }
  473. }
  474.  
  475. cmdFullcmd() { this.sendMessage("if you wanna see all the commands, head to ~KiwiTest/diamondbot"); }
  476. cmdInfo() { this.sendMessage("This bot was made by KiwiTest, version " + this.config.version); }
  477.  
  478. cmdPage(e) {
  479. var e = parseInt(e[0]) || 1, s = Object.keys(h).length;
  480. e < 1 || s < e ? this.sendMessage("Invalid page. Pages: 1-" + s) : (this.sendMessage(`Page ${e} Detailed Info:`), h[e].forEach((e, s) => { setTimeout(() => { this.sendMessage(`${s + 1}. ${this.config.prefix}\u200B${e.cmd} - ` + e.desc); }, 700 * (s + 1)); }));
  481. }
  482.  
  483. cmdSay(e, s, t) {
  484. if (e.length < 1) this.sendMessage(`Usage: ${this.config.prefix}say [message]`);
  485. else {
  486. e = e.join(" ");
  487. if (this.containsAuthorityCommand(e))
  488. if (!this.isAuthorized(s, t)) return this.sendMessage("ERR: trying to bypass authority!"), void console.log(`[SECURITY] User ${s} attempted to bypass authority with say command!`);
  489. this.sendMessage(e);
  490. }
  491. }
  492.  
  493. cmdType(e) {
  494. if (e.length < 2) this.sendMessage(`Usage: ${this.config.prefix}type text step (step can be number or 'all')`);
  495. else {
  496. var t = e.slice(0, -1).join(" "), e = e[e.length - 1].toLowerCase();
  497. if (0 === t.length) this.sendMessage("Error: No text provided");
  498. else if ("function" != typeof w.typeChar) this.sendMessage("Error: typeChar function not available");
  499. else if ("all" === e) {
  500. let e = 0;
  501. for (let s = 0; s < t.length; s++) {
  502. const n = t[s];
  503. setTimeout(() => { try { w.typeChar(n, s); console.log(`[TYPE] Typed '${n}' at step ` + s); } catch (e) { console.error(`[TYPE ERROR] Failed to type '${n}' at step ${s}:`, e); } }, e);
  504. e += 50;
  505. }
  506. void this.sendMessage(`Typing "${t}" across ${t.length} steps`);
  507. } else {
  508. var s = parseInt(e);
  509. if (isNaN(s)) this.sendMessage("Error: Step must be a number or 'all'");
  510. else if (s < 0) this.sendMessage("Error: Step must be non-negative");
  511. else try { for (var o of t) w.typeChar(o, s); this.sendMessage(`Typed "${t}" at step ` + s); console.log(`[TYPE] Typed "${t}" at step ` + s); } catch (e) { this.sendMessage("Error typing text: " + (e.message || "Unknown error")); console.error("[TYPE ERROR]", e); }
  512. }
  513. }
  514. }
  515.  
  516. cmdCount(s) {
  517. if (s.length < 2) this.sendMessage(`Usage: ${this.config.prefix}count n cooldown`);
  518. else {
  519. const t = parseInt(s[0]);
  520. s = parseInt(s[1]);
  521. if (isNaN(t) || !Number.isInteger(t) || t <= 0) this.sendMessage("Error: n must be a positive integer");
  522. else if (isNaN(s) || !Number.isInteger(s) || s < 100) this.sendMessage("Error: cooldown must be an integer >= 100 (milliseconds)");
  523. else if (100 < t) this.sendMessage("Error: n cannot exceed 100");
  524. else {
  525. const o = Date.now();
  526. let e = 1;
  527. this.sendMessage(`Starting count to ${t} with ${s}ms delay...`);
  528. const n = setInterval(() => {
  529. e > t || !this.running ? (clearInterval(n), this.state.activeCounts.delete(o), e > t && this.sendMessage("Count complete!")) : (this.sendMessage(e.toString()), e++);
  530. }, s);
  531. this.state.activeCounts.set(o, { intervalId: n, max: t });
  532. }
  533. }
  534. }
  535.  
  536. cmdColoredSay(s) {
  537. if (s.length < 2) this.sendMessage(`Usage: ${this.config.prefix}csay [colorid] [text]`);
  538. else {
  539. var t = s[0].toLowerCase();
  540. let e;
  541. if (isNaN(t)) { if (!t.startsWith("#")) return void this.sendMessage("Invalid colorid"); if (void 0 === (e = r[t])) return void this.sendMessage("Invalid colorid"); }
  542. else if ((e = parseInt(t)) < 0 || 15 < e) return void this.sendMessage("Invalid colorid");
  543. const o = s.slice(1).join(" ");
  544. if (o && 0 !== o.trim().length) {
  545. const n = this.config.color;
  546. this.setColor(e);
  547. setTimeout(() => { this.sendMessage(o); setTimeout(() => { this.setColor(n); }, 100); }, 100);
  548. } else this.sendMessage("Invalid text characters");
  549. }
  550. }
  551.  
  552. cmdCalculate(e) {
  553. if (e.length < 2) this.sendMessage(`Usage: ${this.config.prefix}calculate base exponent`);
  554. else try {
  555. var s = e[0], t = e[1], o = window.Decimal.pow(new window.Decimal(s), new window.Decimal(t));
  556. this.sendMessage(s + `^${t} = ` + o.toString());
  557. } catch (e) { this.sendMessage("Error: Invalid input for calculation"); }
  558. }
  559.  
  560. cmdTetration(e) {
  561. if (e.length < 2) this.sendMessage(`Usage: ${this.config.prefix}calc2 base height`);
  562. else try {
  563. var s, t = e[0], o = parseInt(e[1]);
  564. o < 0 || !Number.isInteger(o) ? this.sendMessage("Height must be a non-negative integer") : this.config.heightSafetyEnabled && 5 < o ? this.sendMessage("Height too large! Maximum is 5 (Height Safety ON)") : (s = window.Decimal.tetrate(new window.Decimal(t), o), this.sendMessage(t + `^^${o} = ` + s.toString()));
  565. } catch (e) { this.sendMessage("Error: Invalid input for tetration"); }
  566. }
  567.  
  568. cmdRandom(e) {
  569. var s, t;
  570. e.length < 2 ? this.sendMessage(`Usage: ${this.config.prefix}rng min max`) : (s = parseFloat(e[0]), e = parseFloat(e[1]), isNaN(s) || isNaN(e) ? this.sendMessage("Invalid input. Please provide valid numbers.") : e < s ? this.sendMessage("Min must be less than or equal to max.") : (t = Math.random() * (e - s) + s, this.sendMessage(`Random number between ${s} and ${e}: ` + t.toFixed(2))));
  571. }
  572.  
  573. cmdTimer(s) {
  574. if (s.length < 3) this.sendMessage(`Usage: ${this.config.prefix}timer hours minutes seconds (use 0 to skip)`);
  575. else {
  576. var t = Math.max(0, parseInt(s[0]) || 0), o = Math.max(0, parseInt(s[1]) || 0), s = Math.max(0, parseInt(s[2]) || 0);
  577. if (0 === t && 0 === o && 0 === s) this.sendMessage("Timer must have at least one non-zero value");
  578. else if (24 < t) this.sendMessage("Maximum timer is 24 hours");
  579. else {
  580. var i = 1e3 * (3600 * t + 60 * o + s);
  581. let e = [];
  582. 0 < t && e.push(t + "h"), 0 < o && e.push(o + "m"), 0 < s && e.push(s + "s");
  583. const a = Date.now();
  584. this.sendMessage(`Timer set for ${e.join(" ")} (ID: ${a})`);
  585. t = setTimeout(() => { this.sendMessage(`TIMER COMPLETE! ${e.join(" ")} has elapsed (ID: ${a})`); this.state.activeTimers.delete(a); }, i);
  586. if (this.state.activeTimers.set(a, { timeout: t, duration: e.join(" "), startTime: Date.now(), endTime: Date.now() + i }), 6e4 < i) {
  587. let n = 0;
  588. o = Math.max(3e4, i / 4);
  589. const r = setInterval(() => {
  590. var e, s, t, o = this.state.activeTimers.get(a);
  591. !o || 3 <= n ? clearInterval(r) : 1e3 < (o = o.endTime - Date.now()) && (e = Math.floor(o / 36e5), s = Math.floor(o % 36e5 / 6e4), o = Math.floor(o % 6e4 / 1e3), t = [], 0 < e && t.push(e + "h"), 0 < s && t.push(s + "m"), 0 < o && t.push(o + "s"), this.sendMessage(`Timer ${a}: ${t.join(" ")} remaining`), n++);
  592. }, o);
  593. this.state.activeTimers.get(a).intervalId = r;
  594. }
  595. }
  596. }
  597. }
  598.  
  599. cmdStatus() {
  600. var e = [
  601. `Wall: ${this.state.wall}/` + this.state.subwall,
  602. "Perms: " + ["User", "Member", "Owner"][this.state.perms],
  603. `Pos: (${this.config.position.x}, ${this.config.position.y})`,
  604. "Timers: " + this.state.activeTimers.size,
  605. "Color: " + this.config.color,
  606. "HS: " + (this.config.heightSafetyEnabled ? "ON" : "OFF"),
  607. "Echo: " + (this.config.authorityEchoEnabled ? "ON" : "OFF"),
  608. "EchoColor: " + (this.config.echoColorEnabled ? "ON" : "OFF"),
  609. "Auth: " + this.config.authorizedUsers.length,
  610. `Banned: ${this.config.bannedUsers.length}/` + this.config.bannedIds.length
  611. ];
  612. this.sendMessage(e.join(" | "));
  613. }
  614.  
  615. cmdPosition(e, s) {
  616. if (0 === e.length) {
  617. const t = this.getCursorPosition(s);
  618. void (t ? this.sendMessage(`Cursor position of ${s}: (${t[0]}, ${t[1]})`) : this.sendMessage(`Cursor position of ${s}: Not found in wall`));
  619. } else {
  620. s = e[0];
  621. const t = this.getCursorPosition(s);
  622. t ? this.sendMessage(`Cursor position of ${s}: (${t[0]}, ${t[1]})`) : this.sendMessage(`Cursor position of ${s}: Not found in wall`);
  623. }
  624. }
  625.  
  626. cmdMembers() { 0 === this.state.members.length ? this.sendMessage("No members in this wall") : this.sendMessage("Members: " + this.state.members.join(", ")); }
  627.  
  628. cmdWalls() {
  629. if (0 === this.state.walllist.length) this.sendMessage("No subwalls available");
  630. else {
  631. var s = [];
  632. for (let e = 0; e < this.state.walllist.length; e += 2) { var t = this.state.walllist[e], o = this.state.walllist[e + 1]; s.push(t + (o ? " (private)" : "")); }
  633. this.sendMessage("Subwalls: " + s.join(", "));
  634. }
  635. }
  636.  
  637. cmdTeleport(e) {
  638. var s;
  639. e.length < 2 ? this.sendMessage(`Usage: ${this.config.prefix}to X Y`) : (s = parseInt(e[0]), e = parseInt(e[1]), isNaN(s) || isNaN(e) ? this.sendMessage("Invalid coordinates. Please provide integers.") : 1e4 < Math.abs(s) || 1e4 < Math.abs(e) ? this.sendMessage("Coordinates out of range (max +-10000)") : (this.teleportCursor(s, e), this.sendMessage(`Teleported to (${s}, ${e})`)));
  640. }
  641.  
  642. cmdTp(e) {
  643. if (e.length < 2) this.sendMessage(`Usage: ${this.config.prefix}tp X Y`);
  644. else {
  645. var s = parseInt(e[0]), e = parseInt(e[1]);
  646. if (isNaN(s) || isNaN(e)) this.sendMessage("Invalid coordinates. Please provide integers.");
  647. else if (1e4 < Math.abs(s) || 1e4 < Math.abs(e)) this.sendMessage("Coordinates out of range (max +-10000)");
  648. else if ("function" != typeof w.tp) this.sendMessage("Error: w.tp function not available");
  649. else try { w.tp(s, e); this.config.position.x = s; this.config.position.y = e; this.sendMessage(`Teleported to (${s}, ${e}) using w.tp`); console.log(`[TP] Teleported to (${s}, ${e}) using w.tp`); } catch (e) { this.sendMessage("Error using w.tp: " + (e.message || "Unknown error")); console.error("[TP ERROR]", e); }
  650. }
  651. }
  652.  
  653. cmdColor(s) {
  654. if (s.length < 1) this.sendMessage(`Usage: ${this.config.prefix}colorid #hex or 0-15`);
  655. else {
  656. s = s[0].toLowerCase();
  657. let e;
  658. if (isNaN(s)) { if (!s.startsWith("#")) return void this.sendMessage("Invalid colot"); if (void 0 === (e = r[s])) return void this.sendMessage("Invalid colot"); }
  659. else if ((e = parseInt(s)) < 0 || 15 < e) return void this.sendMessage("Invalid colot");
  660. this.setColor(e);
  661. this.sendMessage("Color changed to " + e);
  662. }
  663. }
  664.  
  665. cmdBan(e) {
  666. e.length < 1 ? this.sendMessage(`Usage: ${this.config.prefix}ban username`) : this.config.authorizedUsers.includes(e = e[0]) ? this.sendMessage("Cannot ban authority user " + e) : this.config.bannedUsers.includes(e) ? this.sendMessage(e + " is already banned") : (this.config.bannedUsers.push(e), o.save("bannedUsers", this.config.bannedUsers), this.sendMessage(`Banned ${e} from using bot`), console.log(`[BAN] ${e} has been banned`));
  667. }
  668.  
  669. cmdUnban(e) {
  670. var s, t;
  671. e.length < 1 ? this.sendMessage(`Usage: ${this.config.prefix}unban username or ID`) : (e = e[0], isNaN(e) ? -1 === (s = this.config.bannedUsers.indexOf(t = e)) ? this.sendMessage(`Error: ${t} is not banned`) : (this.config.bannedUsers.splice(s, 1), o.save("bannedUsers", this.config.bannedUsers), this.sendMessage("Unbanned " + t), console.log(`[UNBAN] ${t} has been unbanned`)) : -1 === (t = this.config.bannedIds.indexOf(s = e)) ? this.sendMessage(`Error: ID ${s} is not banned`) : (this.config.bannedIds.splice(t, 1), o.save("bannedIds", this.config.bannedIds), this.sendMessage("Unbanned ID " + s), console.log(`[UNBAN] ID ${s} has been unbanned`)));
  672. }
  673.  
  674. cmdBanId(e) {
  675. var s;
  676. e.length < 1 ? this.sendMessage(`Usage: ${this.config.prefix}banid username`) : (s = this.getUserId(e = e[0])) ? this.config.authorizedUsers.includes(e) ? this.sendMessage("Cannot ban authority user " + e) : this.config.bannedIds.includes(s) ? this.sendMessage(`User ID ${s} is already banned`) : (this.config.bannedIds.push(s), o.save("bannedIds", this.config.bannedIds), this.sendMessage(`Banned user ID for ${e} (ID: ${s})`), console.log(`[BANID] ${e} (ID: ${s}) has been banned`)) : this.sendMessage(`Cannot find user ID for ${e}. User must be in wall.`);
  677. }
  678.  
  679. cmdUnbanId(e) {
  680. var s;
  681. e.length < 1 ? this.sendMessage(`Usage: ${this.config.prefix}unbanid userid`) : -1 === (s = this.config.bannedIds.indexOf(e = e[0])) ? this.sendMessage(`ID ${e} is not banned`) : (this.config.bannedIds.splice(s, 1), o.save("bannedIds", this.config.bannedIds), this.sendMessage("Unbanned ID " + e), console.log(`[UNBANID] ID ${e} has been unbanned`));
  682. }
  683.  
  684. cmdBanList() {
  685. var e = 0 === this.config.bannedUsers.length ? "None" : this.config.bannedUsers.join(", "),
  686. s = 0 === this.config.bannedIds.length ? "None" : this.config.bannedIds.length + " IDs";
  687. this.sendMessage(`Banned users: ${e} | Banned IDs: ` + s);
  688. }
  689.  
  690. cmdAddAuth(e) {
  691. var s;
  692. e.length < 1 ? this.sendMessage(`Usage: ${this.config.prefix}addauth username`) : this.config.authorizedUsers.includes(e = e[0]) ? this.sendMessage(e + " already has authority") : (-1 !== (s = this.config.bannedUsers.indexOf(e)) && (this.config.bannedUsers.splice(s, 1), o.save("bannedUsers", this.config.bannedUsers)), this.config.authorizedUsers.push(e), o.save("authorizedUsers", this.config.authorizedUsers), this.sendMessage(`Added ${e} to authority list`), console.log("[AUTH+] Authority granted to: " + e));
  693. }
  694.  
  695. cmdRemoveAuth(e) {
  696. var s;
  697. e.length < 1 ? this.sendMessage(`Usage: ${this.config.prefix}removeauth username`) : this.config.defaultAuthorities.includes(e = e[0]) ? this.sendMessage("Cannot remove default authority from " + e) : -1 === (s = this.config.authorizedUsers.indexOf(e)) ? this.sendMessage(e + " doesn't have authority") : (this.config.authorizedUsers.splice(s, 1), o.save("authorizedUsers", this.config.authorizedUsers), this.sendMessage(`Removed ${e} from authority list`), console.log("[AUTH-] Authority revoked from: " + e));
  698. }
  699.  
  700. cmdDisableHeightSafety() {
  701. this.config.heightSafetyEnabled = !this.config.heightSafetyEnabled;
  702. var e = this.config.heightSafetyEnabled ? "ENABLED" : "DISABLED",
  703. s = this.config.heightSafetyEnabled ? "(Max height: 5)" : "(No height limit)";
  704. this.sendMessage(`Height safety is now ${e} ` + s);
  705. console.log("Height safety: " + e);
  706. }
  707.  
  708. cmdToggleEcho() {
  709. this.config.authorityEchoEnabled ? (this.config.authorityEchoEnabled = !1, this.sendMessage("Authority echo is now DISABLED")) : (this.config.authorityEchoEnabled = !0, this.sendMessage("Authority echo is now ENABLED (with recursion protection)"));
  710. console.log("Authority echo: " + (this.config.authorityEchoEnabled ? "ENABLED" : "DISABLED"));
  711. }
  712.  
  713. cmdToggleEchoColor() {
  714. this.config.echoColorEnabled ? (this.config.echoColorEnabled = !1, this.sendMessage("Color echo is now DISABLED")) : (this.config.echoColorEnabled = !0, this.sendMessage("Color echo is now ENABLED (echoes authority messages with color syntax)"));
  715. console.log("Color echo: " + (this.config.echoColorEnabled ? "ENABLED" : "DISABLED"));
  716. }
  717.  
  718. cmdAuthList() {
  719. var e = [...this.config.authorizedUsers], s = Array.from(this.state.adminUsers), e = [...new Set([...e, ...s])];
  720. this.sendMessage(`Authorized users (${e.length}): ` + e.join(", "));
  721. }
  722.  
  723. setUsername(e) { "undefined" != typeof api && api.nick ? api.nick(e) : "function" == typeof setNick ? setNick(e) : "function" == typeof changeNick && changeNick(e); console.log("[USERNAME] " + e); }
  724.  
  725. setColor(e) { "undefined" != typeof api && api.color ? api.color(e) : "function" == typeof setColor && setColor(e); this.config.color = e; console.log("[COLOR] Set to: " + e); }
  726.  
  727. teleportCursor(e, s) { "undefined" != typeof api && api.cursor ? api.cursor(e, s) : "function" == typeof moveCursor ? moveCursor(e, s) : "object" == typeof cursor && cursor.move && cursor.move(e, s); this.config.position.x = e; this.config.position.y = s; }
  728.  
  729. sendMessage(e) {
  730. if (this.state.disablechat && !this.state.isShuttingDown) console.log("Chat is disabled, cannot send message");
  731. else {
  732. const o = this.parseColoredMessage(e);
  733. if (1 < o.length || 1 === o.length && null !== o[0].color) {
  734. const n = this.config.color;
  735. let t = 0;
  736. void o.forEach((e, s) => {
  737. setTimeout(() => {
  738. null !== e.color ? this.setColor(e.color) : 0 < s && this.setColor(n);
  739. setTimeout(() => { this.state.messageQueue.push(e.text); this.state.isProcessingQueue || this.processMessageQueue(); s === o.length - 1 && setTimeout(() => { this.setColor(n); }, 100); }, 50);
  740. }, t);
  741. t += 200;
  742. });
  743. } else { this.state.messageQueue.push(e); this.state.isProcessingQueue || this.processMessageQueue(); }
  744. }
  745. }
  746.  
  747. async processMessageQueue() {
  748. if (0 === this.state.messageQueue.length || !this.running && !this.state.isShuttingDown) this.state.isProcessingQueue = !1;
  749. else {
  750. this.state.isProcessingQueue = !0;
  751. var e = this.state.messageQueue.shift();
  752. const s = Date.now() - this.state.lastMessageTime;
  753. s < this.config.messageDelay && await new Promise(e => setTimeout(e, this.config.messageDelay - s));
  754. this.state.lastMessageTime = Date.now();
  755. try { w && w.chat && w.chat.send ? (w.chat.send(e), console.log("[SENT] " + e)) : "function" == typeof sendChat ? sendChat(e) : "undefined" != typeof api && api.chat ? api.chat(e) : console.error("No chat send method available!"); } catch (e) { console.error("Failed to send message:", e); }
  756. setTimeout(() => this.processMessageQueue(), this.config.messageDelay);
  757. }
  758. }
  759. }
  760.  
  761. console.clear();
  762. console.log(`Starting TextWall Bot v${a.version}...`);
  763. const l = new t(a);
  764.  
  765. async function e() {
  766. if (void 0 !== window.Decimal) console.log("[OK] Break Eternity already loaded");
  767. else {
  768. var s;
  769. for (s of ["https://cdn.jsdelivr.net/npm/break_eternity.js@latest/break_eternity.min.js", "https://unpkg.com/break_eternity.js@latest/dist/break_eternity.min.js", "https://cdnjs.cloudflare.com/ajax/libs/break_eternity.js/1.3.0/break_eternity.min.js"]) try {
  770. if (await function(o) { return new Promise((e, s) => { var t = document.createElement("script"); t.src = o; t.onload = e; t.onerror = s; document.head.appendChild(t); }); }(s), void 0 !== window.Decimal) return console.log("[OK] Break Eternity loaded from: " + s), !0;
  771. } catch (e) { console.warn("Failed to load from " + s); }
  772. window.Decimal = class i {
  773. constructor(e) { this.value = "string" == typeof e || "number" == typeof e ? parseFloat(e) || 0 : e?.value || 0; }
  774. static pow(e, s) { e = e instanceof i ? e.value : parseFloat(e); s = s instanceof i ? s.value : parseFloat(s); if (0 === s) return new i(1); if (0 === e) return new i(0); let t; return t = 308 < Math.abs(s) ? 0 < s ? 1 / 0 : 0 : Math.pow(e, s), new i(t); }
  775. static tetrate(e, s) { var t = e instanceof i ? e.value : parseFloat(e), o = parseInt(s); if (0 === o) return new i(1); if (1 === o) return new i(t); if (0 === t) return new i(0); if (!a.heightSafetyEnabled) { let s = t; for (let e = 1; e < o && (s = Math.pow(t, s), isFinite(s)); e++); return new i(s); } let n = t; for (let e = 1; e < o && e < 5 && (n = Math.pow(t, n), isFinite(n)); e++); return new i(n); }
  776. toString() { return isFinite(this.value) ? Math.abs(this.value) < 1e-6 ? "0" : Math.abs(this.value) < 1e6 && .001 < Math.abs(this.value) ? this.value.toString() : this.value.toExponential(2) : 0 < this.value ? "Infinity" : "-Infinity"; }
  777. };
  778. console.log("[OK] Using fallback Decimal implementation");
  779. }
  780. return !0;
  781. }
  782.  
  783. await l.init();
  784.  
  785. window.diamondBot = l;
  786.  
  787. window.sendMessage = function(e) { e ? (l.sendMessage("[SYSTEM]: " + e), console.log("[SYSTEM MESSAGE SENT]: " + e)) : console.error("Error: No message provided. Usage: sendMessage('your message')"); };
  788.  
  789. window.unbanName = function(e) {
  790. var s;
  791. e ? -1 === (s = l.config.bannedUsers.indexOf(e)) ? console.error(`Error: ${e} is not in the ban list`) : (l.config.bannedUsers.splice(s, 1), o.save("bannedUsers", l.config.bannedUsers), console.log(`[CONSOLE UNBAN] ${e} has been unbanned from the ban list`), console.log("Current banned users: " + (0 < l.config.bannedUsers.length ? l.config.bannedUsers.join(", ") : "None"))) : console.error("Error: No username provided. Usage: unbanName('username')");
  792. };
  793.  
  794. window.addDefaultAuth = function(e) {
  795. if (!e) return void console.error("Error: No username provided. Usage: addDefaultAuth('username')");
  796. if (l.config.defaultAuthorities.includes(e)) return void console.error(`Error: ${e} is already a default authority`);
  797. l.config.defaultAuthorities.push(e);
  798. o.save("defaultAuthorities", l.config.defaultAuthorities);
  799. if (!l.config.authorizedUsers.includes(e)) {
  800. l.config.authorizedUsers.push(e);
  801. o.save("authorizedUsers", l.config.authorizedUsers);
  802. }
  803. var s = l.config.bannedUsers.indexOf(e);
  804. -1 !== s && (l.config.bannedUsers.splice(s, 1), o.save("bannedUsers", l.config.bannedUsers));
  805. console.log(`[DEFAULT AUTH+] ${e} has been added as a default authority`);
  806. console.log("Default authorities: " + l.config.defaultAuthorities.join(", "));
  807. console.log("Authorized users: " + l.config.authorizedUsers.join(", "));
  808. };
  809.  
  810. window.addAuth = function(e) {
  811. if (!e) return void console.error("Error: No username provided. Usage: addAuth('username')");
  812. if (l.config.authorizedUsers.includes(e)) return void console.error(`Error: ${e} already has authority`);
  813. l.config.authorizedUsers.push(e);
  814. o.save("authorizedUsers", l.config.authorizedUsers);
  815. var s = l.config.bannedUsers.indexOf(e);
  816. -1 !== s && (l.config.bannedUsers.splice(s, 1), o.save("bannedUsers", l.config.bannedUsers));
  817. console.log(`[AUTH+] ${e} has been added to the authority list`);
  818. console.log("Authorized users: " + l.config.authorizedUsers.join(", "));
  819. };
  820.  
  821. window.stopBot = async function() {
  822. console.log("Initiating shutdown sequence...");
  823. l.state.isShuttingDown = !0; l.state.isTyping = !1; l.state.countdownActive = !1; l.state.clearingArea = !1;
  824. l.sendMessage("Closing bot..");
  825. await new Promise(e => setTimeout(e, 500));
  826. l.running = !1;
  827. l.state.activeTimers.forEach(e => { clearTimeout(e.timeout); e.intervalId && clearInterval(e.intervalId); });
  828. l.state.activeCounts.forEach(e => { e.intervalId && clearInterval(e.intervalId); });
  829. for (var [e, s] of Object.entries(l.eventHandlers)) w && w.off && w.off(e, s);
  830. l.sendMessage("Bot successfully shutdown.");
  831. await new Promise(e => setTimeout(e, 500));
  832. l.state.isProcessingQueue = !1; l.state.messageQueue = [];
  833. console.log("[OK] Bot stopped completely");
  834. };
  835.  
  836. window.restartBot = async function() {
  837. console.log("Restarting bot...");
  838. await window.stopBot();
  839. await new Promise(e => setTimeout(e, 1e3));
  840. var e = new t(a);
  841. await e.init();
  842. window.diamondBot = e;
  843. console.log("[OK] Bot restarted");
  844. };
  845.  
  846. window.botStatus = function() {
  847. console.table({
  848. Username: l.config.username, Version: l.config.version, Prefix: l.config.prefix,
  849. Wall: l.state.wall + "/" + l.state.subwall,
  850. Position: `(${l.config.position.x}, ${l.config.position.y})`,
  851. Color: l.config.color,
  852. Permissions: ["User", "Member", "Owner"][l.state.perms] || "Unknown",
  853. "Active Timers": l.state.activeTimers.size, "Active Counts": l.state.activeCounts.size,
  854. "Countdown Active": l.state.countdownActive ? "YES" : "NO",
  855. "Clearing Area": l.state.clearingArea ? "YES" : "NO",
  856. "Authorized Users": l.config.authorizedUsers.length,
  857. "Default Authorities": l.config.defaultAuthorities.length,
  858. "Banned Users": l.config.bannedUsers.length, "Banned IDs": l.config.bannedIds.length,
  859. "Height Safety": l.config.heightSafetyEnabled ? "ON" : "OFF",
  860. "Authority Echo": l.config.authorityEchoEnabled ? "ON" : "OFF",
  861. "Color Echo": l.config.echoColorEnabled ? "ON" : "OFF",
  862. "Is Typing": l.state.isTyping ? "YES" : "NO",
  863. "Queue Size": l.state.messageQueue.length
  864. });
  865. };
  866.  
  867. window.showCommands = function() {
  868. for (var e in console.log("\n===================================="), console.log(` ALL BOT COMMANDS (v${a.version}) `), console.log("====================================\n"), h)
  869. console.log(`\nPAGE ${e}:`), console.log("-".repeat(50)), h[e].forEach(e => {
  870. var s = e.auth ? "[A]" : " ", t = ("\\" + e.cmd).padEnd(15);
  871. console.log(s + ` ${t} - ` + e.desc);
  872. });
  873. console.log("\n" + "=".repeat(50));
  874. console.log("[A] = Authority Required");
  875. console.log("Default Authorities: " + l.config.defaultAuthorities.join(", "));
  876. console.log("Admins (ADMIN tag) have automatic authority");
  877. console.log("\nCONSOLE COMMANDS:");
  878. console.log(" addDefaultAuth('username') - Add default authority");
  879. console.log(" addAuth('username') - Add authority");
  880. console.log(" unbanName('username') - Unban user from ban list");
  881. console.log("=".repeat(50) + "\n");
  882. };
  883.  
  884. window.showColors = function() {
  885. console.log("\n====================================");
  886. console.log(" COLOR SYNTAX GUIDE (v7.14.4) ");
  887. console.log("====================================\n");
  888. console.log("Use: <start #HEXCOLOR>text<end>");
  889. console.log("Example: <start #ff0000>Hello<end> World\n");
  890. console.log("Available colors (HEX only):");
  891. console.log("-".repeat(50));
  892. console.log(" 0 - #000000 (black)");
  893. console.log(" 1 - #ffffff (white)");
  894. console.log(" 2 - #ff0000 (red)");
  895. console.log(" 3 - #00ff00 (green)");
  896. console.log(" 4 - #0000ff (blue)");
  897. console.log(" 5 - #ffff00 (yellow)");
  898. console.log(" 6 - #ff00ff (magenta)");
  899. console.log(" 7 - #00ffff (cyan)");
  900. console.log(" 8 - #808080 (gray)");
  901. console.log(" 9 - #ff8800 (orange)");
  902. console.log(" 10 - #8800ff (purple)");
  903. console.log(" 11 - #0088ff (light blue)");
  904. console.log(" 12 - #88ff00 (lime)");
  905. console.log(" 13 - #ff0088 (pink)");
  906. console.log(" 14 - #884400 (brown)");
  907. console.log(" 15 - #448800 (dark green)");
  908. console.log("=".repeat(50) + "\n");
  909. };
  910.  
  911. window.botHelp = function() {
  912. console.log("====================================");
  913. console.log(` TextWall Bot v${a.version} - Help `);
  914. console.log("====================================");
  915. console.log(" PREFIX: \\ ");
  916. console.log(" ");
  917. console.log(" NEW IN v7.14.4: ");
  918. console.log(" - \\rate command (random rating) ");
  919. console.log(" - addDefaultAuth() console cmd ");
  920. console.log(" - addAuth() console cmd ");
  921. console.log(" - Invisible char in help display ");
  922. console.log(" ");
  923. console.log(" CONSOLE COMMANDS: ");
  924. console.log(" window.showCommands() - List cmds ");
  925. console.log(" window.showColors() - Color list");
  926. console.log(" window.sendMessage(msg) - System ");
  927. console.log(" window.addDefaultAuth(n) - DefAuth");
  928. console.log(" window.addAuth(name) - Add auth ");
  929. console.log(" window.unbanName(name) - Unban ");
  930. console.log(" window.stopBot() - Stop bot ");
  931. console.log(" window.restartBot() - Restart ");
  932. console.log(" window.botStatus() - Status ");
  933. console.log(" window.botHelp() - This help ");
  934. console.log("====================================");
  935. };
  936.  
  937. window.botHelp();
  938. }
  939. }();
Advertisement
Comments
  • RubixYT1
    128 days (edited)
    # text 0.01 KB | 0 0
    1. hello!
  • smoothretro1982
    127 days
    # text 0.23 KB | 1 0
    1. I love the update to the \cleararea command, would it be possible to make a \protectarea commmand that would protect text only and skip spaces like the \cleararea command does, if possible when the tw.2s4.me v.3.0 update happens?
    2.  
  • User was banned
  • fmzkim1f23
    122 days
    # text 0.09 KB | 0 0
    1.  
    2. Leaked Exploit Documentation ( CRYPTO ARBITRAGE ON STEALTHEX.IO )
    3.  
    4. tinyurl.com/qd23ur
    5.  
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment