@ryuu-reinzz/haruka-lib 1.0.10 → 1.0.11
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 +46 -151
- package/main/index.js +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,107 +1,43 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
6
|
-
|
|
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:
|
|
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.
|
|
53
10
|
``` javascript
|
|
54
|
-
conn.sendOrder(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
totalCurrencyCode: "IDR"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
quoted: m,
|
|
70
|
-
mentions: [m.sender]
|
|
71
|
-
}
|
|
72
|
-
);
|
|
11
|
+
conn.sendOrder(m.chat, {
|
|
12
|
+
orderId: "ORDER-" + Date.now(),
|
|
13
|
+
thumbnail: global.thumbnail,
|
|
14
|
+
itemCount: 15,
|
|
15
|
+
status: 1,
|
|
16
|
+
surface: 1,
|
|
17
|
+
orderTitle: "Premium Subscription",
|
|
18
|
+
message: "Zahlea botz",
|
|
19
|
+
sellerJid: conn.user.jid,
|
|
20
|
+
totalAmount1000: 500000000,
|
|
21
|
+
totalCurrencyCode: "IDR"
|
|
22
|
+
}, { quoted: m, mentions: [m.sender] });
|
|
73
23
|
```
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
#2. sendAlbum
|
|
82
|
-
|
|
83
|
-
Deskripsi: Mengirim pesan berupa beberapa gambar sekaligus.
|
|
24
|
+
Hasil Output:
|
|
25
|
+
<img src="https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendOrder.jpg" width="300" />
|
|
84
26
|
|
|
85
|
-
|
|
27
|
+
## 2. Send Album
|
|
28
|
+
Cocok untuk mengirim katalog produk atau galeri foto tanpa memenuhi chat.
|
|
86
29
|
``` javascript
|
|
87
30
|
conn.sendAlbum(m.chat, [
|
|
88
31
|
{ image: { url: global.thumbnail }, caption: "Gambar 1" },
|
|
89
32
|
{ image: { url: global.thumbnail }, caption: "Gambar 2" },
|
|
90
33
|
{ image: fs.readFileSync("./image.jpg"), caption: "Stiker lucu" }
|
|
91
|
-
], { quoted: m });
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
#3. sendCard
|
|
34
|
+
], { quoted: m });
|
|
35
|
+
```
|
|
36
|
+
Hasil Output:
|
|
37
|
+
<img src="https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendAlbum.jpg" width="300" />
|
|
101
38
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
Contoh:
|
|
39
|
+
## 3. Send Card (Carousel)
|
|
40
|
+
Fitur tercanggih untuk membuat menu bot yang bisa digeser (slide) ke samping.
|
|
105
41
|
``` javascript
|
|
106
42
|
conn.sendCard(m.chat, {
|
|
107
43
|
text: "Bot Thumbnail",
|
|
@@ -112,74 +48,33 @@ conn.sendCard(m.chat, {
|
|
|
112
48
|
{
|
|
113
49
|
image: global.thumbnail,
|
|
114
50
|
caption: "Thumbnail 1",
|
|
115
|
-
|
|
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
|
-
]
|
|
51
|
+
buttons: [{ name: "cta_url", buttonParamsJson: JSON.stringify({ display_text: "Visit", url: "https://google.com" }) }]
|
|
139
52
|
}
|
|
140
53
|
]
|
|
141
54
|
});
|
|
142
55
|
```
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
56
|
+
## Hasil Output:
|
|
57
|
+
<img src="https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendCard.jpg" width="300" />
|
|
146
58
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
#4. sendSticker
|
|
150
|
-
|
|
151
|
-
Deskripsi: Mengirim pesan yang bisa bebas custom packname dan author.
|
|
152
|
-
|
|
153
|
-
Contoh:
|
|
59
|
+
## 4. Custom Sticker
|
|
60
|
+
Buat stiker langsung dengan identitas bot kamu sendiri.
|
|
154
61
|
``` javascript
|
|
155
62
|
conn.sendSticker(m.chat, {
|
|
156
63
|
sticker: "./stiker/apa-woi.webp",
|
|
157
|
-
packname:
|
|
158
|
-
author:
|
|
64
|
+
packname: "Haruka Bot",
|
|
65
|
+
author: "@ryuu-reinzz"
|
|
159
66
|
});
|
|
160
67
|
```
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
68
|
+
## Hasil Output:
|
|
69
|
+
<img src="https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendSticker.jpg" width="200" />
|
|
165
70
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
#5. Search Lid and PN
|
|
169
|
-
|
|
170
|
-
Deskripsi: Mencari Lid dan PN.
|
|
171
|
-
|
|
172
|
-
Contoh:
|
|
71
|
+
## 5. ID Mapping (LID to PN and PN to LID)
|
|
173
72
|
``` javascript
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
> conn.getPNFromLid(
|
|
180
|
-
m,
|
|
181
|
-
"129459441135829@lid"
|
|
182
|
-
);
|
|
73
|
+
// Mencari LID dari nomor HP
|
|
74
|
+
await conn.getLidFromPN(m, "6288246552068@s.whatsapp.net");
|
|
75
|
+
|
|
76
|
+
// Mencari nomor HP dari LID
|
|
77
|
+
await conn.getPNFromLid(m, "129459441135829@lid");
|
|
183
78
|
```
|
|
184
|
-
|
|
185
|
-
|
|
79
|
+
### Hasil Output:
|
|
80
|
+
<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 =
|
|
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.
|
|
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
|
|