Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Sorry for ugly */
- const WebSocket = require("ws");
- const Canvas = require("canvas");
- const fs = require("fs");
- const schedule = require("node-schedule");
- const adminPass = "[REDACTED]";
- let pos = [55, 58];
- function print(x, y, digit) {
- let ii = digit * 16 * 4;
- for (let chunkY=0; chunkY<2; chunkY++) {
- let buffer = Buffer.alloc(8 + 256 * 3);
- buffer.writeInt32LE(pos[0] + x, 0);
- buffer.writeInt32LE(pos[1] + y + chunkY, 4);
- let i = 8;
- for (let yy=0; yy<16; yy++) {
- for (let xx=0; xx<16; xx++) {
- buffer.writeUInt8(clockData[ii++], i++);
- buffer.writeUInt8(clockData[ii++], i++);
- buffer.writeUInt8(clockData[ii++], i++);
- ii++;
- }
- ii += (160 - 16) * 4;
- }
- owopBot.send(buffer);
- }
- }
- function update() {
- let date = new Date();
- let hour = date.getUTCHours();
- let minutes = date.getUTCMinutes();
- print(0, 0, Math.floor(hour / 10));
- print(1, 0, hour % 10);
- print(3, 0, Math.floor(minutes / 10));
- print(4, 0, minutes % 10);
- }
- function sendMove(x, y) {
- let buffer = Buffer.alloc(12);
- buffer.writeInt32LE(x || -(Math.pow(2, 31) - 1), 0);
- buffer.writeInt32LE(y || -(Math.pow(2, 31) - 1), 4);
- owopBot.send(buffer);
- }
- let calc = new Canvas.Canvas(160, 32);
- let ctx = calc.getContext("2d");
- let clockData;
- let img = new Canvas.Image();
- img.src = fs.readFileSync("clock.png");;
- ctx.drawImage(img, 0, 0, 160, 32, 0, 0, 160, 32);
- clockData = ctx.getImageData(0, 0, 160, 32).data;
- let botId = 0;
- let owopBot = new WebSocket("ws://ourworldofpixels.com:443", {
- origin: "DayDun's clock"
- });
- owopBot.on("open", function() {
- console.log("owop open!");
- });
- owopBot.on("message", function(data) {
- if (typeof data == "string") {
- return;
- }
- switch(data.readUInt8(0)) {
- case 0: // Get id
- botId = data.readUInt32LE(1);
- console.log("owop ready!");
- owopBot.send("/adminlogin " + adminPass + String.fromCharCode(10));
- sendMove();
- setInterval(sendMove, 600000);
- break;
- case 4: // Get admin
- update();
- break;
- case 5: // Captcha
- switch(data.readUInt8(1)) {
- case 0:
- owopBot.send("CaptchALETMEINPLS" + adminPass);
- break;
- case 3:
- owopBot.send(new Buffer([109, 97, 105, 110, 225, 16]));
- break;
- }
- break;
- }
- });
- owopBot.on("close", function() {
- console.log("owop close!!!");
- });
- schedule.scheduleJob("0 * * * * *", function() {
- update();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement