hackily change identify props

This commit is contained in:
Cynthia Foxwell 2023-09-25 14:00:36 -06:00
parent 5036559407
commit 77706dde2c
3 changed files with 26 additions and 0 deletions

View file

@ -27,6 +27,7 @@
"murmurhash": "^2.0.1",
"node-ffprobe": "^3.0.0",
"sharp": "^0.32.0",
"spitroast": "^1.4.3",
"sqlite3": "^5.1.6"
},
"devDependencies": {

View file

@ -32,6 +32,9 @@ dependencies:
sharp:
specifier: ^0.32.0
version: 0.32.0
spitroast:
specifier: ^1.4.3
version: 1.4.3
sqlite3:
specifier: ^5.1.6
version: 5.1.6
@ -1342,6 +1345,7 @@ packages:
/emoji-regex@8.0.0:
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
requiresBuild: true
dev: false
/encoding@0.1.13:
@ -1808,6 +1812,7 @@ packages:
/is-fullwidth-code-point@3.0.0:
resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==}
engines: {node: '>=8'}
requiresBuild: true
dev: false
/is-function@1.0.2:
@ -2598,6 +2603,10 @@ packages:
dev: false
optional: true
/spitroast@1.4.3:
resolution: {integrity: sha512-JdkzAy2tT82ahx+eEtM5ohBeHICqFln/Yzo+vPGnE5sX1LYgPHCU2qcaSIJfR/xNrhI0q+ftwFz0H2aJysv3EA==}
dev: false
/sqlite3@5.1.6:
resolution: {integrity: sha512-olYkWoKFVNSSSQNvxVUfjiVbz3YtBwTJj+mfV5zpHmqW3sELx2Cf4QCdirMelhM5Zh+KDVaKgQHqCxrqiWHybw==}
requiresBuild: true

View file

@ -3,6 +3,7 @@ const logger = require("./lib/logger.js");
const fs = require("fs");
const {resolve} = require("path");
const sqlite3 = require("sqlite3");
const {instead, before} = require("spitroast");
const config = require("../config.json");
const apikeys = require("../apikeys.json");
@ -122,4 +123,19 @@ bot.on("unknown", (packet, id) => {
);
});
instead("spawn", bot.shards, function (args, orig) {
const ret = orig.apply(this, args);
const shard = this.get(args[0]);
if (shard) {
before("sendWS", shard.prototype, function ([op, _data]) {
if (op === Dysnomia.Constants.GatewayOPCodes.IDENTIFY) {
_data.properties.browser = "Discord Embedded";
delete _data.properties.device;
}
});
}
return ret;
});
bot.connect();