@imaentity/selfjs 1.9.9 → 1.9.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/self.js +6 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imaentity/selfjs",
3
- "version": "1.9.9",
3
+ "version": "1.9.10",
4
4
  "description": "Breaking Discord's TOS to bot user accounts.",
5
5
  "main": "self.js",
6
6
  "repository": {
package/self.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @name SelfJS
3
3
  * @description Breaking Discord's TOS to bot user accounts.
4
4
  * @author Эмберс
5
- * @version 1.9.9
5
+ * @version 1.9.10
6
6
  */
7
7
 
8
8
  const https = require("https");
@@ -88,6 +88,7 @@ module.exports = {
88
88
  this.messageDeleteFunction = null;
89
89
  this.latency = null;
90
90
  this.beforeHB = null;
91
+ this.hearbeatInterval = null;
91
92
  }
92
93
 
93
94
  login(token, isMobile = false, logMsgs = false) {
@@ -123,7 +124,7 @@ module.exports = {
123
124
  this.beforeHB = Date.now();
124
125
  this.socket.send(JSON.stringify({op: 1, d: this.sequenceID}));
125
126
 
126
- setInterval(function() {
127
+ this.hearbeatInterval = setInterval(function() {
127
128
  if(logMsgs) console.log("[MainControlSocket] Sending heartbeat");
128
129
  this.beforeHB = Date.now();
129
130
  this.socket.send(JSON.stringify({op: 1, d: this.sequenceID}));
@@ -176,6 +177,9 @@ module.exports = {
176
177
  } else if(payload.op == 7) {
177
178
  if(logMsgs) console.log("[MainControlSocket] Reconnect message received");
178
179
 
180
+ if(this.hearbeatInterval) clearInterval(this.hearbeatInterval);
181
+ this.socket.terminate();
182
+
179
183
  this.socket = new ws("wss://gateway.discord.gg?v=10&encoding=json");
180
184
 
181
185
  this.socket.on("open", function() {