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 CHANGED
@@ -1,146 +1,184 @@
1
- <a id="readme-top"></a>
1
+ <p align="center">
2
+ <img src="https://files.catbox.moe/0wl8py.png" alt="socketon" width="320" />
3
+ </p>
2
4
 
3
- # Socketon
5
+ <a id="readme-top"></a>
4
6
 
5
- ![NPM Version](https://img.shields.io/npm/v/socketon)
6
- ![NPM Downloads](https://img.shields.io/npm/dm/socketon)
7
- ![License](https://img.shields.io/npm/l/socketon)
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
- <img src="https://files.catbox.moe/369pux.jpg" alt="Socketon" width="300" />
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
- Socketon is a WhatsApp API library forked from Baileys with enhanced features including custom pairing codes, better session management, and improved stability. It uses WebSocket to connect to WhatsApp without requiring a browser.
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
- ## Features
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
- - Custom pairing codes for stable authentication
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
- ## Installation
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 install socketon
50
+ npm i socketon
34
51
  ```
35
52
 
36
- Requirements:
37
- - Node.js >= 20.0.0
53
+ requirements:
54
+ - node.js >= 20
55
+
56
+ ---
38
57
 
39
- ## Quick Start
58
+ ## quick start
40
59
 
41
- ### Bot Dasar - Basic Bot Example
60
+ ### connect (qr)
42
61
 
43
- ```javascript
44
- const { makeWASocket, useMultiFileAuthState, DisconnectReason } = require('socketon');
45
- const pino = require('pino');
62
+ ```js
63
+ const { makeWASocket, useMultiFileAuthState } = require('socketon')
46
64
 
47
- async function startBot() {
48
- const { state, saveCreds } = await useMultiFileAuthState('./auth_info_socketon');
65
+ async function start() {
66
+ const { state, saveCreds } = await useMultiFileAuthState('./auth')
49
67
 
50
- const sock = makeWASocket({
51
- auth: state,
52
- printQRInTerminal: true,
53
- logger: pino({ level: 'silent' })
54
- });
68
+ const sock = makeWASocket({
69
+ auth: state,
70
+ printQRInTerminal: true
71
+ })
55
72
 
56
- sock.ev.on('connection.update', async (update) => {
57
- const { connection, lastDisconnect } = update;
73
+ sock.ev.on('creds.update', saveCreds)
58
74
 
59
- if (connection === 'close') {
60
- const shouldReconnect = lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut;
61
- if (shouldReconnect) {
62
- startBot();
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
- sock.ev.on('messages.upsert', async ({ messages, type }) => {
70
- if (type !== 'notify') return;
81
+ start()
82
+ ```
71
83
 
72
- for (const msg of messages) {
73
- if (!msg.message) continue;
84
+ ### auto reply (simple)
74
85
 
75
- const from = msg.key.remoteJid;
76
- const isiPesan = msg.message.conversation || msg.message.extendedTextMessage?.text;
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
- if (isiPesan) {
79
- console.log(`Pesan dari ${from}: ${isiPesan}`);
80
- await sock.sendMessage(from, { text: `Echo: ${isiPesan}` });
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
- startBot();
95
+ await sock.sendMessage(jid, { text: `echo: ${text}` })
96
+ })
87
97
  ```
88
98
 
89
- ### Pairing Code - Pairing Code
99
+ ---
100
+
101
+ ## pairing code (no qr)
90
102
 
91
- ```javascript
92
- const { makeWASocket, useMultiFileAuthState } = require('socketon');
93
- const pino = require('pino');
103
+ ```js
104
+ const { makeWASocket, useMultiFileAuthState } = require('socketon')
94
105
 
95
- async function connectWithPairingCode() {
96
- const { state, saveCreds } = await useMultiFileAuthState('./auth_info_socketon');
106
+ async function pairing() {
107
+ const { state, saveCreds } = await useMultiFileAuthState('./auth')
97
108
 
98
- const sock = makeWASocket({
99
- auth: state,
100
- printQRInTerminal: false,
101
- logger: pino({ level: 'silent' })
102
- });
109
+ const sock = makeWASocket({
110
+ auth: state,
111
+ printQRInTerminal: false
112
+ })
103
113
 
104
- sock.ev.on('connection.update', async (update) => {
105
- const { connection } = update;
114
+ sock.ev.on('creds.update', saveCreds)
106
115
 
107
- if (connection === 'open') {
108
- // Default pairing code: SOCKETON
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
- // Custom pairing code
113
- const pairingCodeCustom = await sock.requestPairingCode('6281234567890', 'KODEKU');
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
- sock.ev.on('creds.update', saveCreds);
122
+ // custom
123
+ // const custom = await sock.requestPairingCode('6281234567890', 'KODEKAMU')
124
+ // console.log('custom code:', custom)
125
+ })
119
126
  }
120
127
 
121
- connectWithPairingCode();
128
+ pairing()
122
129
  ```
123
130
 
124
131
  ---
125
132
 
126
- ## Links
133
+ ## migration from baileys
127
134
 
128
- - **Documentation**: [DOCS](./DOCS/README.md) - Dokumentasi lengkap API dan contoh lengkap
129
- - NPM Package: https://www.npmjs.com/package/socketon
130
- - GitHub Repository: https://github.com/IbraDecode/socketon
131
- - Issues: https://github.com/IbraDecode/socketon/issues
132
- - Discussions: https://github.com/IbraDecode/socketon/discussions
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
- ### Contributors
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
- Star this repo if you find it useful!
169
+ ---
170
+
171
+ ## credits
172
+
173
+ - original baileys by @adiwajshing
174
+ - modified and maintained by kiuur & ibra decode
175
+
176
+ ---
143
177
 
144
- Made by IbraDecode
178
+ <p align="center">
179
+ star repo ini kalau bermanfaat
180
+ </p>
145
181
 
146
- <a href="#readme-top">Back to Top</a>
182
+ <p align="center">
183
+ <a href="#readme-top">back to top</a>
184
+ </p>
@@ -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 || "SOCKET1";
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socketon",
3
- "version": "0.30.6",
3
+ "version": "0.30.7",
4
4
  "description": "WhatsApp API Library - Socketon By IbraDecode",
5
5
  "keywords": [
6
6
  "whatsapp",