delete unused prbridge and screenshotter

This commit is contained in:
Lamp 2023-10-10 16:17:16 -07:00
parent e21a264ed0
commit 995ac6d96f
6 changed files with 0 additions and 1441 deletions

View File

@ -1,48 +0,0 @@
const socketCluster = require("socketcluster-client")
const EventEmitter = require("events").EventEmitter;
class PRClient extends EventEmitter {
constructor(credentials, options) {
super()
EventEmitter.call(this);
this.options = options;
this.socket;
this.channels = {};
this.credentials = credentials
}
connect() {
if (!this.options) {
this.options = {
path: "/socketcluster/",
hostname: "www.pianorhythm.me",
port: 443,
secure: true,
autoReconnect: true,
}
}
// Initiate the connection to the server
this.socket = socketCluster.connect(this.options);
this.socket.connect();
this.socket.on("error", (msg) => {
handleError(msg, "pr socket");
})
this.socket.on("connect", () => {
console.log("Connected!")
this.socket.emit("enableAuthLogin", {
enable: true,
roomName: this.credentials.roomName
});
this.socket.emit("enableCursor", {
enable: true
});
this.socket.emit("login", {
password: this.credentials.password,
roomName: this.credentials.roomName,
username: this.credentials.username
});
this.socket.emit("getPlayerStats", {
"username": this.credentials.username
})
})
}
}
module.exports = PRClient;

View File

@ -1,54 +0,0 @@
const PRClient = require("./PRClient.js");
let client = new PRClient({// account stuff
username: "Discord",
password: config.pr_password,
roomName: 'lobby'
});
global.prClient = client;
client.connect();
client.socket.on("setRoom", function (data, callback) {
client.roomID = data.roomID;
try {
if (client.channels.chatChannel && client.roomID) {
client.socket.destroyChannel(client.roomID);
}
} catch (err) {}
client.channels.chatChannel = client.socket.subscribe(data.roomID);
client.channels.chatChannel.watch(messagehandle);
})
async function messagehandle(data) {
if (data && data.type) {
switch (data.type) {
case "chat":
if (data && data.message) {
let name = data.name || "";
let effect = data.effect || "";
let roomName = data.roomName;
let color = data.color;
let id = data.sID || data.socketID || data.id;
if (id == client.socket.id) return;
let c = dClient.channels.resolve("593943518351982603");
let msg;
(!name && (data.message.startsWith("[i]"))) ? msg = `*${data.message.split("[i]")[1]}*` : msg = `**${sanitizeName(name)}:** ${data.message}`;
if (c) c.send(msg);
}
break;
}
}
}
dClient.on("messageCreate", async message => {
if (message.channel.id != "593943518351982603" || message.author.id == dClient.user.id) return;
if (!client.roomID) return;
client.socket.publish(client.roomID, {
"type": "chat",
"message": `${message.member && message.member.displayName || message.author.username}#${message.author.discriminator}: ${message.cleanContent + (message.attachments.size > 0 && message.attachments.map(x => x.url).join(' ') || '')}`,
"value": false,
"socketID": "[discord.gg/k44Eqha]",
"uuid": "[discord.gg/k44Eqha]",
"color": "#8012ed",
"name": "[discord.gg/k44Eqha]"
});
});

View File

@ -1,5 +0,0 @@
FROM buildkite/puppeteer
ADD . /app
WORKDIR /app
RUN npm ci
CMD ["node", "screenshotter.js"]

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
{
"dependencies": {
"discord.js": "^12.5.3",
"dotenv": "^10.0.0",
"puppeteer": "^10.2.0"
}
}

View File

@ -1,72 +0,0 @@
require("dotenv").config();
var Discord = require("discord.js");
var puppeteer = require('puppeteer');
var wh_hmpps = new Discord.WebhookClient(process.env.WH_HMPPS_ID, process.env.WH_HMPPS_TOKEN);
var wh_hrprs = new Discord.WebhookClient(process.env.WH_HRPRS_ID, process.env.WH_HRPRS_TOKEN);
var wh_howps = new Discord.WebhookClient(process.env.WH_HOWPS_ID, process.env.WH_HOWPS_TOKEN);
global.screenshotter = {
capture: async function () {
console.log('Starting screen captures');
try {
var browser = await puppeteer.launch(/*{ args: ['--no-sandbox'] }*/);
var page = await browser.newPage();
await page.setViewport({ width: 1440, height: 900 });
try {
await page.goto('https://www.multiplayerpiano.com/');
try {await page.evaluate(function () {
document.getElementById('modal').click();
//MPP.client.uri = "wss://mpp_proxy.qonq.gq";
});} catch(e) {console.error(e.message)}
await new Promise(resolve => setTimeout(resolve, 5000));
let screenshot = await page.screenshot({ type: 'png' });
let filename = `Screenshot of www.multiplayerpiano.com @ ${new Date().toISOString()}.png`;
let attachment = new Discord.MessageAttachment(screenshot, filename);
await wh_hmpps.send(attachment);
} catch (error) {
await wh_hmpps.send(`:warning: ${error.stack}`);
}
try {
await page.evaluate(function () {
MPP.client.setChannel("✧𝓓𝓔𝓥 𝓡𝓸𝓸𝓶✧");
});
await new Promise(resolve => setTimeout(resolve, 5000));
let screenshot = await page.screenshot({ type: 'png' });
let filename = `Screenshot of www.multiplayerpiano.com/✧𝓓𝓔𝓥 𝓡𝓸𝓸𝓶✧ @ ${new Date().toISOString()}.png`;
let attachment = new Discord.MessageAttachment(screenshot, filename);
await wh_hrprs.send(attachment);
} catch(error) {
await wh_hrprs.send(`:warning: ${error.stack}`);
}
try {
await page.goto('http://ourworldofpixels.com');
await page.evaluate(function (owopcaptcha) {
localStorage.owopcaptcha = owopcaptcha;
OWOP.camera.zoom = 1;
}, process.env.OWOP_CAPTCHA_PASSWORD);
await new Promise(resolve => setTimeout(resolve, 2000));
await page.evaluate(function () {
for (let butt of document.getElementsByTagName('button')) {
if (butt.innerText == 'OK') {butt.click();break}
}
});
await new Promise(resolve => setTimeout(resolve, 13000));
let screenshot = await page.screenshot({ type: 'png' });
let filename = `Screenshot of ourworldofpixels.com/main @ ${new Date().toISOString()}.png`;
let attachment = new Discord.MessageAttachment(screenshot, filename);
await wh_howps.send(attachment);
} catch (error) {
await wh_howps.send(`:warning: ${error.stack}`);
}
} catch(error) {
console.error(`Error occured with screen capture:\n${error.stack}`)
} finally {
if (browser) await browser.close();
console.log('Finished screen captures');
}
},
interval: setInterval(() => { screenshotter.capture(); }, 1000 * 60 * 60)
};
screenshotter.capture();