diff --git a/package.json b/package.json index b5dc412..c9b94d8 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 101c0e9..f44b8b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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 diff --git a/src/index.js b/src/index.js index 2e8d3c9..1b3bc1b 100644 --- a/src/index.js +++ b/src/index.js @@ -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();