discord-self-lite 0.1.15 → 0.1.16
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/package.json
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "discord-self-lite",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Lightweight Discord selfbot library",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"discord",
|
|
7
|
-
"selfbot",
|
|
8
|
-
"bot",
|
|
9
|
-
"api",
|
|
10
|
-
"websocket",
|
|
11
|
-
"discord-api",
|
|
12
|
-
"discord-bot",
|
|
13
|
-
"discord-selfbot",
|
|
14
|
-
"lightweight",
|
|
15
|
-
"nodejs"
|
|
16
|
-
],
|
|
17
|
-
"main": "src/index.js",
|
|
18
|
-
"files": [
|
|
19
|
-
"src",
|
|
20
|
-
"README.md",
|
|
21
|
-
"LICENSE"
|
|
22
|
-
],
|
|
23
|
-
"exports": {
|
|
24
|
-
".": "./src/index.js",
|
|
25
|
-
"./classes/Client": "./src/classes/Client.js",
|
|
26
|
-
"./classes/WebhookClient": "./src/connection/webhook/WebhookClient.js"
|
|
27
|
-
},
|
|
28
|
-
"engines": {
|
|
29
|
-
"node": ">=18.13.0"
|
|
30
|
-
},
|
|
31
|
-
"scripts": {
|
|
32
|
-
"test": "eslint . && prettier --check .",
|
|
33
|
-
"format": "prettier --write .",
|
|
34
|
-
"fix": "eslint . --fix && prettier --write .",
|
|
35
|
-
"docs": "echo \"📚 Documentation available at docs/README.md\""
|
|
36
|
-
},
|
|
37
|
-
"repository": {
|
|
38
|
-
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/kyan0045/discord-self-lite.git"
|
|
40
|
-
},
|
|
41
|
-
"author": {
|
|
42
|
-
"name": "Kyan Bosman",
|
|
43
|
-
"email": "contact@kyanbosman.com",
|
|
44
|
-
"url": "https://github.com/kyan0045"
|
|
45
|
-
},
|
|
46
|
-
"license": "GPL-3.0-or-later",
|
|
47
|
-
"bugs": {
|
|
48
|
-
"url": "https://github.com/kyan0045/discord-self-lite/issues"
|
|
49
|
-
},
|
|
50
|
-
"homepage": "https://github.com/kyan0045/discord-self-lite#readme",
|
|
51
|
-
"funding": {
|
|
52
|
-
"type": "github",
|
|
53
|
-
"url": "https://github.com/sponsors/kyan0045"
|
|
54
|
-
},
|
|
55
|
-
"dependencies": {
|
|
56
|
-
"ws": "^8.18.3"
|
|
57
|
-
},
|
|
58
|
-
"devDependencies": {
|
|
59
|
-
"eslint-config-prettier": "^10.1.8",
|
|
60
|
-
"eslint-plugin-prettier": "^5.5.4",
|
|
61
|
-
"prettier": "^3.6.2"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "discord-self-lite",
|
|
3
|
+
"version": "0.1.16",
|
|
4
|
+
"description": "Lightweight Discord selfbot library",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"discord",
|
|
7
|
+
"selfbot",
|
|
8
|
+
"bot",
|
|
9
|
+
"api",
|
|
10
|
+
"websocket",
|
|
11
|
+
"discord-api",
|
|
12
|
+
"discord-bot",
|
|
13
|
+
"discord-selfbot",
|
|
14
|
+
"lightweight",
|
|
15
|
+
"nodejs"
|
|
16
|
+
],
|
|
17
|
+
"main": "src/index.js",
|
|
18
|
+
"files": [
|
|
19
|
+
"src",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
23
|
+
"exports": {
|
|
24
|
+
".": "./src/index.js",
|
|
25
|
+
"./classes/Client": "./src/classes/Client.js",
|
|
26
|
+
"./classes/WebhookClient": "./src/connection/webhook/WebhookClient.js"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18.13.0"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"test": "eslint . && prettier --check .",
|
|
33
|
+
"format": "prettier --write .",
|
|
34
|
+
"fix": "eslint . --fix && prettier --write .",
|
|
35
|
+
"docs": "echo \"📚 Documentation available at docs/README.md\""
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/kyan0045/discord-self-lite.git"
|
|
40
|
+
},
|
|
41
|
+
"author": {
|
|
42
|
+
"name": "Kyan Bosman",
|
|
43
|
+
"email": "contact@kyanbosman.com",
|
|
44
|
+
"url": "https://github.com/kyan0045"
|
|
45
|
+
},
|
|
46
|
+
"license": "GPL-3.0-or-later",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/kyan0045/discord-self-lite/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/kyan0045/discord-self-lite#readme",
|
|
51
|
+
"funding": {
|
|
52
|
+
"type": "github",
|
|
53
|
+
"url": "https://github.com/sponsors/kyan0045"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"ws": "^8.18.3"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"eslint-config-prettier": "^10.1.8",
|
|
60
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
61
|
+
"prettier": "^3.6.2"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -5,10 +5,28 @@
|
|
|
5
5
|
* @param {string|object} payload - Message content or payload object
|
|
6
6
|
* @returns {Promise<object>} The sent message data
|
|
7
7
|
*/
|
|
8
|
+
const DISCORD_EPOCH = 1420070400000n;
|
|
9
|
+
let nonceIncrement = 0n;
|
|
10
|
+
|
|
11
|
+
function generateNonce() {
|
|
12
|
+
nonceIncrement = (nonceIncrement + 1n) & 0xfffn;
|
|
13
|
+
return (
|
|
14
|
+
((BigInt(Date.now()) - DISCORD_EPOCH) << 22n) |
|
|
15
|
+
nonceIncrement
|
|
16
|
+
).toString();
|
|
17
|
+
}
|
|
18
|
+
|
|
8
19
|
async function sendMessage(rest, channelId, payload) {
|
|
9
|
-
|
|
10
|
-
const messagePayload =
|
|
20
|
+
const payloadOverrides =
|
|
11
21
|
typeof payload === "string" ? { content: payload } : { ...payload };
|
|
22
|
+
const messagePayload = {
|
|
23
|
+
mobile_network_type: "unknown",
|
|
24
|
+
content: undefined,
|
|
25
|
+
nonce: generateNonce(),
|
|
26
|
+
tts: false,
|
|
27
|
+
flags: 0,
|
|
28
|
+
...payloadOverrides,
|
|
29
|
+
};
|
|
12
30
|
|
|
13
31
|
const filesToUpload = [];
|
|
14
32
|
const keepAttachments = [];
|