@imaentity/selfjs 1.6.9 → 1.7.9
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.
- package/docs.md +6 -2
- package/package.json +1 -1
- package/self.js +8 -3
package/docs.md
CHANGED
|
@@ -10,14 +10,18 @@
|
|
|
10
10
|
# Class
|
|
11
11
|
- **Client**: This class allows the interaction with the Discord server. The following are its methods:
|
|
12
12
|
|
|
13
|
+
- **userID**: The client's user ID.
|
|
14
|
+
|
|
15
|
+
- **token**: The client's token.
|
|
16
|
+
|
|
17
|
+
- **latency**: The latency of the client's websocket connection.
|
|
18
|
+
|
|
13
19
|
- **login(token, isMobile = false, logMsgs = false)**: Logs in the client to Discord.
|
|
14
20
|
|
|
15
21
|
- **onMessage(msgFunc)**: Function to be executed when a message is received.
|
|
16
22
|
|
|
17
23
|
- **onMessageEdit(editFunc)**: Function to be executed when a message is edited.
|
|
18
24
|
|
|
19
|
-
- **onMessageDelete(deleteFunc)**: Function to be executed when a message is deleted.
|
|
20
|
-
|
|
21
25
|
- **onStatusUpdate(statusFunc)**: Function to be executed when a status update occurs.
|
|
22
26
|
|
|
23
27
|
- **getDMChannel(userID)**: Gets the Direct Message (DM) channel for the specified user.
|
package/package.json
CHANGED
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.
|
|
5
|
+
* @version 1.7.9
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const https = require("https");
|
|
@@ -86,6 +86,8 @@ module.exports = {
|
|
|
86
86
|
this.resumeURL = null;
|
|
87
87
|
this.statusUpdateFunction = null;
|
|
88
88
|
this.messageDeleteFunction = null;
|
|
89
|
+
this.latency = null;
|
|
90
|
+
this.beforeHB = null;
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
login(token, isMobile = false, logMsgs = false) {
|
|
@@ -104,8 +106,8 @@ module.exports = {
|
|
|
104
106
|
token: this.token,
|
|
105
107
|
properties: {
|
|
106
108
|
$os: isMobile ? "linux" : "windows",
|
|
107
|
-
$browser: isMobile ? "Discord iOS" : "
|
|
108
|
-
$device: isMobile ? "discord.gblk" : "
|
|
109
|
+
$browser: isMobile ? "Discord iOS" : "SelfJS",
|
|
110
|
+
$device: isMobile ? "discord.gblk" : "SelfJS"
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
113
|
}));
|
|
@@ -118,14 +120,17 @@ module.exports = {
|
|
|
118
120
|
if(logMsgs) console.log("[MainControlSocket] Hello ACK received");
|
|
119
121
|
|
|
120
122
|
if(logMsgs) console.log("[MainControlSocket] Sending heartbeat");
|
|
123
|
+
this.beforeHB = Date.now();
|
|
121
124
|
this.socket.send(JSON.stringify({op: 1, d: this.sequenceID}));
|
|
122
125
|
|
|
123
126
|
setInterval(function() {
|
|
124
127
|
if(logMsgs) console.log("[MainControlSocket] Sending heartbeat");
|
|
128
|
+
this.beforeHB = Date.now();
|
|
125
129
|
this.socket.send(JSON.stringify({op: 1, d: this.sequenceID}));
|
|
126
130
|
}.bind(this), payload.d.heartbeat_interval);
|
|
127
131
|
} else if(payload.op == 11) {
|
|
128
132
|
if(logMsgs) console.log("[MainControlSocket] Heartbeat ACK received");
|
|
133
|
+
this.latency = Date.now() - this.beforeHB;
|
|
129
134
|
} else if(payload.op == 0) {
|
|
130
135
|
this.sequenceID = payload.s;
|
|
131
136
|
|