@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.
- package/README.md +46 -147
- package/main/index.js +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,107 +1,46 @@
|
|
|
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
|
+
<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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
75
|
-
|
|
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
|
-
|
|
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
|
-
|
|
94
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
144
|
-
|
|
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:
|
|
158
|
-
author:
|
|
68
|
+
packname: "Haruka Bot",
|
|
69
|
+
author: "@ryuu-reinzz"
|
|
159
70
|
});
|
|
160
71
|
```
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
185
|
-
|
|
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 =
|
|
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
|
|