feat: refactor and new features (#7)

* feat: refactor and new features

+ Refactored the codebase
+ OCR support in bots
+ Server sends training data every minute
+ Not using collectors for Discord feedback buttons anymore
+ Fixed grammar mistakes
+ Configs are now seperated
+ Tokens are no longer in configs
- Like feedback doesn't work for Discord yet

* feat: remove feedback button once voted

* feat: role blacklist

* feat: thread name check

* feat: error handler for training

* fix: bot crashing when a webhook msg is sent

* refactor: remove debugging lines

* feat: allow fixing mistake at votes in discord bot
This commit is contained in:
reis
2023-06-23 21:29:00 +03:00
committed by GitHub
parent f5214a6ace
commit 8b9f45dc22
60 changed files with 1962 additions and 1591 deletions

30
apps/server/src/index.js Normal file
View File

@@ -0,0 +1,30 @@
import { createServer } from 'node:net';
import { deserialize } from 'bson';
import { runAI, runOCR, trainAI } 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);
break;
}
case 3: {
trainAI(eventData);
break;
}
case 5: {
await runOCR(client, eventData);
break;
}
}
});
});
server.listen(process.env.PORT || 3000);