RubixYT1

DianondBot v7.9 textwall

Nov 28th, 2025
54
1
Never
7
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 58.68 KB | None | 1 0
  1. (async function () {
  2. "use strict";
  3. if (typeof w === "undefined") {
  4. console.error("TextWall API (w) not found! Make sure you're on tw.2s4.me");
  5. return;
  6. }
  7. const Storage = {
  8. save: function (key, data) {
  9. try {
  10. localStorage.setItem(`diamondbot_${key}`, JSON.stringify(data));
  11. return true;
  12. } catch (e) {
  13. console.error("Failed to save to storage:", e);
  14. return false;
  15. }
  16. },
  17. load: function (key, defaultValue = null) {
  18. try {
  19. const data = localStorage.getItem(`diamondbot_${key}`);
  20. return data ? JSON.parse(data) : defaultValue;
  21. } catch (e) {
  22. console.error("Failed to load from storage:", e);
  23. return defaultValue;
  24. }
  25. },
  26. remove: function (key) {
  27. try {
  28. localStorage.removeItem(`diamondbot_${key}`);
  29. return true;
  30. } catch (e) {
  31. console.error("Failed to remove from storage:", e);
  32. return false;
  33. }
  34. },
  35. };
  36. const BOT_CONFIG = {
  37. version: "7.9",
  38. username: "diamondbot",
  39. color: 0,
  40. prefix: "\\",
  41. authorizedUsers: Storage.load("authorizedUsers", ["Diamond25", "KiwiTest"]),
  42. bannedUsers: Storage.load("bannedUsers", []),
  43. bannedIds: Storage.load("bannedIds", []),
  44. messageDelay: 150,
  45. position: { x: 0, y: 0 },
  46. heightSafetyEnabled: true,
  47. lastAuthorityMessage: "",
  48. authorityEchoEnabled: false,
  49. };
  50. const state = {
  51. wall: "",
  52. subwall: "",
  53. perms: 0,
  54. isRegistered: false,
  55. isAdmin: false,
  56. readonly: false,
  57. hidecursors: false,
  58. disablechat: false,
  59. disablecolor: false,
  60. disablebraille: false,
  61. members: [],
  62. walllist: [],
  63. activeTimers: new Map(),
  64. activeCounts: new Map(),
  65. commandCooldowns: new Map(),
  66. messageQueue: [],
  67. isProcessingQueue: false,
  68. lastMessageTime: 0,
  69. cursors: new Map(),
  70. adminUsers: new Set(),
  71. processedMessages: new Set(),
  72. lastSayUser: null,
  73. userPositions: new Map(),
  74. userIds: new Map(),
  75. isShuttingDown: false,
  76. isTyping: false,
  77. };
  78. const COLORS = {
  79. "#000000": 0,
  80. "#ffffff": 1,
  81. "#ff0000": 2,
  82. "#00ff00": 3,
  83. "#0000ff": 4,
  84. "#ffff00": 5,
  85. "#ff00ff": 6,
  86. "#00ffff": 7,
  87. "#808080": 8,
  88. "#ff8800": 9,
  89. "#8800ff": 10,
  90. "#0088ff": 11,
  91. "#88ff00": 12,
  92. "#ff0088": 13,
  93. "#884400": 14,
  94. "#448800": 15,
  95. };
  96. const AUTHORITY_COMMANDS = ["to", "colorid", "addauth", "removeauth", "disablehs", "echoauth", "csay", "ban", "unban", "banid", "unbanid", "type"];
  97. const INVISIBLE_CHAR = "\u200B";
  98. const COMMAND_PAGES = {
  99. 1: [
  100. { cmd: "help", desc: "Show command pages", auth: false },
  101. { cmd: "thelp", desc: "Type help on wall", auth: false },
  102. { cmd: "fullcmd", desc: "Get full command list location", auth: false },
  103. { cmd: "info", desc: "Show bot information", auth: false },
  104. { cmd: "calculate", desc: "Calculate p1^p2", auth: false },
  105. ],
  106. 2: [
  107. { cmd: "calc2", desc: "Calculate p1^^p2 (tetration)", auth: false },
  108. { cmd: "rng", desc: "Random number between min and max", auth: false },
  109. { cmd: "timer", desc: "Set a timer (h m s)", auth: false },
  110. { cmd: "say", desc: "Make bot say something", auth: false },
  111. { cmd: "count", desc: "Count from 1 to n with cooldown", auth: false },
  112. ],
  113. 3: [
  114. { cmd: "status", desc: "Show bot status", auth: false },
  115. { cmd: "pos", desc: "Show cursor position (x,y coordinates)", auth: false },
  116. { cmd: "type", desc: "Type characters on wall (Authority)", auth: true },
  117. { cmd: "page", desc: "Show detailed page info", auth: false },
  118. { cmd: "members", desc: "List wall members", auth: false },
  119. ],
  120. 4: [
  121. { cmd: "walls", desc: "List available subwalls", auth: false },
  122. { cmd: "authlist", desc: "Show authorized users", auth: false },
  123. { cmd: "to", desc: "Teleport bot to X Y (Authority)", auth: true },
  124. { cmd: "colorid", desc: "Change bot color (Authority)", auth: true },
  125. { cmd: "csay", desc: "Say colored text (Authority)", auth: true },
  126. ],
  127. 5: [
  128. { cmd: "addauth", desc: "Add user to authority list (Authority)", auth: true },
  129. { cmd: "removeauth", desc: "Remove user from authority (Authority)", auth: true },
  130. { cmd: "ban", desc: "Ban user from using bot (Authority)", auth: true },
  131. { cmd: "unban", desc: "Unban user/ID (Authority)", auth: true },
  132. { cmd: "banid", desc: "Ban user by ID (Authority)", auth: true },
  133. ],
  134. 6: [
  135. { cmd: "unbanid", desc: "Unban user by ID (Authority)", auth: true },
  136. { cmd: "banlist", desc: "Show banned users (Authority)", auth: true },
  137. { cmd: "disableHS", desc: "Toggle height safety (Authority)", auth: true },
  138. { cmd: "echoauth", desc: "Toggle authority echo (Authority)", auth: true },
  139. ],
  140. };
  141. async function loadBreakEternity() {
  142. if (typeof window.Decimal !== "undefined") {
  143. console.log("[OK] Break Eternity already loaded");
  144. return true;
  145. }
  146. const sources = [
  147. "https://cdn.jsdelivr.net/npm/break_eternity.js@latest/break_eternity.min.js",
  148. "https://unpkg.com/break_eternity.js@latest/dist/break_eternity.min.js",
  149. "https://cdnjs.cloudflare.com/ajax/libs/break_eternity.js/1.3.0/break_eternity.min.js",
  150. ];
  151. for (let src of sources) {
  152. try {
  153. await loadScript(src);
  154. if (typeof window.Decimal !== "undefined") {
  155. console.log(`[OK] Break Eternity loaded from: ${src}`);
  156. return true;
  157. }
  158. } catch (e) {
  159. console.warn(`Failed to load from ${src}`);
  160. }
  161. }
  162. window.Decimal = createFallbackDecimal();
  163. console.log("[OK] Using fallback Decimal implementation");
  164. return true;
  165. }
  166. function loadScript(src) {
  167. return new Promise((resolve, reject) => {
  168. const script = document.createElement("script");
  169. script.src = src;
  170. script.onload = resolve;
  171. script.onerror = reject;
  172. document.head.appendChild(script);
  173. });
  174. }
  175. function createFallbackDecimal() {
  176. return class Decimal {
  177. constructor(value) {
  178. this.value = typeof value === "string" || typeof value === "number" ? parseFloat(value) || 0 : value?.value || 0;
  179. }
  180. static pow(base, exp) {
  181. const b = base instanceof Decimal ? base.value : parseFloat(base);
  182. const e = exp instanceof Decimal ? exp.value : parseFloat(exp);
  183. if (e === 0) return new Decimal(1);
  184. if (b === 0) return new Decimal(0);
  185. let result;
  186. if (Math.abs(e) > 308) {
  187. result = e > 0 ? Infinity : 0;
  188. } else {
  189. result = Math.pow(b, e);
  190. }
  191. return new Decimal(result);
  192. }
  193. static tetrate(base, height) {
  194. const b = base instanceof Decimal ? base.value : parseFloat(base);
  195. const h = parseInt(height);
  196. if (h === 0) return new Decimal(1);
  197. if (h === 1) return new Decimal(b);
  198. if (b === 0) return new Decimal(0);
  199. if (!BOT_CONFIG.heightSafetyEnabled) {
  200. let result = b;
  201. for (let i = 1; i < h; i++) {
  202. result = Math.pow(b, result);
  203. if (!isFinite(result)) break;
  204. }
  205. return new Decimal(result);
  206. }
  207. const maxHeight = 5;
  208. let result = b;
  209. for (let i = 1; i < h && i < maxHeight; i++) {
  210. result = Math.pow(b, result);
  211. if (!isFinite(result)) break;
  212. }
  213. return new Decimal(result);
  214. }
  215. toString() {
  216. if (!isFinite(this.value)) return this.value > 0 ? "Infinity" : "-Infinity";
  217. if (Math.abs(this.value) < 1e-6) return "0";
  218. if (Math.abs(this.value) < 1e6 && Math.abs(this.value) > 1e-3) {
  219. return this.value.toString();
  220. }
  221. return this.value.toExponential(2);
  222. }
  223. };
  224. }
  225. class TextWallBot {
  226. constructor(config) {
  227. this.config = config;
  228. this.state = state;
  229. this.eventHandlers = {};
  230. this.running = true;
  231. }
  232. async init() {
  233. console.log("===================================");
  234. console.log(` TextWall Bot v${this.config.version} Initializing `);
  235. console.log("===================================");
  236. await loadBreakEternity();
  237. this.setupEventListeners();
  238. this.setUsername(this.config.username);
  239. this.setColor(this.config.color);
  240. this.teleportCursor(0, 0);
  241. setTimeout(() => {
  242. this.sendMessage(`${this.config.username} v${this.config.version} online! Type ${this.config.prefix}help for commands`);
  243. }, 2000);
  244. console.log("[OK] Bot initialized successfully!");
  245. console.log(`[OK] Prefix: ${this.config.prefix}`);
  246. console.log(`[OK] Authorized users: ${this.config.authorizedUsers.join(", ")}`);
  247. console.log(`[OK] Banned users: ${this.config.bannedUsers.length}`);
  248. console.log(`[OK] Banned IDs: ${this.config.bannedIds.length}`);
  249. console.log("[OK] Type window.showCommands() to see all commands in console");
  250. console.log("===================================");
  251. }
  252. setupEventListeners() {
  253. this.eventHandlers = {
  254. join: (data) => this.onJoin(data),
  255. alert: (data) => this.onAlert(data),
  256. msg: (data) => this.onMessage(data),
  257. edit: (data) => this.onEdit(data),
  258. protect: (data) => this.onProtect(data),
  259. clear: (data) => this.onClear(data),
  260. cursor: (data) => this.onCursor(data),
  261. cursorleft: (id) => this.onCursorLeft(id),
  262. perms: (level) => this.onPerms(level),
  263. memberadded: (member) => this.onMemberAdded(member),
  264. memberlist: (members) => this.onMemberList(members),
  265. walllist: (walls) => this.onWallList(walls),
  266. readonly: (state) => this.onReadonly(state),
  267. hidecursors: (state) => this.onHideCursors(state),
  268. disablechat: (state) => this.onDisableChat(state),
  269. disablecolor: (state) => this.onDisableColor(state),
  270. disablebraille: (state) => this.onDisableBraille(state),
  271. nametaken: () => this.onNameTaken(),
  272. passfail: () => this.onPassFail(),
  273. tokenfail: () => this.onTokenFail(),
  274. regclosed: () => this.onRegClosed(),
  275. namechanged: (name) => this.onNameChanged(name),
  276. accountdeleted: () => this.onAccountDeleted(),
  277. pong: (ms) => this.onPong(ms),
  278. };
  279. for (let [event, handler] of Object.entries(this.eventHandlers)) {
  280. if (w && w.on) {
  281. w.on(event, handler);
  282. }
  283. }
  284. console.log(`[OK] Registered ${Object.keys(this.eventHandlers).length} event listeners`);
  285. }
  286. cleanup() {
  287. this.running = false;
  288. for (let [event, handler] of Object.entries(this.eventHandlers)) {
  289. if (w && w.off) {
  290. w.off(event, handler);
  291. }
  292. }
  293. this.state.activeTimers.forEach((timer) => {
  294. clearTimeout(timer.timeout);
  295. if (timer.intervalId) clearInterval(timer.intervalId);
  296. });
  297. this.state.activeCounts.forEach((count) => {
  298. if (count.intervalId) clearInterval(count.intervalId);
  299. });
  300. console.log("[OK] Bot cleaned up");
  301. }
  302. isAuthorized(username, isAdmin) {
  303. if (isAdmin) {
  304. this.state.adminUsers.add(username);
  305. return true;
  306. }
  307. return this.config.authorizedUsers.includes(username);
  308. }
  309. isBanned(username) {
  310. return this.config.bannedUsers.includes(username);
  311. }
  312. isIdBanned(userId) {
  313. return this.config.bannedIds.includes(userId);
  314. }
  315. getUserId(username) {
  316. for (let [id, cursor] of this.state.cursors.entries()) {
  317. if (cursor.name === username) {
  318. return id;
  319. }
  320. }
  321. return this.state.userIds.get(username) || null;
  322. }
  323. getCursorPosition(username) {
  324. if (this.state.userPositions.has(username)) {
  325. return this.state.userPositions.get(username);
  326. }
  327. for (let cursor of this.state.cursors.values()) {
  328. if (cursor.name === username) {
  329. return cursor.location;
  330. }
  331. }
  332. return null;
  333. }
  334. containsAuthorityCommand(message) {
  335. const msgLower = message.toLowerCase();
  336. for (let authCmd of AUTHORITY_COMMANDS) {
  337. if (msgLower.includes(`${this.config.prefix}${authCmd}`)) {
  338. return true;
  339. }
  340. }
  341. return false;
  342. }
  343. onJoin(data) {
  344. this.state.wall = data.wall || "";
  345. this.state.subwall = data.subwall || "";
  346. console.log(`[JOINED] ${this.state.wall}/${this.state.subwall}`);
  347. }
  348. onAlert(data) {
  349. console.log(`[ALERT] ${data.message}`);
  350. }
  351. onMessage(data) {
  352. if (!data || !data.msg) return;
  353. if (data.nick === this.config.username) return;
  354. const message = data.msg.trim();
  355. const sender = data.nick || "Unknown";
  356. const isAdmin = data.isAdmin || false;
  357. const userId = data.id || null;
  358. if (userId && sender) {
  359. this.state.userIds.set(sender, userId);
  360. }
  361. const messageId = `${sender}-${message}-${Date.now()}`;
  362. if (this.state.processedMessages.has(messageId)) return;
  363. this.state.processedMessages.add(messageId);
  364. if (this.state.processedMessages.size > 100) {
  365. const messages = Array.from(this.state.processedMessages);
  366. messages.slice(0, messages.length - 100).forEach((msg) => {
  367. this.state.processedMessages.delete(msg);
  368. });
  369. }
  370. if (isAdmin) {
  371. this.state.adminUsers.add(sender);
  372. }
  373. const hasAuth = this.isAuthorized(sender, isAdmin);
  374. if (hasAuth) {
  375. console.log(`[AUTHORITY] ${sender} ~ ${message}`);
  376. if (this.config.authorityEchoEnabled && !message.startsWith(this.config.prefix) && !message.includes("[AUTHORITY]") && this.config.lastAuthorityMessage !== `${sender}:${message}`) {
  377. this.config.lastAuthorityMessage = `${sender}:${message}`;
  378. this.sendMessage(`[AUTHORITY] ${sender} ~ ${message}`);
  379. }
  380. } else {
  381. console.log(`[MSG] ${sender}${data.isRegistered ? " (R)" : ""}: ${message}`);
  382. }
  383. if (message.startsWith(this.config.prefix)) {
  384. this.handleCommand(message, sender, data);
  385. }
  386. }
  387. onEdit(data) {
  388. if (data.edits && data.edits.length > 0) {
  389. console.log(`[EDIT] ${data.edits.length} edit(s) made`);
  390. }
  391. }
  392. onProtect(data) {
  393. console.log(`[PROTECT] Chunk ${data.cell} protection: ${data.protect ? "ON" : "OFF"}`);
  394. }
  395. onClear(data) {
  396. console.log(`[CLEAR] Area cleared: (${data.x1},${data.y1}) to (${data.x2},${data.y2})`);
  397. }
  398. onCursor(data) {
  399. if (!data.id) return;
  400. const cursorInfo = { name: data.n || "", location: data.l || [0, 0], color: data.c || 0 };
  401. this.state.cursors.set(data.id, cursorInfo);
  402. if (data.n) {
  403. this.state.userPositions.set(data.n, data.l || [0, 0]);
  404. this.state.userIds.set(data.n, data.id);
  405. }
  406. if (data.n === this.config.username && data.l) {
  407. this.config.position.x = data.l[0];
  408. this.config.position.y = data.l[1];
  409. }
  410. }
  411. onCursorLeft(id) {
  412. const cursor = this.state.cursors.get(id);
  413. if (cursor && cursor.name) {
  414. this.state.userPositions.delete(cursor.name);
  415. }
  416. this.state.cursors.delete(id);
  417. }
  418. onPerms(level) {
  419. this.state.perms = level;
  420. const permName = ["User", "Member", "Owner"][level] || "Unknown";
  421. console.log(`[PERMS] ${permName} (${level})`);
  422. }
  423. onMemberAdded(member) {
  424. console.log(`[MEMBER+] ${member}`);
  425. if (!this.state.members.includes(member)) {
  426. this.state.members.push(member);
  427. }
  428. }
  429. onMemberList(members) {
  430. this.state.members = members || [];
  431. console.log(`[MEMBERS] ${this.state.members.join(", ") || "None"}`);
  432. }
  433. onWallList(walls) {
  434. this.state.walllist = walls || [];
  435. console.log(`[WALLS] ${walls.length / 2} wall(s) available`);
  436. }
  437. onReadonly(state) {
  438. this.state.readonly = state;
  439. if (state) console.log("[STATE] Wall is now READONLY");
  440. }
  441. onHideCursors(state) {
  442. this.state.hidecursors = state;
  443. if (state) console.log("[STATE] Cursors are now HIDDEN");
  444. }
  445. onDisableChat(state) {
  446. this.state.disablechat = state;
  447. if (state) console.log("[STATE] Chat is DISABLED");
  448. }
  449. onDisableColor(state) {
  450. this.state.disablecolor = state;
  451. if (state) console.log("[STATE] Colors are DISABLED");
  452. }
  453. onDisableBraille(state) {
  454. this.state.disablebraille = state;
  455. if (state) console.log("[STATE] Braille is DISABLED");
  456. }
  457. onNameTaken() {
  458. console.log("[ERROR] Name is already taken!");
  459. }
  460. onPassFail() {
  461. console.log("[ERROR] Invalid password!");
  462. }
  463. onTokenFail() {
  464. console.log("[ERROR] Invalid token!");
  465. }
  466. onRegClosed() {
  467. console.log("[ERROR] Registration is closed!");
  468. }
  469. onNameChanged(name) {
  470. console.log(`[OK] Name changed to: ${name}`);
  471. this.config.username = name;
  472. }
  473. onAccountDeleted() {
  474. console.log("[ERROR] Account has been deleted!");
  475. }
  476. onPong(ms) {}
  477. handleCommand(message, sender, messageData) {
  478. const userId = messageData.id || this.getUserId(sender);
  479. if (userId && this.isIdBanned(userId)) {
  480. this.sendMessage("ERR: your id banned from using bot.");
  481. return;
  482. }
  483. if (this.isBanned(sender)) {
  484. this.sendMessage("You're banned.");
  485. return;
  486. }
  487. const commandLine = message.slice(this.config.prefix.length);
  488. const [command, ...args] = commandLine.split(/\s+/);
  489. const cmd = command.toLowerCase();
  490. this.state.lastSayUser = sender;
  491. const cooldownKey = `${cmd}-${sender}`;
  492. const lastUsed = this.state.commandCooldowns.get(cooldownKey) || 0;
  493. const now = Date.now();
  494. const hasAuth = this.isAuthorized(sender, messageData.isAdmin);
  495. if (now - lastUsed < 2000 && !hasAuth) {
  496. return;
  497. }
  498. this.state.commandCooldowns.set(cooldownKey, now);
  499. this.executeCommand(cmd, args, sender, messageData);
  500. }
  501. executeCommand(command, args, sender, messageData) {
  502. const hasAuth = this.isAuthorized(sender, messageData.isAdmin);
  503. const commands = {
  504. help: () => this.cmdHelp(args),
  505. thelp: () => this.cmdTypeHelp(args),
  506. fullcmd: () => this.cmdFullcmd(),
  507. info: () => this.cmdInfo(),
  508. calculate: () => this.cmdCalculate(args),
  509. calc2: () => this.cmdTetration(args),
  510. rng: () => this.cmdRandom(args),
  511. timer: () => this.cmdTimer(args),
  512. say: () => this.cmdSay(args, sender, messageData.isAdmin),
  513. count: () => this.cmdCount(args),
  514. status: () => this.cmdStatus(),
  515. pos: () => this.cmdPosition(args, sender),
  516. page: () => this.cmdPage(args),
  517. members: () => this.cmdMembers(),
  518. walls: () => this.cmdWalls(),
  519. authlist: () => this.cmdAuthList(),
  520. to: () => (hasAuth ? this.cmdTeleport(args) : this.sendMessage("Permission invalid - Authority required")),
  521. type: () => (hasAuth ? this.cmdType(args) : this.sendMessage("Permission invalid - Authority required")),
  522. colorid: () => (hasAuth ? this.cmdColor(args) : this.sendMessage("Permission invalid")),
  523. csay: () => (hasAuth ? this.cmdColoredSay(args) : this.sendMessage("Permission invalid - Authority required")),
  524. addauth: () => (hasAuth ? this.cmdAddAuth(args) : this.sendMessage("Permission invalid - Authority required")),
  525. removeauth: () => (hasAuth ? this.cmdRemoveAuth(args) : this.sendMessage("Permission invalid - Authority required")),
  526. ban: () => (hasAuth ? this.cmdBan(args) : this.sendMessage("Permission invalid - Authority required")),
  527. unban: () => (hasAuth ? this.cmdUnban(args) : this.sendMessage("Permission invalid - Authority required")),
  528. banid: () => (hasAuth ? this.cmdBanId(args) : this.sendMessage("Permission invalid - Authority required")),
  529. unbanid: () => (hasAuth ? this.cmdUnbanId(args) : this.sendMessage("Permission invalid - Authority required")),
  530. banlist: () => (hasAuth ? this.cmdBanList() : this.sendMessage("Permission invalid - Authority required")),
  531. disablehs: () => (hasAuth ? this.cmdDisableHeightSafety() : this.sendMessage("Permission invalid - Authority required")),
  532. echoauth: () => (hasAuth ? this.cmdToggleEcho() : this.sendMessage("Permission invalid - Authority required")),
  533. };
  534. const cmdFunc = commands[command];
  535. if (cmdFunc) {
  536. cmdFunc();
  537. }
  538. }
  539. cmdHelp(args) {
  540. const pageInput = args[0];
  541. if (pageInput !== undefined && (isNaN(pageInput) || !Number.isInteger(Number(pageInput)))) {
  542. this.sendMessage("Invalid number.");
  543. return;
  544. }
  545. const page = parseInt(pageInput) || 1;
  546. const maxPage = Object.keys(COMMAND_PAGES).length;
  547. if (page < 1 || page > maxPage) {
  548. this.sendMessage(`Invalid number. Use ${this.config.prefix}help 1-${maxPage}`);
  549. return;
  550. }
  551. this.sendMessage(`Commands Page ${page}/${maxPage}:`);
  552. const commands = COMMAND_PAGES[page];
  553. commands.forEach((cmd, index) => {
  554. setTimeout(() => {
  555. this.sendMessage(`${INVISIBLE_CHAR}${this.config.prefix}${cmd.cmd}${cmd.auth ? " [A]" : ""} - ${cmd.desc}`);
  556. }, (index + 1) * 700);
  557. });
  558. }
  559. cmdTypeHelp(args) {
  560. if (this.state.isTyping) {
  561. this.sendMessage("Bot is already typing. Please wait.");
  562. return;
  563. }
  564. const pageInput = args[0];
  565. if (!pageInput || isNaN(pageInput) || !Number.isInteger(Number(pageInput))) {
  566. this.sendMessage(`Usage: ${this.config.prefix}thelp [page number]`);
  567. return;
  568. }
  569. const page = parseInt(pageInput);
  570. const maxPage = Object.keys(COMMAND_PAGES).length;
  571. if (page < 1 || page > maxPage) {
  572. this.sendMessage(`Invalid page. Use ${this.config.prefix}thelp 1-${maxPage}`);
  573. return;
  574. }
  575. if (typeof w.typeChar !== "function") {
  576. this.sendMessage("Error: typeChar function not available");
  577. return;
  578. }
  579. const commands = COMMAND_PAGES[page];
  580. const lines = [`Commands [PAGE: ${page}]`];
  581. commands.forEach((cmd) => {
  582. lines.push(`${this.config.prefix}${cmd.cmd}${cmd.auth ? " [A]" : ""} - ${cmd.desc}`);
  583. });
  584. this.state.isTyping = true;
  585. const startX = this.config.position.x;
  586. let currentY = this.config.position.y;
  587. let lineIndex = 0;
  588. let charIndex = 0;
  589. this.sendMessage(`Typing help page ${page} on wall...`);
  590. const typeNextChar = () => {
  591. if (!this.running || !this.state.isTyping) {
  592. this.state.isTyping = false;
  593. return;
  594. }
  595. if (lineIndex >= lines.length) {
  596. this.state.isTyping = false;
  597. console.log(`[THELP] Finished typing help page ${page}`);
  598. return;
  599. }
  600. const currentLine = lines[lineIndex];
  601. if (charIndex >= currentLine.length) {
  602. this.teleportCursor(startX, currentY + 1);
  603. currentY++;
  604. lineIndex++;
  605. charIndex = 0;
  606. if (lineIndex < lines.length) {
  607. setTimeout(typeNextChar, 100);
  608. } else {
  609. this.state.isTyping = false;
  610. console.log(`[THELP] Finished typing help page ${page}`);
  611. }
  612. return;
  613. }
  614. try {
  615. const char = currentLine[charIndex];
  616. w.typeChar(char, 1);
  617. charIndex++;
  618. setTimeout(typeNextChar, 30);
  619. } catch (e) {
  620. console.error(`[THELP ERROR] Failed to type character:`, e);
  621. this.state.isTyping = false;
  622. }
  623. };
  624. this.teleportCursor(startX, currentY);
  625. typeNextChar();
  626. }
  627. cmdFullcmd() {
  628. this.sendMessage("if you wanna see all the commands, head to ~KiwiTest/diamondbot");
  629. }
  630. cmdInfo() {
  631. this.sendMessage(`This bot was made by KiwiTest, version ${this.config.version}`);
  632. }
  633. cmdPage(args) {
  634. const page = parseInt(args[0]) || 1;
  635. const maxPage = Object.keys(COMMAND_PAGES).length;
  636. if (page < 1 || page > maxPage) {
  637. this.sendMessage(`Invalid page. Pages: 1-${maxPage}`);
  638. return;
  639. }
  640. this.sendMessage(`Page ${page} Detailed Info:`);
  641. const commands = COMMAND_PAGES[page];
  642. commands.forEach((cmd, i) => {
  643. setTimeout(() => {
  644. this.sendMessage(`${i + 1}. ${INVISIBLE_CHAR}${this.config.prefix}${cmd.cmd} - ${cmd.desc}`);
  645. }, (i + 1) * 700);
  646. });
  647. }
  648. cmdSay(args, sender, isAdmin) {
  649. if (args.length < 1) {
  650. this.sendMessage(`Usage: ${this.config.prefix}say [message]`);
  651. return;
  652. }
  653. const message = args.join(" ");
  654. if (this.containsAuthorityCommand(message)) {
  655. const hasAuth = this.isAuthorized(sender, isAdmin);
  656. if (!hasAuth) {
  657. this.sendMessage("ERR: trying to bypass authority!");
  658. console.log(`[SECURITY] User ${sender} attempted to bypass authority with say command!`);
  659. return;
  660. }
  661. }
  662. this.sendMessage(message);
  663. }
  664. cmdType(args) {
  665. if (args.length < 2) {
  666. this.sendMessage(`Usage: ${this.config.prefix}type text step (step can be number or 'all')`);
  667. return;
  668. }
  669. const text = args.slice(0, -1).join(" ");
  670. const stepArg = args[args.length - 1].toLowerCase();
  671. if (text.length === 0) {
  672. this.sendMessage("Error: No text provided");
  673. return;
  674. }
  675. if (typeof w.typeChar !== "function") {
  676. this.sendMessage("Error: typeChar function not available");
  677. return;
  678. }
  679. if (stepArg === "all") {
  680. let delay = 0;
  681. for (let i = 0; i < text.length; i++) {
  682. const char = text[i];
  683. setTimeout(() => {
  684. try {
  685. w.typeChar(char, i);
  686. console.log(`[TYPE] Typed '${char}' at step ${i}`);
  687. } catch (e) {
  688. console.error(`[TYPE ERROR] Failed to type '${char}' at step ${i}:`, e);
  689. }
  690. }, delay);
  691. delay += 50;
  692. }
  693. this.sendMessage(`Typing "${text}" across ${text.length} steps`);
  694. return;
  695. }
  696. const step = parseInt(stepArg);
  697. if (isNaN(step)) {
  698. this.sendMessage("Error: Step must be a number or 'all'");
  699. return;
  700. }
  701. if (step < 0) {
  702. this.sendMessage("Error: Step must be non-negative");
  703. return;
  704. }
  705. try {
  706. for (let char of text) {
  707. w.typeChar(char, step);
  708. }
  709. this.sendMessage(`Typed "${text}" at step ${step}`);
  710. console.log(`[TYPE] Typed "${text}" at step ${step}`);
  711. } catch (e) {
  712. this.sendMessage(`Error typing text: ${e.message || "Unknown error"}`);
  713. console.error(`[TYPE ERROR]`, e);
  714. }
  715. }
  716. cmdCount(args) {
  717. if (args.length < 2) {
  718. this.sendMessage(`Usage: ${this.config.prefix}count n cooldown`);
  719. return;
  720. }
  721. const n = parseInt(args[0]);
  722. const cooldown = parseInt(args[1]);
  723. if (isNaN(n) || !Number.isInteger(n) || n <= 0) {
  724. this.sendMessage("Error: n must be a positive integer");
  725. return;
  726. }
  727. if (isNaN(cooldown) || !Number.isInteger(cooldown) || cooldown < 100) {
  728. this.sendMessage("Error: cooldown must be an integer >= 100 (milliseconds)");
  729. return;
  730. }
  731. if (n > 100) {
  732. this.sendMessage("Error: n cannot exceed 100");
  733. return;
  734. }
  735. const countId = Date.now();
  736. let current = 1;
  737. this.sendMessage(`Starting count to ${n} with ${cooldown}ms delay...`);
  738. const intervalId = setInterval(() => {
  739. if (current > n || !this.running) {
  740. clearInterval(intervalId);
  741. this.state.activeCounts.delete(countId);
  742. if (current > n) {
  743. this.sendMessage(`Count complete!`);
  744. }
  745. return;
  746. }
  747. this.sendMessage(current.toString());
  748. current++;
  749. }, cooldown);
  750. this.state.activeCounts.set(countId, { intervalId, max: n });
  751. }
  752. cmdColoredSay(args) {
  753. if (args.length < 2) {
  754. this.sendMessage(`Usage: ${this.config.prefix}csay [colorid] [text]`);
  755. return;
  756. }
  757. const colorInput = args[0].toLowerCase();
  758. let colorIndex;
  759. if (!isNaN(colorInput)) {
  760. colorIndex = parseInt(colorInput);
  761. if (colorIndex < 0 || colorIndex > 15) {
  762. this.sendMessage("Invalid colorid");
  763. return;
  764. }
  765. } else if (colorInput.startsWith("#")) {
  766. colorIndex = COLORS[colorInput];
  767. if (colorIndex === undefined) {
  768. this.sendMessage("Invalid colorid");
  769. return;
  770. }
  771. } else {
  772. this.sendMessage("Invalid colorid");
  773. return;
  774. }
  775. const text = args.slice(1).join(" ");
  776. if (!text || text.trim().length === 0) {
  777. this.sendMessage("Invalid text characters");
  778. return;
  779. }
  780. const originalColor = this.config.color;
  781. this.setColor(colorIndex);
  782. setTimeout(() => {
  783. this.sendMessage(text);
  784. setTimeout(() => {
  785. this.setColor(originalColor);
  786. }, 100);
  787. }, 100);
  788. }
  789. cmdCalculate(args) {
  790. if (args.length < 2) {
  791. this.sendMessage(`Usage: ${this.config.prefix}calculate base exponent`);
  792. return;
  793. }
  794. try {
  795. const base = args[0];
  796. const exp = args[1];
  797. const result = window.Decimal.pow(new window.Decimal(base), new window.Decimal(exp));
  798. this.sendMessage(`${base}^${exp} = ${result.toString()}`);
  799. } catch (error) {
  800. this.sendMessage("Error: Invalid input for calculation");
  801. }
  802. }
  803. cmdTetration(args) {
  804. if (args.length < 2) {
  805. this.sendMessage(`Usage: ${this.config.prefix}calc2 base height`);
  806. return;
  807. }
  808. try {
  809. const base = args[0];
  810. const height = parseInt(args[1]);
  811. if (height < 0 || !Number.isInteger(height)) {
  812. this.sendMessage("Height must be a non-negative integer");
  813. return;
  814. }
  815. if (this.config.heightSafetyEnabled && height > 5) {
  816. this.sendMessage(`Height too large! Maximum is 5 (Height Safety ON)`);
  817. return;
  818. }
  819. const result = window.Decimal.tetrate(new window.Decimal(base), height);
  820. this.sendMessage(`${base}^^${height} = ${result.toString()}`);
  821. } catch (error) {
  822. this.sendMessage("Error: Invalid input for tetration");
  823. }
  824. }
  825. cmdRandom(args) {
  826. if (args.length < 2) {
  827. this.sendMessage(`Usage: ${this.config.prefix}rng min max`);
  828. return;
  829. }
  830. const min = parseFloat(args[0]);
  831. const max = parseFloat(args[1]);
  832. if (isNaN(min) || isNaN(max)) {
  833. this.sendMessage("Invalid input. Please provide valid numbers.");
  834. return;
  835. }
  836. if (min > max) {
  837. this.sendMessage("Min must be less than or equal to max.");
  838. return;
  839. }
  840. const randomNum = Math.random() * (max - min) + min;
  841. this.sendMessage(`Random number between ${min} and ${max}: ${randomNum.toFixed(2)}`);
  842. }
  843. cmdTimer(args) {
  844. if (args.length < 3) {
  845. this.sendMessage(`Usage: ${this.config.prefix}timer hours minutes seconds (use 0 to skip)`);
  846. return;
  847. }
  848. const hours = Math.max(0, parseInt(args[0]) || 0);
  849. const minutes = Math.max(0, parseInt(args[1]) || 0);
  850. const seconds = Math.max(0, parseInt(args[2]) || 0);
  851. if (hours === 0 && minutes === 0 && seconds === 0) {
  852. this.sendMessage("Timer must have at least one non-zero value");
  853. return;
  854. }
  855. if (hours > 24) {
  856. this.sendMessage("Maximum timer is 24 hours");
  857. return;
  858. }
  859. const totalMs = (hours * 3600 + minutes * 60 + seconds) * 1000;
  860. let timeStr = [];
  861. if (hours > 0) timeStr.push(`${hours}h`);
  862. if (minutes > 0) timeStr.push(`${minutes}m`);
  863. if (seconds > 0) timeStr.push(`${seconds}s`);
  864. const timerId = Date.now();
  865. this.sendMessage(`Timer set for ${timeStr.join(" ")} (ID: ${timerId})`);
  866. const timerObj = setTimeout(() => {
  867. this.sendMessage(`TIMER COMPLETE! ${timeStr.join(" ")} has elapsed (ID: ${timerId})`);
  868. this.state.activeTimers.delete(timerId);
  869. }, totalMs);
  870. this.state.activeTimers.set(timerId, { timeout: timerObj, duration: timeStr.join(" "), startTime: Date.now(), endTime: Date.now() + totalMs });
  871. if (totalMs > 60000) {
  872. let updateCount = 0;
  873. const maxUpdates = 3;
  874. const updateInterval = Math.max(30000, totalMs / 4);
  875. const intervalId = setInterval(() => {
  876. const timer = this.state.activeTimers.get(timerId);
  877. if (!timer || updateCount >= maxUpdates) {
  878. clearInterval(intervalId);
  879. return;
  880. }
  881. const remaining = timer.endTime - Date.now();
  882. if (remaining > 1000) {
  883. const h = Math.floor(remaining / 3600000);
  884. const m = Math.floor((remaining % 3600000) / 60000);
  885. const s = Math.floor((remaining % 60000) / 1000);
  886. let remStr = [];
  887. if (h > 0) remStr.push(`${h}h`);
  888. if (m > 0) remStr.push(`${m}m`);
  889. if (s > 0) remStr.push(`${s}s`);
  890. this.sendMessage(`Timer ${timerId}: ${remStr.join(" ")} remaining`);
  891. updateCount++;
  892. }
  893. }, updateInterval);
  894. this.state.activeTimers.get(timerId).intervalId = intervalId;
  895. }
  896. }
  897. cmdStatus() {
  898. const status = [
  899. `Wall: ${this.state.wall}/${this.state.subwall}`,
  900. `Perms: ${["User", "Member", "Owner"][this.state.perms]}`,
  901. `Pos: (${this.config.position.x}, ${this.config.position.y})`,
  902. `Timers: ${this.state.activeTimers.size}`,
  903. `Color: ${this.config.color}`,
  904. `HS: ${this.config.heightSafetyEnabled ? "ON" : "OFF"}`,
  905. `Echo: ${this.config.authorityEchoEnabled ? "ON" : "OFF"}`,
  906. `Auth: ${this.config.authorizedUsers.length}`,
  907. `Banned: ${this.config.bannedUsers.length}/${this.config.bannedIds.length}`,
  908. ];
  909. this.sendMessage(status.join(" | "));
  910. }
  911. cmdPosition(args, sender) {
  912. if (args.length === 0) {
  913. const pos = this.getCursorPosition(sender);
  914. if (pos) {
  915. this.sendMessage(`Cursor position of ${sender}: (${pos[0]}, ${pos[1]})`);
  916. } else {
  917. this.sendMessage(`Cursor position of ${sender}: Not found in wall`);
  918. }
  919. return;
  920. }
  921. const targetUser = args[0];
  922. const pos = this.getCursorPosition(targetUser);
  923. if (pos) {
  924. this.sendMessage(`Cursor position of ${targetUser}: (${pos[0]}, ${pos[1]})`);
  925. } else {
  926. this.sendMessage(`Cursor position of ${targetUser}: Not found in wall`);
  927. }
  928. }
  929. cmdMembers() {
  930. if (this.state.members.length === 0) {
  931. this.sendMessage("No members in this wall");
  932. } else {
  933. this.sendMessage(`Members: ${this.state.members.join(", ")}`);
  934. }
  935. }
  936. cmdWalls() {
  937. if (this.state.walllist.length === 0) {
  938. this.sendMessage("No subwalls available");
  939. } else {
  940. const walls = [];
  941. for (let i = 0; i < this.state.walllist.length; i += 2) {
  942. const wallName = this.state.walllist[i];
  943. const isPrivate = this.state.walllist[i + 1];
  944. walls.push(`${wallName}${isPrivate ? " (private)" : ""}`);
  945. }
  946. this.sendMessage(`Subwalls: ${walls.join(", ")}`);
  947. }
  948. }
  949. cmdTeleport(args) {
  950. if (args.length < 2) {
  951. this.sendMessage(`Usage: ${this.config.prefix}to X Y`);
  952. return;
  953. }
  954. const x = parseInt(args[0]);
  955. const y = parseInt(args[1]);
  956. if (isNaN(x) || isNaN(y)) {
  957. this.sendMessage("Invalid coordinates. Please provide integers.");
  958. return;
  959. }
  960. if (Math.abs(x) > 10000 || Math.abs(y) > 10000) {
  961. this.sendMessage("Coordinates out of range (max +-10000)");
  962. return;
  963. }
  964. this.teleportCursor(x, y);
  965. this.sendMessage(`Teleported to (${x}, ${y})`);
  966. }
  967. cmdColor(args) {
  968. if (args.length < 1) {
  969. this.sendMessage(`Usage: ${this.config.prefix}colorid #hex or 0-15`);
  970. return;
  971. }
  972. const input = args[0].toLowerCase();
  973. let colorIndex;
  974. if (!isNaN(input)) {
  975. colorIndex = parseInt(input);
  976. if (colorIndex < 0 || colorIndex > 15) {
  977. this.sendMessage("Invalid colot");
  978. return;
  979. }
  980. } else if (input.startsWith("#")) {
  981. colorIndex = COLORS[input];
  982. if (colorIndex === undefined) {
  983. this.sendMessage("Invalid colot");
  984. return;
  985. }
  986. } else {
  987. this.sendMessage("Invalid colot");
  988. return;
  989. }
  990. this.setColor(colorIndex);
  991. this.sendMessage(`Color changed to ${colorIndex}`);
  992. }
  993. cmdBan(args) {
  994. if (args.length < 1) {
  995. this.sendMessage(`Usage: ${this.config.prefix}ban username`);
  996. return;
  997. }
  998. const username = args[0];
  999. if (this.config.authorizedUsers.includes(username)) {
  1000. this.sendMessage(`Cannot ban authority user ${username}`);
  1001. return;
  1002. }
  1003. if (this.config.bannedUsers.includes(username)) {
  1004. this.sendMessage(`${username} is already banned`);
  1005. return;
  1006. }
  1007. this.config.bannedUsers.push(username);
  1008. Storage.save("bannedUsers", this.config.bannedUsers);
  1009. this.sendMessage(`Banned ${username} from using bot`);
  1010. console.log(`[BAN] ${username} has been banned`);
  1011. }
  1012. cmdUnban(args) {
  1013. if (args.length < 1) {
  1014. this.sendMessage(`Usage: ${this.config.prefix}unban username or ID`);
  1015. return;
  1016. }
  1017. const input = args[0];
  1018. if (!isNaN(input)) {
  1019. const idToUnban = input;
  1020. const index = this.config.bannedIds.indexOf(idToUnban);
  1021. if (index === -1) {
  1022. this.sendMessage(`Error: ID ${idToUnban} is not banned`);
  1023. return;
  1024. }
  1025. this.config.bannedIds.splice(index, 1);
  1026. Storage.save("bannedIds", this.config.bannedIds);
  1027. this.sendMessage(`Unbanned ID ${idToUnban}`);
  1028. console.log(`[UNBAN] ID ${idToUnban} has been unbanned`);
  1029. } else {
  1030. const username = input;
  1031. const index = this.config.bannedUsers.indexOf(username);
  1032. if (index === -1) {
  1033. this.sendMessage(`Error: ${username} is not banned`);
  1034. return;
  1035. }
  1036. this.config.bannedUsers.splice(index, 1);
  1037. Storage.save("bannedUsers", this.config.bannedUsers);
  1038. this.sendMessage(`Unbanned ${username}`);
  1039. console.log(`[UNBAN] ${username} has been unbanned`);
  1040. }
  1041. }
  1042. cmdBanId(args) {
  1043. if (args.length < 1) {
  1044. this.sendMessage(`Usage: ${this.config.prefix}banid username`);
  1045. return;
  1046. }
  1047. const username = args[0];
  1048. const userId = this.getUserId(username);
  1049. if (!userId) {
  1050. this.sendMessage(`Cannot find user ID for ${username}. User must be in wall.`);
  1051. return;
  1052. }
  1053. if (this.config.authorizedUsers.includes(username)) {
  1054. this.sendMessage(`Cannot ban authority user ${username}`);
  1055. return;
  1056. }
  1057. if (this.config.bannedIds.includes(userId)) {
  1058. this.sendMessage(`User ID ${userId} is already banned`);
  1059. return;
  1060. }
  1061. this.config.bannedIds.push(userId);
  1062. Storage.save("bannedIds", this.config.bannedIds);
  1063. this.sendMessage(`Banned user ID for ${username} (ID: ${userId})`);
  1064. console.log(`[BANID] ${username} (ID: ${userId}) has been banned`);
  1065. }
  1066. cmdUnbanId(args) {
  1067. if (args.length < 1) {
  1068. this.sendMessage(`Usage: ${this.config.prefix}unbanid userid`);
  1069. return;
  1070. }
  1071. const userId = args[0];
  1072. const index = this.config.bannedIds.indexOf(userId);
  1073. if (index === -1) {
  1074. this.sendMessage(`ID ${userId} is not banned`);
  1075. return;
  1076. }
  1077. this.config.bannedIds.splice(index, 1);
  1078. Storage.save("bannedIds", this.config.bannedIds);
  1079. this.sendMessage(`Unbanned ID ${userId}`);
  1080. console.log(`[UNBANID] ID ${userId} has been unbanned`);
  1081. }
  1082. cmdBanList() {
  1083. const userBans = this.config.bannedUsers.length === 0 ? "None" : this.config.bannedUsers.join(", ");
  1084. const idBans = this.config.bannedIds.length === 0 ? "None" : `${this.config.bannedIds.length} IDs`;
  1085. this.sendMessage(`Banned users: ${userBans} | Banned IDs: ${idBans}`);
  1086. }
  1087. cmdAddAuth(args) {
  1088. if (args.length < 1) {
  1089. this.sendMessage(`Usage: ${this.config.prefix}addauth username`);
  1090. return;
  1091. }
  1092. const username = args[0];
  1093. if (this.config.authorizedUsers.includes(username)) {
  1094. this.sendMessage(`${username} already has authority`);
  1095. return;
  1096. }
  1097. const banIndex = this.config.bannedUsers.indexOf(username);
  1098. if (banIndex !== -1) {
  1099. this.config.bannedUsers.splice(banIndex, 1);
  1100. Storage.save("bannedUsers", this.config.bannedUsers);
  1101. }
  1102. this.config.authorizedUsers.push(username);
  1103. Storage.save("authorizedUsers", this.config.authorizedUsers);
  1104. this.sendMessage(`Added ${username} to authority list`);
  1105. console.log(`[AUTH+] Authority granted to: ${username}`);
  1106. }
  1107. cmdRemoveAuth(args) {
  1108. if (args.length < 1) {
  1109. this.sendMessage(`Usage: ${this.config.prefix}removeauth username`);
  1110. return;
  1111. }
  1112. const username = args[0];
  1113. if (username === "Diamond25" || username === "KiwiTest") {
  1114. this.sendMessage(`Cannot remove default authority from ${username}`);
  1115. return;
  1116. }
  1117. const index = this.config.authorizedUsers.indexOf(username);
  1118. if (index === -1) {
  1119. this.sendMessage(`${username} doesn't have authority`);
  1120. return;
  1121. }
  1122. this.config.authorizedUsers.splice(index, 1);
  1123. Storage.save("authorizedUsers", this.config.authorizedUsers);
  1124. this.sendMessage(`Removed ${username} from authority list`);
  1125. console.log(`[AUTH-] Authority revoked from: ${username}`);
  1126. }
  1127. cmdDisableHeightSafety() {
  1128. this.config.heightSafetyEnabled = !this.config.heightSafetyEnabled;
  1129. const status = this.config.heightSafetyEnabled ? "ENABLED" : "DISABLED";
  1130. const info = this.config.heightSafetyEnabled ? "(Max height: 5)" : "(No height limit)";
  1131. this.sendMessage(`Height safety is now ${status} ${info}`);
  1132. console.log(`Height safety: ${status}`);
  1133. }
  1134. cmdToggleEcho() {
  1135. if (!this.config.authorityEchoEnabled) {
  1136. this.config.authorityEchoEnabled = true;
  1137. this.sendMessage("Authority echo is now ENABLED (with recursion protection)");
  1138. } else {
  1139. this.config.authorityEchoEnabled = false;
  1140. this.sendMessage("Authority echo is now DISABLED");
  1141. }
  1142. console.log(`Authority echo: ${this.config.authorityEchoEnabled ? "ENABLED" : "DISABLED"}`);
  1143. }
  1144. cmdAuthList() {
  1145. const authUsers = [...this.config.authorizedUsers];
  1146. const adminUsers = Array.from(this.state.adminUsers);
  1147. const allAuth = [...new Set([...authUsers, ...adminUsers])];
  1148. this.sendMessage(`Authorized users (${allAuth.length}): ${allAuth.join(", ")}`);
  1149. }
  1150. setUsername(username) {
  1151. if (typeof api !== "undefined" && api.nick) {
  1152. api.nick(username);
  1153. } else if (typeof setNick === "function") {
  1154. setNick(username);
  1155. } else if (typeof changeNick === "function") {
  1156. changeNick(username);
  1157. }
  1158. console.log(`[USERNAME] ${username}`);
  1159. }
  1160. setColor(colorIndex) {
  1161. if (typeof api !== "undefined" && api.color) {
  1162. api.color(colorIndex);
  1163. } else if (typeof setColor === "function") {
  1164. setColor(colorIndex);
  1165. }
  1166. this.config.color = colorIndex;
  1167. console.log(`[COLOR] Set to: ${colorIndex}`);
  1168. }
  1169. teleportCursor(x, y) {
  1170. if (typeof api !== "undefined" && api.cursor) {
  1171. api.cursor(x, y);
  1172. } else if (typeof moveCursor === "function") {
  1173. moveCursor(x, y);
  1174. } else if (typeof cursor === "object" && cursor.move) {
  1175. cursor.move(x, y);
  1176. }
  1177. this.config.position.x = x;
  1178. this.config.position.y = y;
  1179. }
  1180. sendMessage(message) {
  1181. if (this.state.disablechat && !this.state.isShuttingDown) {
  1182. console.log("Chat is disabled, cannot send message");
  1183. return;
  1184. }
  1185. this.state.messageQueue.push(message);
  1186. if (!this.state.isProcessingQueue) {
  1187. this.processMessageQueue();
  1188. }
  1189. }
  1190. async processMessageQueue() {
  1191. if (this.state.messageQueue.length === 0 || (!this.running && !this.state.isShuttingDown)) {
  1192. this.state.isProcessingQueue = false;
  1193. return;
  1194. }
  1195. this.state.isProcessingQueue = true;
  1196. const message = this.state.messageQueue.shift();
  1197. const now = Date.now();
  1198. const timeSinceLastMessage = now - this.state.lastMessageTime;
  1199. if (timeSinceLastMessage < this.config.messageDelay) {
  1200. await new Promise((resolve) => setTimeout(resolve, this.config.messageDelay - timeSinceLastMessage));
  1201. }
  1202. this.state.lastMessageTime = Date.now();
  1203. try {
  1204. if (w && w.chat && w.chat.send) {
  1205. w.chat.send(message);
  1206. console.log(`[SENT] ${message}`);
  1207. } else {
  1208. if (typeof sendChat === "function") {
  1209. sendChat(message);
  1210. } else if (typeof api !== "undefined" && api.chat) {
  1211. api.chat(message);
  1212. } else {
  1213. console.error("No chat send method available!");
  1214. }
  1215. }
  1216. } catch (error) {
  1217. console.error("Failed to send message:", error);
  1218. }
  1219. setTimeout(() => this.processMessageQueue(), this.config.messageDelay);
  1220. }
  1221. }
  1222. console.clear();
  1223. console.log(`Starting TextWall Bot v${BOT_CONFIG.version}...`);
  1224. const bot = new TextWallBot(BOT_CONFIG);
  1225. await bot.init();
  1226. window.diamondBot = bot;
  1227. window.sendMessage = function (message) {
  1228. if (!message) {
  1229. console.error("Error: No message provided. Usage: sendMessage('your message')");
  1230. return;
  1231. }
  1232. bot.sendMessage(`[SYSTEM]: ${message}`);
  1233. console.log(`[SYSTEM MESSAGE SENT]: ${message}`);
  1234. };
  1235. window.stopBot = async function () {
  1236. console.log("Initiating shutdown sequence...");
  1237. bot.state.isShuttingDown = true;
  1238. bot.state.isTyping = false;
  1239. bot.sendMessage("Closing bot..");
  1240. await new Promise((resolve) => setTimeout(resolve, 500));
  1241. bot.running = false;
  1242. bot.state.activeTimers.forEach((timer) => {
  1243. clearTimeout(timer.timeout);
  1244. if (timer.intervalId) clearInterval(timer.intervalId);
  1245. });
  1246. bot.state.activeCounts.forEach((count) => {
  1247. if (count.intervalId) clearInterval(count.intervalId);
  1248. });
  1249. for (let [event, handler] of Object.entries(bot.eventHandlers)) {
  1250. if (w && w.off) {
  1251. w.off(event, handler);
  1252. }
  1253. }
  1254. bot.sendMessage("Bot successfully shutdown.");
  1255. await new Promise((resolve) => setTimeout(resolve, 500));
  1256. bot.state.isProcessingQueue = false;
  1257. bot.state.messageQueue = [];
  1258. console.log("[OK] Bot stopped completely");
  1259. };
  1260. window.restartBot = async function () {
  1261. console.log("Restarting bot...");
  1262. await window.stopBot();
  1263. await new Promise((resolve) => setTimeout(resolve, 1000));
  1264. const newBot = new TextWallBot(BOT_CONFIG);
  1265. await newBot.init();
  1266. window.diamondBot = newBot;
  1267. console.log("[OK] Bot restarted");
  1268. };
  1269. window.botStatus = function () {
  1270. console.table({
  1271. Username: bot.config.username,
  1272. Version: bot.config.version,
  1273. Prefix: bot.config.prefix,
  1274. Wall: `${bot.state.wall}/${bot.state.subwall}`,
  1275. Position: `(${bot.config.position.x}, ${bot.config.position.y})`,
  1276. Color: bot.config.color,
  1277. Permissions: ["User", "Member", "Owner"][bot.state.perms] || "Unknown",
  1278. "Active Timers": bot.state.activeTimers.size,
  1279. "Active Counts": bot.state.activeCounts.size,
  1280. "Authorized Users": bot.config.authorizedUsers.length,
  1281. "Banned Users": bot.config.bannedUsers.length,
  1282. "Banned IDs": bot.config.bannedIds.length,
  1283. "Height Safety": bot.config.heightSafetyEnabled ? "ON" : "OFF",
  1284. "Authority Echo": bot.config.authorityEchoEnabled ? "ON" : "OFF",
  1285. "Is Typing": bot.state.isTyping ? "YES" : "NO",
  1286. "Queue Size": bot.state.messageQueue.length,
  1287. });
  1288. };
  1289. window.showCommands = function () {
  1290. console.log("\n====================================");
  1291. console.log(` ALL BOT COMMANDS (v${BOT_CONFIG.version}) `);
  1292. console.log("====================================\n");
  1293. for (let pageNum in COMMAND_PAGES) {
  1294. console.log(`\nPAGE ${pageNum}:`);
  1295. console.log("-".repeat(50));
  1296. const page = COMMAND_PAGES[pageNum];
  1297. page.forEach((cmd) => {
  1298. const authIcon = cmd.auth ? "[A]" : " ";
  1299. const cmdName = `\\${cmd.cmd}`.padEnd(15);
  1300. console.log(`${authIcon} ${cmdName} - ${cmd.desc}`);
  1301. });
  1302. }
  1303. console.log("\n" + "=".repeat(50));
  1304. console.log("[A] = Authority Required");
  1305. console.log("Default Authorities: Diamond25, KiwiTest");
  1306. console.log("Admins (ADMIN tag) have automatic authority");
  1307. console.log("=".repeat(50) + "\n");
  1308. };
  1309. window.botHelp = function () {
  1310. console.log("====================================");
  1311. console.log(` TextWall Bot v${BOT_CONFIG.version} - Help `);
  1312. console.log("====================================");
  1313. console.log(" PREFIX: \\ ");
  1314. console.log(" ");
  1315. console.log(" NEW IN v7.9: ");
  1316. console.log(" - \\help now has 0.7s cooldown ");
  1317. console.log(" - \\thelp uses step 1 for typing ");
  1318. console.log(" - \\page command updated ");
  1319. console.log(" ");
  1320. console.log(" CONSOLE COMMANDS: ");
  1321. console.log(" window.showCommands() - List cmds ");
  1322. console.log(" window.sendMessage(msg) - System ");
  1323. console.log(" window.stopBot() - Stop bot ");
  1324. console.log(" window.restartBot() - Restart ");
  1325. console.log(" window.botStatus() - Status ");
  1326. console.log(" window.botHelp() - This help ");
  1327. console.log("====================================");
  1328. };
  1329. window.botHelp();
  1330. })();
  1331.  
Advertisement
Comments
  • User was banned
  • Fennivin
    111 days
    # CSS 0.83 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1S1iTruSLkgEPO8QtTuo2twS4f2FoJ3_l0-p4GKqeAUY/edit?usp=sharing
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    8.  
    9. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    10.  
    11. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification).
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment