socketon 0.30.6 → 0.30.7
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 +133 -95
- package/lib/Socket/socket.js +1 -1
- package/lib/index.js +2 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,146 +1,184 @@
|
|
|
1
|
-
<
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://files.catbox.moe/0wl8py.png" alt="socketon" width="320" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<a id="readme-top"></a>
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
WhatsApp API library (fork of baileys) with improved stability, custom pairing code, and better session handling.
|
|
9
|
+
</p>
|
|
8
10
|
|
|
9
11
|
<p align="center">
|
|
10
|
-
<
|
|
12
|
+
<a href="https://www.npmjs.com/package/socketon">
|
|
13
|
+
<img src="https://img.shields.io/npm/v/socketon" />
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://www.npmjs.com/package/socketon">
|
|
16
|
+
<img src="https://img.shields.io/npm/dm/socketon" />
|
|
17
|
+
</a>
|
|
18
|
+
<a href="./LICENSE">
|
|
19
|
+
<img src="https://img.shields.io/npm/l/socketon" />
|
|
20
|
+
</a>
|
|
11
21
|
</p>
|
|
12
22
|
|
|
13
|
-
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## why socketon?
|
|
26
|
+
|
|
27
|
+
kalau kamu ngerasa baileys sekarang udah delay, suka double respon, atau kadang infinite connecting, socketon bisa jadi alternatif yang lebih enak.
|
|
14
28
|
|
|
15
|
-
|
|
29
|
+
ini fork dari baileys yang difokusin buat stabilitas, session handling, dan pairing code yang lebih fleksibel. sebagian besar api tetap sama, jadi migrasi dari baileys biasanya gak butuh perubahan besar.
|
|
30
|
+
|
|
31
|
+
---
|
|
16
32
|
|
|
17
|
-
|
|
18
|
-
- Multi-device support
|
|
19
|
-
- Interactive messages (buttons, lists, menus)
|
|
20
|
-
- Album messages (multiple images)
|
|
21
|
-
- Newsletter support with auto-follow
|
|
22
|
-
- Event messages
|
|
23
|
-
- Poll messages with results
|
|
24
|
-
- Payment request messages
|
|
25
|
-
- Product messages
|
|
26
|
-
- Document support
|
|
27
|
-
- Auto session management
|
|
28
|
-
- Lightweight and fast, no browser required
|
|
33
|
+
## features
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
- custom pairing code (default: socketon)
|
|
36
|
+
- improved session handling (lebih rapih dan stabil)
|
|
37
|
+
- multi-device support
|
|
38
|
+
- interactive messages (buttons, list, native flow)
|
|
39
|
+
- album messages (multiple images)
|
|
40
|
+
- newsletter support + auto-follow (built-in)
|
|
41
|
+
- event / poll / payment request / product messages
|
|
42
|
+
- document support
|
|
43
|
+
- lightweight and fast, no browser required
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## installation
|
|
31
48
|
|
|
32
49
|
```bash
|
|
33
|
-
npm
|
|
50
|
+
npm i socketon
|
|
34
51
|
```
|
|
35
52
|
|
|
36
|
-
|
|
37
|
-
-
|
|
53
|
+
requirements:
|
|
54
|
+
- node.js >= 20
|
|
55
|
+
|
|
56
|
+
---
|
|
38
57
|
|
|
39
|
-
##
|
|
58
|
+
## quick start
|
|
40
59
|
|
|
41
|
-
###
|
|
60
|
+
### connect (qr)
|
|
42
61
|
|
|
43
|
-
```
|
|
44
|
-
const { makeWASocket, useMultiFileAuthState
|
|
45
|
-
const pino = require('pino');
|
|
62
|
+
```js
|
|
63
|
+
const { makeWASocket, useMultiFileAuthState } = require('socketon')
|
|
46
64
|
|
|
47
|
-
async function
|
|
48
|
-
|
|
65
|
+
async function start() {
|
|
66
|
+
const { state, saveCreds } = await useMultiFileAuthState('./auth')
|
|
49
67
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
68
|
+
const sock = makeWASocket({
|
|
69
|
+
auth: state,
|
|
70
|
+
printQRInTerminal: true
|
|
71
|
+
})
|
|
55
72
|
|
|
56
|
-
|
|
57
|
-
const { connection, lastDisconnect } = update;
|
|
73
|
+
sock.ev.on('creds.update', saveCreds)
|
|
58
74
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} else if (connection === 'open') {
|
|
65
|
-
console.log('Connected successfully!');
|
|
66
|
-
}
|
|
67
|
-
});
|
|
75
|
+
sock.ev.on('connection.update', ({ connection }) => {
|
|
76
|
+
if (connection === 'open') console.log('connected')
|
|
77
|
+
if (connection === 'close') console.log('disconnected')
|
|
78
|
+
})
|
|
79
|
+
}
|
|
68
80
|
|
|
69
|
-
|
|
70
|
-
|
|
81
|
+
start()
|
|
82
|
+
```
|
|
71
83
|
|
|
72
|
-
|
|
73
|
-
if (!msg.message) continue;
|
|
84
|
+
### auto reply (simple)
|
|
74
85
|
|
|
75
|
-
|
|
76
|
-
|
|
86
|
+
```js
|
|
87
|
+
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
88
|
+
const m = messages[0]
|
|
89
|
+
if (!m?.message || m.key.fromMe) return
|
|
77
90
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
91
|
+
const jid = m.key.remoteJid
|
|
92
|
+
const text = m.message.conversation || m.message.extendedTextMessage?.text
|
|
93
|
+
if (!text) return
|
|
85
94
|
|
|
86
|
-
|
|
95
|
+
await sock.sendMessage(jid, { text: `echo: ${text}` })
|
|
96
|
+
})
|
|
87
97
|
```
|
|
88
98
|
|
|
89
|
-
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## pairing code (no qr)
|
|
90
102
|
|
|
91
|
-
```
|
|
92
|
-
const { makeWASocket, useMultiFileAuthState } = require('socketon')
|
|
93
|
-
const pino = require('pino');
|
|
103
|
+
```js
|
|
104
|
+
const { makeWASocket, useMultiFileAuthState } = require('socketon')
|
|
94
105
|
|
|
95
|
-
async function
|
|
96
|
-
|
|
106
|
+
async function pairing() {
|
|
107
|
+
const { state, saveCreds } = await useMultiFileAuthState('./auth')
|
|
97
108
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
109
|
+
const sock = makeWASocket({
|
|
110
|
+
auth: state,
|
|
111
|
+
printQRInTerminal: false
|
|
112
|
+
})
|
|
103
113
|
|
|
104
|
-
|
|
105
|
-
const { connection } = update;
|
|
114
|
+
sock.ev.on('creds.update', saveCreds)
|
|
106
115
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const pairingCodeDefault = await sock.requestPairingCode('6281234567890');
|
|
110
|
-
console.log(`Default Pairing Code: ${pairingCodeDefault}`);
|
|
116
|
+
sock.ev.on('connection.update', async ({ connection }) => {
|
|
117
|
+
if (connection !== 'open') return
|
|
111
118
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
console.log(`Custom Pairing Code: ${pairingCodeCustom}`);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
119
|
+
const code = await sock.requestPairingCode('6281234567890')
|
|
120
|
+
console.log('pairing code:', code)
|
|
117
121
|
|
|
118
|
-
|
|
122
|
+
// custom
|
|
123
|
+
// const custom = await sock.requestPairingCode('6281234567890', 'KODEKAMU')
|
|
124
|
+
// console.log('custom code:', custom)
|
|
125
|
+
})
|
|
119
126
|
}
|
|
120
127
|
|
|
121
|
-
|
|
128
|
+
pairing()
|
|
122
129
|
```
|
|
123
130
|
|
|
124
131
|
---
|
|
125
132
|
|
|
126
|
-
##
|
|
133
|
+
## migration from baileys
|
|
127
134
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
135
|
+
pindah dari baileys biasanya simpel, cukup ganti import:
|
|
136
|
+
|
|
137
|
+
```js
|
|
138
|
+
// baileys
|
|
139
|
+
const { makeWASocket } = require('@whiskeysockets/baileys')
|
|
140
|
+
|
|
141
|
+
// socketon
|
|
142
|
+
const { makeWASocket } = require('socketon')
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## docs
|
|
148
|
+
|
|
149
|
+
full docs dan advanced examples:
|
|
150
|
+
- [DOCS/README.md](./DOCS/README.md)
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## links
|
|
155
|
+
|
|
156
|
+
- npm: https://www.npmjs.com/package/socketon
|
|
157
|
+
- repo: https://github.com/IbraDecode/socketon
|
|
158
|
+
- issues: https://github.com/IbraDecode/socketon/issues
|
|
159
|
+
- discussions: https://github.com/IbraDecode/socketon/discussions
|
|
133
160
|
|
|
134
161
|
---
|
|
135
162
|
|
|
136
|
-
|
|
163
|
+
## contributors
|
|
137
164
|
|
|
138
165
|
<a href="https://github.com/IbraDecode/socketon/graphs/contributors">
|
|
139
166
|
<img src="https://contrib.rocks/image?repo=IbraDecode/socketon" alt="contributors" />
|
|
140
167
|
</a>
|
|
141
168
|
|
|
142
|
-
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## credits
|
|
172
|
+
|
|
173
|
+
- original baileys by @adiwajshing
|
|
174
|
+
- modified and maintained by kiuur & ibra decode
|
|
175
|
+
|
|
176
|
+
---
|
|
143
177
|
|
|
144
|
-
|
|
178
|
+
<p align="center">
|
|
179
|
+
star repo ini kalau bermanfaat
|
|
180
|
+
</p>
|
|
145
181
|
|
|
146
|
-
<
|
|
182
|
+
<p align="center">
|
|
183
|
+
<a href="#readme-top">back to top</a>
|
|
184
|
+
</p>
|
package/lib/Socket/socket.js
CHANGED
|
@@ -386,7 +386,7 @@ const makeSocket = (config) => {
|
|
|
386
386
|
|
|
387
387
|
/** Created by IbraDecode - Socketon */
|
|
388
388
|
const requestPairingCode = async (phoneNumber, pairKey) => {
|
|
389
|
-
pairKey = pairKey || "
|
|
389
|
+
pairKey = pairKey || "SOCKETON";
|
|
390
390
|
authState.creds.pairingCode = pairKey.toUpperCase();
|
|
391
391
|
|
|
392
392
|
authState.creds.me = {
|
package/lib/index.js
CHANGED
|
@@ -3,15 +3,8 @@
|
|
|
3
3
|
const chalk = require("chalk");
|
|
4
4
|
|
|
5
5
|
console.log(chalk.magentaBright.bold("\n© Socketon - 2025 By Ibra Decode\n"));
|
|
6
|
-
console.log(chalk.cyan(
|
|
7
|
-
|
|
8
|
-
▓▓░░ ▓▓▓▓▓░░ ▓▓▓▓ ▓▓▓▓ ▓▓ ▓▓ ▓▓▓▓▓ ▓▓▓▓▓ ▓▓▓▓ ▓▓ ▓▓ ░░▓▓
|
|
9
|
-
▓▓░░ ▓▓░░░░░░░ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓ ▓▓ ░░▓▓
|
|
10
|
-
▓▓░░ ▓▓▓▓▓░░ ▓▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓▓▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓ ░░▓▓
|
|
11
|
-
▓▓░░ ▓▓░░▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓ ░░▓▓
|
|
12
|
-
▓▓░░ ▓▓▓▓▓░░ ▓▓▓▓ ▓▓▓▓ ▓▓ ▓▓ ▓▓▓▓▓ ▓▓ ▓▓▓▓▓ ▓▓ ▓▓▓ ░░▓▓
|
|
13
|
-
▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓
|
|
14
|
-
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓`));
|
|
6
|
+
console.log(chalk.cyan(`Jika Butuh Bantuan`));
|
|
7
|
+
console.log(chalk.red(`WhatsApp: +31617786379`));
|
|
15
8
|
console.log(chalk.gray("------------------------------\n"));
|
|
16
9
|
|
|
17
10
|
|