@ryuu-reinzz/haruka-lib 1.0.9 → 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 +80 -0
- package/main/index.js +5 -3
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
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">
|
|
4
|
+
|
|
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.
|
|
10
|
+
``` javascript
|
|
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] });
|
|
23
|
+
```
|
|
24
|
+
Hasil Output:
|
|
25
|
+
<img src="https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendOrder.jpg" width="300" />
|
|
26
|
+
|
|
27
|
+
## 2. Send Album
|
|
28
|
+
Cocok untuk mengirim katalog produk atau galeri foto tanpa memenuhi chat.
|
|
29
|
+
``` javascript
|
|
30
|
+
conn.sendAlbum(m.chat, [
|
|
31
|
+
{ image: { url: global.thumbnail }, caption: "Gambar 1" },
|
|
32
|
+
{ image: { url: global.thumbnail }, caption: "Gambar 2" },
|
|
33
|
+
{ image: fs.readFileSync("./image.jpg"), caption: "Stiker lucu" }
|
|
34
|
+
], { quoted: m });
|
|
35
|
+
```
|
|
36
|
+
Hasil Output:
|
|
37
|
+
<img src="https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendAlbum.jpg" width="300" />
|
|
38
|
+
|
|
39
|
+
## 3. Send Card (Carousel)
|
|
40
|
+
Fitur tercanggih untuk membuat menu bot yang bisa digeser (slide) ke samping.
|
|
41
|
+
``` javascript
|
|
42
|
+
conn.sendCard(m.chat, {
|
|
43
|
+
text: "Bot Thumbnail",
|
|
44
|
+
footer: "© Ryuu Reinzz",
|
|
45
|
+
quoted: m,
|
|
46
|
+
sender: m.sender,
|
|
47
|
+
cards: [
|
|
48
|
+
{
|
|
49
|
+
image: global.thumbnail,
|
|
50
|
+
caption: "Thumbnail 1",
|
|
51
|
+
buttons: [{ name: "cta_url", buttonParamsJson: JSON.stringify({ display_text: "Visit", url: "https://google.com" }) }]
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
## Hasil Output:
|
|
57
|
+
<img src="https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendCard.jpg" width="300" />
|
|
58
|
+
|
|
59
|
+
## 4. Custom Sticker
|
|
60
|
+
Buat stiker langsung dengan identitas bot kamu sendiri.
|
|
61
|
+
``` javascript
|
|
62
|
+
conn.sendSticker(m.chat, {
|
|
63
|
+
sticker: "./stiker/apa-woi.webp",
|
|
64
|
+
packname: "Haruka Bot",
|
|
65
|
+
author: "@ryuu-reinzz"
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
## Hasil Output:
|
|
69
|
+
<img src="https://api.ryuu-dev.offc.my.id/src/assest/Haruhime/sendSticker.jpg" width="200" />
|
|
70
|
+
|
|
71
|
+
## 5. ID Mapping (LID to PN and PN to LID)
|
|
72
|
+
``` javascript
|
|
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");
|
|
78
|
+
```
|
|
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
|
|