mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 21:56:17 +00:00
29 lines
620 B
JavaScript
29 lines
620 B
JavaScript
import { readFileSync } from 'node:fs';
|
|
const config = JSON.parse(readFileSync('./config.json', 'utf-8'));
|
|
|
|
import { createServer } from 'node:net';
|
|
import { deserialize } from 'bson';
|
|
import { runAI, runOCR } from './events/index.js';
|
|
|
|
const server = createServer(async (client) => {
|
|
client.on('data', async (data) => {
|
|
const eventData = deserialize(data, {
|
|
allowObjectSmallerThanBufferSize: true
|
|
});
|
|
|
|
switch (eventData.op) {
|
|
case 1: {
|
|
runAI(client, eventData, config.witAI);
|
|
break;
|
|
}
|
|
|
|
case 5: {
|
|
runOCR(client, eventData);
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
server.listen(config.server.port || 3000);
|