@ryuu-reinzz/haruka-lib 1.0.10 → 1.0.12

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.
Files changed (3) hide show
  1. package/README.md +46 -147
  2. package/main/index.js +5 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,107 +1,46 @@
1
- # Package Docs
1
+ ### Haruka Library
2
+ <p align="center">
3
+ <img src="https://api.ryuu-dev.offc.my.id/src/assest/bot/Haruka.jpg" width="400" alt="Haruka-Lib">
2
4
 
3
- **@ryuu-reinzz/haruka-lib**
4
5
 
5
- ![Thumbnail](https://api.ryuu-dev.offc.my.id/src/assest/bot/Haruka.jpg)
6
+ <b>Powerful & Lightweight WhatsApp Bot Library Extension</b>
7
+ </p>
8
+ ## 1. Send Order
9
+ # Digunakan untuk membuat tampilan pesanan profesional atau sekedar prank orderan.
6
10
 
7
- ---
8
-
9
- ## Daftar Fitur
10
-
11
- ### How to Use
12
- **Deskripsi:** Contoh penggunaan Haruka Library dengan Baileys.
13
-
14
- **Contoh:**
15
- ```javascript
16
- //how to use:
17
- //npm i @ryuu-reinzz/haruka-lib@1.0.9
18
-
19
- import haruka from "@ryuu-reinzz/haruka-lib";
20
- import makeWASocket, {
21
- proto,
22
- generateWAMessageFromContent,
23
- jidDecode,
24
- downloadContentFromMessage,
25
- prepareWAMessageMedia,
26
- generateMessageID,
27
- generateWAMessage
28
- } from '@ryuu-reinzz/baileys';
29
-
30
- const property = {
31
- proto,
32
- generateWAMessageFromContent,
33
- jidDecode,
34
- downloadContentFromMessage,
35
- prepareWAMessageMedia,
36
- generateMessageID,
37
- generateWAMessage
38
- };
39
-
40
- const conn = makeWASocket({});
41
- haruka.addProperty(conn, store, smsg, property);
42
- ```
43
-
44
-
45
-
46
- ---
47
- ##List Feature
48
- #1. sendOrder
49
-
50
- Deskripsi: Mengirim pesan orderan palsu yang bisa bebas thumbnail.
51
-
52
- Contoh:
53
11
  ``` javascript
54
- conn.sendOrder(
55
- m.chat,
56
- {
57
- orderId: "ORDER-" + Date.now(),
58
- thumbnail: global.thumbnail,
59
- itemCount: 15,
60
- status: 1,
61
- surface: 1,
62
- orderTitle: "Premium Subscription",
63
- message: "Zahlea botz",
64
- sellerJid: conn.user.jid,
65
- totalAmount1000: 500000000,
66
- totalCurrencyCode: "IDR"
67
- },
68
- {
69
- quoted: m,
70
- mentions: [m.sender]
71
- }
72
- );
12
+ conn.sendOrder(m.chat, {
13
+ orderId: "ORDER-" + Date.now(),
14
+ thumbnail: global.thumbnail,
15
+ itemCount: 15,
16
+ status: 1,
17
+ surface: 1,
18
+ orderTitle: "Premium Subscription",
19
+ message: "Zahlea botz",
20
+ sellerJid: conn.user.jid,
21
+ totalAmount1000: 500000000,
22
+ totalCurrencyCode: "IDR"
23
+ }, { quoted: m, mentions: [m.sender] });
73
24
  ```
74
- Example:
75
- ![example](https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendOrder.jpg)
76
-
77
-
78
-
79
- ---
80
-
81
- #2. sendAlbum
25
+ Hasil Output:
26
+ <img src="https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendOrder.jpg" width="300" />
82
27
 
83
- Deskripsi: Mengirim pesan berupa beberapa gambar sekaligus.
28
+ ## 2. Send Album
29
+ # Cocok untuk mengirim katalog produk atau galeri foto tanpa memenuhi chat.
84
30
 
85
- Contoh:
86
31
  ``` javascript
87
32
  conn.sendAlbum(m.chat, [
88
33
  { image: { url: global.thumbnail }, caption: "Gambar 1" },
89
34
  { image: { url: global.thumbnail }, caption: "Gambar 2" },
90
35
  { image: fs.readFileSync("./image.jpg"), caption: "Stiker lucu" }
91
- ], { quoted: m });
92
- ```
93
- Example:
94
- ![example](https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendAlbum.jpg)
95
-
96
-
97
-
98
- ---
36
+ ], { quoted: m });
37
+ ```
38
+ Hasil Output:
39
+ <img src="https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendAlbum.jpg" width="300" />
99
40
 
100
- #3. sendCard
41
+ ## 3. Send Card (Carousel)
42
+ # Fitur tercanggih untuk membuat menu bot yang bisa digeser (slide) ke samping.
101
43
 
102
- Deskripsi: Mengirim pesan seperti kartu dan bisa memiliki button.
103
-
104
- Contoh:
105
44
  ``` javascript
106
45
  conn.sendCard(m.chat, {
107
46
  text: "Bot Thumbnail",
@@ -112,74 +51,34 @@ conn.sendCard(m.chat, {
112
51
  {
113
52
  image: global.thumbnail,
114
53
  caption: "Thumbnail 1",
115
- source: global.thumbnail,
116
- buttons: [
117
- {
118
- name: "cta_url",
119
- buttonParamsJson: JSON.stringify({
120
- display_text: "Lihat Gambar 1",
121
- url: global.thumbnail
122
- })
123
- }
124
- ]
125
- },
126
- {
127
- image: global.thumbnail,
128
- caption: "Thumbnail 2",
129
- source: global.thumbnail,
130
- buttons: [
131
- {
132
- name: "cta_url",
133
- buttonParamsJson: JSON.stringify({
134
- display_text: "Lihat Gambar 2",
135
- url: global.thumbnail2
136
- })
137
- }
138
- ]
54
+ buttons: [{ name: "cta_url", buttonParamsJson: JSON.stringify({ display_text: "Visit", url: "https://google.com" }) }]
139
55
  }
140
56
  ]
141
57
  });
142
58
  ```
143
- Example:
144
- ![example](https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendCard.jpg)
145
-
59
+ ## Hasil Output:
60
+ <img src="https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendCard.jpg" width="300" />
146
61
 
147
- ---
62
+ ## 4. Custom Sticker
63
+ # Buat stiker langsung dengan identitas bot kamu sendiri.
148
64
 
149
- #4. sendSticker
150
-
151
- Deskripsi: Mengirim pesan yang bisa bebas custom packname dan author.
152
-
153
- Contoh:
154
65
  ``` javascript
155
66
  conn.sendSticker(m.chat, {
156
67
  sticker: "./stiker/apa-woi.webp",
157
- packname: global.packaname,
158
- author: global.author
68
+ packname: "Haruka Bot",
69
+ author: "@ryuu-reinzz"
159
70
  });
160
71
  ```
161
- Example:
162
- ![example](https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendSticker.jpg)
163
-
164
-
72
+ ## Hasil Output:
73
+ <img src="https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendSticker.jpg" width="200" />
165
74
 
166
- ---
167
-
168
- #5. Search Lid and PN
169
-
170
- Deskripsi: Mencari Lid dan PN.
171
-
172
- Contoh:
75
+ ## 5. ID Mapping (LID to PN and PN to LID)
173
76
  ``` javascript
174
- > conn.getLidFromPN(
175
- m,
176
- "6288246552068@s.whatsapp.net"
177
- );
178
- or
179
- > conn.getPNFromLid(
180
- m,
181
- "129459441135829@lid"
182
- );
77
+ // Mencari LID dari nomor HP
78
+ await conn.getLidFromPN(m, "6288246552068@s.whatsapp.net");
79
+
80
+ // Mencari nomor HP dari LID
81
+ await conn.getPNFromLid(m, "129459441135829@lid");
183
82
  ```
184
- Example:
185
- ![example](https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/mapping.jpg)
83
+ ### Hasil Output:
84
+ <img src="https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/mapping.jpg" width="300" />
package/main/index.js CHANGED
@@ -2,7 +2,8 @@ import addProperty from './socket.js';
2
2
  import useSQLiteAuthState from './sqliteAuth.js';
3
3
 
4
4
  const haruka = {}
5
- haruka.tutorial = console.log(`
5
+ haruka.tutorial = () => {
6
+ console.log(`
6
7
  ╭──────────────────────────────────────╮
7
8
  │ @ryuu-reinzz/haruka-lib │
8
9
  │ Small helper for WhatsApp Baileys │
@@ -35,7 +36,7 @@ Examples:
35
36
  generateMessageID
36
37
  }
37
38
  import haruka from "@ryuu-reinzz/haruka-lib";
38
- haruka.extendSocketBot(conn, store, smsg, baileys);
39
+ haruka.addProperty(conn, store, smsg, baileys);
39
40
 
40
41
  SQLite session:
41
42
  const sessionPath = "./session"
@@ -44,7 +45,8 @@ Examples:
44
45
  const { state, saveCreds } = await useSQLiteAuthState(sessionPath + \"auth.db\");
45
46
 
46
47
  Made by Ryuu
47
- `);
48
+ `)
49
+ }
48
50
  haruka.useSQLiteAuthState = useSQLiteAuthState;
49
51
  haruka.addProperty = addProperty;
50
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuu-reinzz/haruka-lib",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "Library extra for bot WhatsApp",
5
5
  "main": "main/index.js",
6
6
  "type": "module",