discord-self-lite 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -59,6 +59,13 @@ const client = new Client();
59
59
  - `client.fetchChannel(channelId)` - Fetch channel from API
60
60
  - `client.fetchMessage(channelId, messageId)` - Fetch specific message
61
61
 
62
+ #### Properties
63
+
64
+ - `client.user` - Current user object (available after ready event)
65
+ - `client.guilds` - Map of cached guild instances
66
+ - `client.channels` - Map of cached channel instances
67
+ - `client.sessionId` - Session ID from Discord
68
+
62
69
  #### Events
63
70
 
64
71
  - `ready` - Fired when client is ready
package/package.json CHANGED
@@ -1,64 +1,64 @@
1
- {
2
- "name": "discord-self-lite",
3
- "version": "0.1.0",
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
- "docs:html": "jsdoc -c jsdoc.conf.json"
37
- },
38
- "repository": {
39
- "type": "git",
40
- "url": "git+https://github.com/kyan0045/discord-self-lite.git"
41
- },
42
- "author": {
43
- "name": "Kyan Bosman",
44
- "email": "contact@kyanbosman.com",
45
- "url": "https://github.com/kyan0045"
46
- },
47
- "license": "GPL-3.0-or-later",
48
- "bugs": {
49
- "url": "https://github.com/kyan0045/discord-self-lite/issues"
50
- },
51
- "homepage": "https://github.com/kyan0045/discord-self-lite#readme",
52
- "funding": {
53
- "type": "github",
54
- "url": "https://github.com/sponsors/kyan0045"
55
- },
56
- "dependencies": {
57
- "ws": "^8.18.3"
58
- },
59
- "devDependencies": {
60
- "eslint-config-prettier": "^10.1.8",
61
- "eslint-plugin-prettier": "^5.5.4",
62
- "prettier": "^3.6.2"
63
- }
64
- }
1
+ {
2
+ "name": "discord-self-lite",
3
+ "version": "0.1.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
+ "docs:html": "jsdoc -c jsdoc.conf.json"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/kyan0045/discord-self-lite.git"
41
+ },
42
+ "author": {
43
+ "name": "Kyan Bosman",
44
+ "email": "contact@kyanbosman.com",
45
+ "url": "https://github.com/kyan0045"
46
+ },
47
+ "license": "GPL-3.0-or-later",
48
+ "bugs": {
49
+ "url": "https://github.com/kyan0045/discord-self-lite/issues"
50
+ },
51
+ "homepage": "https://github.com/kyan0045/discord-self-lite#readme",
52
+ "funding": {
53
+ "type": "github",
54
+ "url": "https://github.com/sponsors/kyan0045"
55
+ },
56
+ "dependencies": {
57
+ "ws": "^8.18.3"
58
+ },
59
+ "devDependencies": {
60
+ "eslint-config-prettier": "^10.1.8",
61
+ "eslint-plugin-prettier": "^5.5.4",
62
+ "prettier": "^3.6.2"
63
+ }
64
+ }
@@ -36,6 +36,7 @@ class Client extends EventEmitter {
36
36
  this.guilds = new Map(); // Cache for Guild instances
37
37
  this.channels = new Map(); // Cache for Channel instances
38
38
  this.sessionId = null; // Will be set from WebSocket READY event
39
+ this.user = null; // Will be set from WebSocket READY event
39
40
  }
40
41
 
41
42
  /**
@@ -1,35 +1,36 @@
1
- async function clickButton(
2
- rest,
3
- channelId,
4
- messageId,
5
- applicationId,
6
- guildId,
7
- customId,
8
- sessionId,
9
- messageFlags = 0,
10
- ) {
11
- // Generate a snowflake-like nonce (simplified version)
12
- const nonce = Date.now().toString() + Math.random().toString(36).substring(2, 11);
13
-
14
- const payload = {
15
- type: 3, // MESSAGE_COMPONENT
16
- nonce,
17
- guild_id: guildId,
18
- channel_id: channelId,
19
- message_id: messageId,
20
- application_id: applicationId,
21
- session_id: sessionId,
22
- message_flags: messageFlags,
23
- data: {
24
- component_type: 2, // BUTTON
25
- custom_id: customId,
26
- },
27
- };
28
-
29
- return await rest.request("/interactions", {
30
- method: "POST",
31
- body: JSON.stringify(payload),
32
- });
33
- }
34
-
35
- module.exports = clickButton;
1
+ async function clickButton(
2
+ rest,
3
+ channelId,
4
+ messageId,
5
+ applicationId,
6
+ guildId,
7
+ customId,
8
+ sessionId,
9
+ messageFlags = 0,
10
+ ) {
11
+ // Generate a snowflake-like nonce (simplified version)
12
+ const nonce =
13
+ Date.now().toString() + Math.random().toString(36).substring(2, 11);
14
+
15
+ const payload = {
16
+ type: 3, // MESSAGE_COMPONENT
17
+ nonce,
18
+ guild_id: guildId,
19
+ channel_id: channelId,
20
+ message_id: messageId,
21
+ application_id: applicationId,
22
+ session_id: sessionId,
23
+ message_flags: messageFlags,
24
+ data: {
25
+ component_type: 2, // BUTTON
26
+ custom_id: customId,
27
+ },
28
+ };
29
+
30
+ return await rest.request("/interactions", {
31
+ method: "POST",
32
+ body: JSON.stringify(payload),
33
+ });
34
+ }
35
+
36
+ module.exports = clickButton;
@@ -129,6 +129,7 @@ class DiscordWebSocket extends EventEmitter {
129
129
  case "READY":
130
130
  this.sessionId = message.d.session_id;
131
131
  this.client.sessionId = message.d.session_id;
132
+ this.client.user = message.d.user;
132
133
  this.ready = true;
133
134
  this.client.emit("ready", message.d);
134
135
  break;
package/src/index.js CHANGED
@@ -1,41 +1,41 @@
1
- /**
2
- * discord-self-lite - A lightweight Discord selfbot library
3
- * @module discord-self-lite
4
- * @version 0.1.0
5
- * @description A modern, lightweight Discord selfbot library with webhook support, built for Node.js 22+ with zero external dependencies (except ws for WebSocket connections).
6
- *
7
- * @example
8
- * // Import the library
9
- * const { Client, WebhookClient } = require('discord-self-lite');
10
- *
11
- * // Create a Discord client
12
- * const client = new Client();
13
- * client.login('your-token');
14
- *
15
- * // Create a webhook client
16
- * const webhook = new WebhookClient('webhook-url');
17
- * await webhook.send('Hello, world!');
18
- */
19
-
20
- const Client = require("./classes/Client");
21
- const WebhookClient = require("./connection/webhook/WebhookClient");
22
-
23
- /**
24
- * Main package exports
25
- * @namespace discord-self-lite
26
- */
27
- module.exports = {
28
- /**
29
- * The main Discord client class for connecting to Discord and handling events
30
- * @type {Client}
31
- * @see {@link Client}
32
- */
33
- Client,
34
-
35
- /**
36
- * Discord webhook client class for sending messages via webhooks
37
- * @type {WebhookClient}
38
- * @see {@link WebhookClient}
39
- */
40
- WebhookClient,
41
- };
1
+ /**
2
+ * discord-self-lite - A lightweight Discord selfbot library
3
+ * @module discord-self-lite
4
+ * @version 0.1.0
5
+ * @description A modern, lightweight Discord selfbot library with webhook support, built for Node.js 22+ with zero external dependencies (except ws for WebSocket connections).
6
+ *
7
+ * @example
8
+ * // Import the library
9
+ * const { Client, WebhookClient } = require('discord-self-lite');
10
+ *
11
+ * // Create a Discord client
12
+ * const client = new Client();
13
+ * client.login('your-token');
14
+ *
15
+ * // Create a webhook client
16
+ * const webhook = new WebhookClient('webhook-url');
17
+ * await webhook.send('Hello, world!');
18
+ */
19
+
20
+ const Client = require("./classes/Client");
21
+ const WebhookClient = require("./connection/webhook/WebhookClient");
22
+
23
+ /**
24
+ * Main package exports
25
+ * @namespace discord-self-lite
26
+ */
27
+ module.exports = {
28
+ /**
29
+ * The main Discord client class for connecting to Discord and handling events
30
+ * @type {Client}
31
+ * @see {@link Client}
32
+ */
33
+ Client,
34
+
35
+ /**
36
+ * Discord webhook client class for sending messages via webhooks
37
+ * @type {WebhookClient}
38
+ * @see {@link WebhookClient}
39
+ */
40
+ WebhookClient,
41
+ };