@blckrose/baileys 1.2.8 → 2.0.0

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/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
- * @blckrose/baileys — CJS wrapper
4
+ * @ryuhan/baileys — CJS wrapper
5
5
  *
6
6
  * Destructure dan langsung pakai tanpa await ready:
7
7
  *
8
- * const { makeWASocket, useMultiFileAuthState, Browsers } = require('@blckrose/baileys');
8
+ * const { makeWASocket, useMultiFileAuthState, Browsers } = require('@ryuhan/baileys');
9
9
  *
10
10
  * async function start() {
11
11
  * const { state, saveCreds } = await useMultiFileAuthState('./auth');
@@ -69,10 +69,10 @@ module.exports.load = _load;
69
69
 
70
70
  function _wrapFn(name) {
71
71
  return async function(...args) {
72
- if (_loadError) throw new Error('[blckrose-baileys] Load failed: ' + _loadError.message);
72
+ if (_loadError) throw new Error('[ryuhan-baileys] Load failed: ' + _loadError.message);
73
73
  if (!_mod) await _load();
74
74
  const fn = name === 'makeWASocket' ? _mod.default : _mod[name];
75
- if (typeof fn !== 'function') throw new Error('[blckrose-baileys] "' + name + '" bukan fungsi');
75
+ if (typeof fn !== 'function') throw new Error('[ryuhan-baileys] "' + name + '" bukan fungsi');
76
76
  return fn(...args);
77
77
  };
78
78
  }
@@ -83,9 +83,9 @@ function _wrapMakeWASocket() {
83
83
  return function makeWASocket(...args) {
84
84
  if (_mod) return _mod.default(...args);
85
85
  // Kalau belum load, throw — karena makeWASocket tidak async
86
- if (_loadError) throw new Error('[blckrose-baileys] Load failed: ' + _loadError.message);
86
+ if (_loadError) throw new Error('[ryuhan-baileys] Load failed: ' + _loadError.message);
87
87
  throw new Error(
88
- '[blckrose-baileys] makeWASocket dipanggil sebelum Baileys selesai load.\n' +
88
+ '[ryuhan-baileys] makeWASocket dipanggil sebelum Baileys selesai load.\n' +
89
89
  'Pastikan await useMultiFileAuthState() dulu (itu sudah cukup untuk menunggu load).'
90
90
  );
91
91
  };
@@ -94,10 +94,10 @@ function _wrapMakeWASocket() {
94
94
  // ── Lazy getter untuk nilai non-fungsi ────────────────────────────────────────
95
95
  function _makeLazyGetter(name) {
96
96
  return function() {
97
- if (_loadError) throw new Error('[blckrose-baileys] Load failed: ' + _loadError.message);
97
+ if (_loadError) throw new Error('[ryuhan-baileys] Load failed: ' + _loadError.message);
98
98
  if (_mod) return _mod[name];
99
99
  throw new Error(
100
- '[blckrose-baileys] "' + name + '" belum siap. ' +
100
+ '[ryuhan-baileys] "' + name + '" belum siap. ' +
101
101
  'Gunakan await useMultiFileAuthState() sebelum akses konstanta ini.'
102
102
  );
103
103
  };
@@ -144,11 +144,11 @@ const _functions = [
144
144
  'toReadable','transferDevice','trimUndefined','unixTimestampSeconds',
145
145
  'unpadRandomMax16','updateMessageWithEventResponse','updateMessageWithPollUpdate',
146
146
  'updateMessageWithReaction','updateMessageWithReceipt','uploadWithNodeHttp',
147
- 'useMultiFileAuthState','writeRandomPadMax16','makeNewsletterUtils','resolveJid','resolveJids','createApocalypse','binaryNodeToString',
147
+ 'useMultiFileAuthState','writeRandomPadMax16','makeNewsletterUtils','resolveJid','resolveJids','binaryNodeToString',
148
148
  ];
149
149
 
150
150
  const _constants = [
151
- 'Browsers','apocalypse','BufferJSON','CALL_AUDIO_PREFIX','CALL_VIDEO_PREFIX','Curve',
151
+ 'Browsers','BufferJSON','CALL_AUDIO_PREFIX','CALL_VIDEO_PREFIX','Curve',
152
152
  'DEFAULT_CACHE_TTLS','DEFAULT_CONNECTION_CONFIG','DEFAULT_ORIGIN',
153
153
  'DEF_CALLBACK_PREFIX','DEF_TAG_PREFIX','DICT_VERSION','DisconnectReason',
154
154
  'INITIAL_PREKEY_COUNT','KEY_BUNDLE_TYPE','MEDIA_HKDF_KEY_MAPPING','MEDIA_KEYS',
package/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @blckrose/baileys — CJS wrapper type declarations
2
+ * @ryuhan/baileys — CJS wrapper type declarations
3
3
  *
4
4
  * Destructure dan langsung pakai, tanpa await ready:
5
5
  *
6
- * const { makeWASocket, useMultiFileAuthState, Browsers } = require('@blckrose/baileys');
6
+ * const { makeWASocket, useMultiFileAuthState, Browsers } = require('@ryuhan/baileys');
7
7
  *
8
8
  * async function start() {
9
9
  * const { state, saveCreds } = await useMultiFileAuthState('./auth');
@@ -19,5 +19,4 @@ export * from './browser-utils.js';
19
19
  export * from './identity-change-handler.js';
20
20
  export * from './messages-newsletter.js';
21
21
  export * from './resolve-jid.js';
22
- export * from './apocalypse.js';
23
22
  //# sourceMappingURL=index.d.ts.map
@@ -24,5 +24,4 @@ export * from './browser-utils.js';
24
24
  export * from './identity-change-handler.js';
25
25
  export * from './messages-newsletter.js';
26
26
  export * from './resolve-jid.js';
27
- export * from './apocalypse.js';
28
27
  //# sourceMappingURL=index.js.map
package/lib/index.d.ts CHANGED
@@ -10,21 +10,3 @@ export type WASocket = ReturnType<typeof makeWASocket>;
10
10
  export { makeWASocket };
11
11
  export default makeWASocket;
12
12
  //# sourceMappingURL=index.d.ts.map
13
- // ── Global Apocalypse declaration ────────────────────────────────────────────
14
- // Tersedia otomatis setelah require/import baileys, tanpa import eksplisit.
15
- //
16
- // Tanpa API key:
17
- // await apocalypse.get('/search/spotify', { q: 'swim' })
18
- //
19
- // Dengan API key — buat instance sendiri:
20
- // const api = createApocalypse({ apiKey: 'NEMOPHILA' })
21
- // await api.get('/search/spotify', { q: 'swim' })
22
- //
23
- // Dari config/setting global:
24
- // const api = createApocalypse({ apiKey: global.apikey })
25
- // await api.get('/search/spotify', { q: 'swim' })
26
- declare global {
27
- var apocalypse: import('./Utils/apocalypse.js').ApocalypseClient;
28
- var createApocalypse: typeof import('./Utils/apocalypse.js').createApocalypse;
29
- }
30
- // ─────────────────────────────────────────────────────────────────────────────
package/lib/index.js CHANGED
@@ -1,46 +1,19 @@
1
1
  import chalk from 'chalk';
2
2
 
3
- // ── Blckrose Baileys Banner ───────────────────────────────────────────────────
4
- const _blck = {
5
- line : chalk.hex('#8B5CF6')('━'.repeat(60)),
6
- title: chalk.bold.hex('#A78BFA')(' Blckrose Baileys ') + chalk.hex('#6D28D9')('| Modified Edition'),
7
- pair : chalk.hex('#7C3AED')('⌘ Pairing Code : ') + chalk.bold.white('BLCKRO53'),
8
- repo : chalk.hex('#7C3AED')('❖ Report Error : ') + chalk.bold.cyan('@Blckrose0'),
9
- note : chalk.dim.hex('#A78BFA')(' Laporkan error baileys ke kontak di atas'),
3
+ // ── Rimuru Baileys Banner ─────────────────────────────────────────────────────
4
+ const _rimuru = {
5
+ line : chalk.hex('#00BFFF')('━'.repeat(60)),
6
+ title: chalk.bold.hex('#00BFFF')('💧 Rimuru Baileys ') + chalk.hex('#0080FF')('| Modified Edition'),
7
+ pair : chalk.hex('#0080FF')('⌘ Pairing Code : ') + chalk.bold.white('MURUSAMA'),
8
+ repo : chalk.hex('#0080FF')('❖ GitHub : ') + chalk.bold.cyan('@ryuhandev'),
9
+ note : chalk.dim.hex('#00BFFF')(' WhatsApp Multi-Device Library'),
10
10
  };
11
- console.log(_blck.line);
12
- console.log(_blck.title);
13
- console.log(_blck.pair);
14
- console.log(_blck.repo);
15
- console.log(_blck.note);
16
- console.log(_blck.line);
17
- // ─────────────────────────────────────────────────────────────────────────────
18
-
19
- import { apocalypse as _apocalypseInstance, createApocalypse as _createApocalypse } from './Utils/apocalypse.js';
20
-
21
- // ── Global Apocalypse API ─────────────────────────────────────────────────────
22
- // Semua tersedia TANPA import, otomatis setelah require('@blckrose/baileys'):
23
- //
24
- // // Tanpa API key:
25
- // await apocalypse.get('/search/spotify', { q: 'swim' })
26
- //
27
- // // Dengan API key — buat instance sendiri:
28
- // const api = createApocalypse({ apiKey: 'NEMOPHILA' })
29
- // await api.get('/search/spotify', { q: 'swim' })
30
- //
31
- // // Dari config/setting global:
32
- // const api = createApocalypse({ apiKey: global.apikey })
33
- // await api.get('/search/spotify', { q: 'swim' })
34
- //
35
- // // Set key ke global instance:
36
- // apocalypse.setKey('NEMOPHILA')
37
- // ─────────────────────────────────────────────────────────────────────────────
38
- if (typeof globalThis.apocalypse === 'undefined') {
39
- globalThis.apocalypse = _apocalypseInstance;
40
- }
41
- if (typeof globalThis.createApocalypse === 'undefined') {
42
- globalThis.createApocalypse = _createApocalypse;
43
- }
11
+ console.log(_rimuru.line);
12
+ console.log(_rimuru.title);
13
+ console.log(_rimuru.pair);
14
+ console.log(_rimuru.repo);
15
+ console.log(_rimuru.note);
16
+ console.log(_rimuru.line);
44
17
  // ─────────────────────────────────────────────────────────────────────────────
45
18
 
46
19
  import makeWASocket from './Socket/index.js';
package/package.json CHANGED
@@ -1,18 +1,25 @@
1
1
  {
2
2
  "name": "@blckrose/baileys",
3
3
  "type": "module",
4
- "version": "1.2.8",
5
- "description": "A WebSockets library for interacting with WhatsApp Web",
4
+ "version": "2.0.0",
5
+ "description": "💧 Rimuru Baileys - WhatsApp Multi-Device Library with intelligent @lid/@jid mapping",
6
6
  "keywords": [
7
7
  "whatsapp",
8
- "automation"
8
+ "automation",
9
+ "baileys",
10
+ "rimuru",
11
+ "blckrose",
12
+ "whatsapp-api",
13
+ "multi-device",
14
+ "lid-mapping",
15
+ "jid-resolution"
9
16
  ],
10
- "homepage": "https://github.com/WhiskeySockets/Baileys/",
17
+ "homepage": "https://github.com/ryuhandev/rimuru-baileys/",
11
18
  "repository": {
12
- "url": "git@github.com:WhiskeySockets/Baileys.git"
19
+ "url": "https://github.com/ryuhandev/rimuru-baileys.git"
13
20
  },
14
21
  "license": "MIT",
15
- "author": "Black Rose",
22
+ "author": "ryuhan <hanzthespike@gmail.com>",
16
23
  "main": "./index.cjs",
17
24
  "module": "./lib/index.js",
18
25
  "types": "./index.d.ts",
@@ -43,7 +50,10 @@
43
50
  "index.cjs",
44
51
  "index.d.ts"
45
52
  ],
46
- "scripts": {},
53
+ "scripts": {
54
+ "lint": "eslint lib --ext .js,.ts",
55
+ "lint:fix": "eslint lib --fix --ext .js,.ts"
56
+ },
47
57
  "dependencies": {
48
58
  "@cacheable/node-cache": "^1.4.0",
49
59
  "@hapi/boom": "^9.1.3",
@@ -1,196 +0,0 @@
1
- /**
2
- * apocalypse-api.js
3
- * Client untuk API https://api.apocalypse.web.id
4
- *
5
- * Pola URL:
6
- * /{kategori}/{endpoint}?{param}={value}
7
- * /{kategori}/{sub}/{endpoint}?{param}={value}
8
- *
9
- * Contoh:
10
- * await apocalypse.get('/search/spotify?q=swim')
11
- * await apocalypse.get('/search/youtube?q=hello')
12
- * await apocalypse.get('/downloader/tiktok?url=https://...')
13
- * await apocalypse.get('/manga/jagoanmanga/search?q=killer+peter')
14
- * await apocalypse.get('/ai/gpt?text=hello')
15
- */
16
-
17
- const BASE_URL = 'https://api.apocalypse.web.id';
18
-
19
- /**
20
- * Buat Apocalypse API client.
21
- *
22
- * @param {object} [options]
23
- * @param {string} [options.apiKey] — API key jika diperlukan
24
- * @param {number} [options.timeout=15000] — timeout dalam ms
25
- * @param {object} [options.headers] — header tambahan
26
- *
27
- * @example
28
- * import { createApocalypseApi } from '@blckrose/baileys';
29
- * const apocalypse = createApocalypseApi();
30
- *
31
- * // Atau dengan API key:
32
- * const apocalypse = createApocalypseApi({ apiKey: 'your-key' });
33
- */
34
- export function createApocalypseApi(options = {}) {
35
- const {
36
- apiKey,
37
- timeout = 15000,
38
- headers: extraHeaders = {}
39
- } = options;
40
-
41
- const baseHeaders = {
42
- 'Accept': 'application/json',
43
- 'User-Agent': 'blckrose-baileys/1.1.5-nl',
44
- ...(apiKey ? { 'Authorization': `Bearer ${apiKey}`, 'x-api-key': apiKey } : {}),
45
- ...extraHeaders
46
- };
47
-
48
- /**
49
- * Fetch dengan timeout.
50
- */
51
- async function _fetch(url, opts = {}) {
52
- const controller = new AbortController();
53
- const timer = setTimeout(() => controller.abort(), timeout);
54
- try {
55
- const res = await fetch(url, {
56
- ...opts,
57
- signal: controller.signal,
58
- headers: { ...baseHeaders, ...(opts.headers || {}) }
59
- });
60
- if (!res.ok) {
61
- const errText = await res.text().catch(() => '');
62
- throw new Error(`Apocalypse API error ${res.status}: ${errText || res.statusText}`);
63
- }
64
- const ct = res.headers.get('content-type') || '';
65
- if (ct.includes('application/json')) {
66
- return await res.json();
67
- }
68
- // Buffer untuk response binary (gambar, audio, video)
69
- return await res.arrayBuffer().then(buf => Buffer.from(buf));
70
- } finally {
71
- clearTimeout(timer);
72
- }
73
- }
74
-
75
- /**
76
- * Normalise path — pastikan leading slash ada.
77
- */
78
- function _url(path) {
79
- const p = path.startsWith('/') ? path : `/${path}`;
80
- return `${BASE_URL}${p}`;
81
- }
82
-
83
- // ── Public methods ──────────────────────────────────────────────────────
84
-
85
- /**
86
- * GET request ke Apocalypse API.
87
- *
88
- * @param {string} path — path + query string, contoh: '/search/spotify?q=swim'
89
- * @returns {Promise<object|Buffer>}
90
- *
91
- * @example
92
- * const res = await apocalypse.get('/search/spotify?q=swim')
93
- * const res = await apocalypse.get('/manga/jagoanmanga/search?q=killer+peter')
94
- */
95
- async function get(path) {
96
- return _fetch(_url(path));
97
- }
98
-
99
- /**
100
- * GET dengan params object — otomatis di-encode ke query string.
101
- *
102
- * @param {string} path — path tanpa query string
103
- * @param {object} [params] — query params
104
- *
105
- * @example
106
- * const res = await apocalypse.fetch('/search/spotify', { q: 'swim' })
107
- * const res = await apocalypse.fetch('/manga/jagoanmanga/search', { q: 'killer peter' })
108
- * const res = await apocalypse.fetch('/downloader/tiktok', { url: 'https://...' })
109
- */
110
- async function fetchApi(path, params = {}) {
111
- const base = path.startsWith('/') ? path : `/${path}`;
112
- const qs = new URLSearchParams(
113
- Object.fromEntries(
114
- Object.entries(params)
115
- .filter(([, v]) => v !== undefined && v !== null)
116
- .map(([k, v]) => [k, String(v)])
117
- )
118
- ).toString();
119
- const full = qs ? `${BASE_URL}${base}?${qs}` : `${BASE_URL}${base}`;
120
- return _fetch(full);
121
- }
122
-
123
- /**
124
- * POST request.
125
- *
126
- * @param {string} path
127
- * @param {object} [body]
128
- *
129
- * @example
130
- * const res = await apocalypse.post('/ai/gpt', { text: 'hello' })
131
- */
132
- async function post(path, body = {}) {
133
- return _fetch(_url(path), {
134
- method: 'POST',
135
- headers: { 'Content-Type': 'application/json' },
136
- body: JSON.stringify(body)
137
- });
138
- }
139
-
140
- // ── Shorthand helpers ───────────────────────────────────────────────────
141
-
142
- /** Search wrapper — apocalypse.search('spotify', 'swim') */
143
- async function search(endpoint, query) {
144
- return fetchApi(`/search/${endpoint}`, { q: query });
145
- }
146
-
147
- /** Downloader wrapper — apocalypse.download('tiktok', url) */
148
- async function download(endpoint, url) {
149
- return fetchApi(`/downloader/${endpoint}`, { url });
150
- }
151
-
152
- /** AI wrapper — apocalypse.ai('gpt', text) */
153
- async function ai(endpoint, text, extra = {}) {
154
- return fetchApi(`/ai/${endpoint}`, { text, ...extra });
155
- }
156
-
157
- /** Sticker wrapper — apocalypse.sticker(endpoint, url) */
158
- async function sticker(endpoint, url) {
159
- return fetchApi(`/sticker/${endpoint}`, { url });
160
- }
161
-
162
- /** Manga wrapper — apocalypse.manga('jagoanmanga', 'search', { q: 'killer' }) */
163
- async function manga(site, endpoint, params = {}) {
164
- return fetchApi(`/manga/${site}/${endpoint}`, params);
165
- }
166
-
167
- /** Game wrapper — apocalypse.game(endpoint, params) */
168
- async function game(endpoint, params = {}) {
169
- return fetchApi(`/game/${endpoint}`, params);
170
- }
171
-
172
- return {
173
- // Core
174
- get,
175
- fetch: fetchApi,
176
- post,
177
- // Shorthands
178
- search,
179
- download,
180
- ai,
181
- sticker,
182
- manga,
183
- game,
184
- // Expose base URL
185
- BASE_URL,
186
- };
187
- }
188
-
189
- /**
190
- * Instance default tanpa API key — siap pakai langsung.
191
- *
192
- * @example
193
- * import { apocalypse } from '@blckrose/baileys';
194
- * const res = await apocalypse.get('/search/spotify?q=swim');
195
- */
196
- export const apocalypse = createApocalypseApi();
@@ -1,116 +0,0 @@
1
- /**
2
- * Apocalypse API client declarations.
3
- * https://api.apocalypse.web.id
4
- */
5
-
6
- export interface ApocalypseConfig {
7
- /** Override base URL (default: https://api.apocalypse.web.id) */
8
- baseUrl?: string;
9
- /** API key — dikirim sebagai header x-api-key */
10
- apiKey?: string;
11
- /** Timeout request dalam ms (default: 30000) */
12
- timeout?: number;
13
- /** Header tambahan */
14
- headers?: Record<string, string>;
15
- }
16
-
17
- export interface ApocalypseResponse<T = any> {
18
- /** Data utama dari API (data.result / data.data / root) */
19
- readonly result: T;
20
- /** true jika API mengembalikan status sukses */
21
- readonly status: boolean;
22
- /** Pesan dari API */
23
- readonly message: string;
24
- /** Full response JSON mentah */
25
- readonly raw: any;
26
- /** URL yang dipanggil */
27
- readonly url: string;
28
- /** Ambil field tertentu dari result */
29
- get<K extends keyof T>(key: K): T[K] | undefined;
30
- }
31
-
32
- export interface ApocalypseCategoryClient {
33
- /**
34
- * GET ke /{category}/{endpoint}
35
- * @example
36
- * const search = apocalypse.category('search');
37
- * await search.get('spotify', { q: 'swim' });
38
- */
39
- get<T = any>(endpoint: string, params?: Record<string, string | number>): Promise<ApocalypseResponse<T>>;
40
- /**
41
- * POST ke /{category}/{endpoint}
42
- */
43
- post<T = any>(endpoint: string, body?: object, params?: Record<string, string | number>): Promise<ApocalypseResponse<T>>;
44
- }
45
-
46
- export interface ApocalypseClient {
47
- /**
48
- * GET request ke Apocalypse API.
49
- *
50
- * @example
51
- * await apocalypse.get('/search/spotify?q=swim');
52
- * await apocalypse.get('/search/spotify', { q: 'swim' });
53
- * await apocalypse.get('/manga/jagoanmanga/search', { q: 'killer+peter' });
54
- */
55
- get<T = any>(path: string, params?: Record<string, string | number>): Promise<ApocalypseResponse<T>>;
56
-
57
- /**
58
- * POST request ke Apocalypse API.
59
- */
60
- post<T = any>(path: string, body?: object, params?: Record<string, string | number>): Promise<ApocalypseResponse<T>>;
61
-
62
- /**
63
- * Buat caller untuk kategori tertentu.
64
- *
65
- * @example
66
- * const search = apocalypse.category('search');
67
- * await search.get('spotify', { q: 'swim' });
68
- *
69
- * const manga = apocalypse.category('manga/jagoanmanga');
70
- * await manga.get('search', { q: 'naruto' });
71
- */
72
- category(cat: string): ApocalypseCategoryClient;
73
-
74
- /**
75
- * Set API key untuk global apocalypse instance.
76
- * Cukup tulis SEKALI di bot.js — berlaku untuk semua request setelahnya.
77
- *
78
- * @example
79
- * // Di bot.js, setelah require baileys:
80
- * apocalypse.setKey('API_KEY_KAMU')
81
- *
82
- * // Di handler manapun:
83
- * const res = await apocalypse.get('/premium/endpoint', { q: 'test' })
84
- */
85
- setKey(key: string): void;
86
-
87
- /**
88
- * Set konfigurasi lengkap untuk global apocalypse instance.
89
- *
90
- * @example
91
- * apocalypse.setConfig({ apiKey: 'xxx', timeout: 15000 })
92
- */
93
- setConfig(config: ApocalypseConfig): void;
94
-
95
- /** Base URL yang dipakai */
96
- readonly baseUrl: string;
97
- }
98
-
99
- /**
100
- * Buat instance Apocalypse API client baru.
101
- *
102
- * @example
103
- * const apocalypse = createApocalypse({ apiKey: 'xxx' });
104
- * const res = await apocalypse.get('/search/spotify', { q: 'swim' });
105
- * console.log(res.result);
106
- */
107
- export declare function createApocalypse(config?: ApocalypseConfig): ApocalypseClient;
108
-
109
- /**
110
- * Instance default siap pakai (tanpa konfigurasi).
111
- *
112
- * @example
113
- * import { apocalypse } from '@blckrose/baileys';
114
- * const { result } = await apocalypse.get('/search/spotify', { q: 'swim' });
115
- */
116
- export declare const apocalypse: ApocalypseClient;