@ryuu-reinzz/haruka-lib 1.2.18 → 1.2.19
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/main/socket.js +0 -62
- package/package.json +1 -1
package/main/socket.js
CHANGED
|
@@ -14,68 +14,6 @@ const __dirname = dirname(__filename);
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
export default function addProperty(socket, store, smsg, baileys) {
|
|
17
|
-
const tutor = `
|
|
18
|
-
Welcome to @ryuu-reinzz/haruka-lib
|
|
19
|
-
Small helper for WhatsApp Baileys
|
|
20
|
-
|
|
21
|
-
Usage:
|
|
22
|
-
haruka.extendSocketBot(socket, store, smsg, baileys)
|
|
23
|
-
→ extend socket with helper methods
|
|
24
|
-
|
|
25
|
-
haruka.useSQLiteAuthState()
|
|
26
|
-
→ SQLite-based auth state for your bot
|
|
27
|
-
|
|
28
|
-
Examples:
|
|
29
|
-
Add socket:
|
|
30
|
-
import makeWASocket, {
|
|
31
|
-
proto,
|
|
32
|
-
generateWAMessageFromContent,
|
|
33
|
-
jidDecode,
|
|
34
|
-
downloadContentFromMessage,
|
|
35
|
-
prepareWAMessageMedia,
|
|
36
|
-
generateMessageID
|
|
37
|
-
} from "baileys";
|
|
38
|
-
const conn = makeWASocket({});
|
|
39
|
-
const baileys = {
|
|
40
|
-
proto,
|
|
41
|
-
generateWAMessageFromContent,
|
|
42
|
-
jidDecode,
|
|
43
|
-
downloadContentFromMessage,
|
|
44
|
-
prepareWAMessageMedia,
|
|
45
|
-
generateMessageID
|
|
46
|
-
}
|
|
47
|
-
import haruka from "@ryuu-reinzz/haruka-lib";
|
|
48
|
-
haruka.addProperty(conn, store, smsg, baileys);
|
|
49
|
-
|
|
50
|
-
SQLite session:
|
|
51
|
-
const sessionPath = "./session"
|
|
52
|
-
if (!fs.existsSync(sessionPath)) fs.mkdirSync(sessionPath, { recursive: true });
|
|
53
|
-
const useSQLiteAuthState = haruka.useSQLiteAuthState;
|
|
54
|
-
const { state, saveCreds } = await useSQLiteAuthState(sessionPath + \"auth.db\");
|
|
55
|
-
|
|
56
|
-
> Made by Ryuu`;
|
|
57
|
-
socket.sendMessage(
|
|
58
|
-
socket.user.id,
|
|
59
|
-
{
|
|
60
|
-
text: tutor,
|
|
61
|
-
contextInfo: {
|
|
62
|
-
forwardingScore: 99,
|
|
63
|
-
isForwarded: true,
|
|
64
|
-
forwardedNewsletterMessageInfo: {
|
|
65
|
-
newsletterName: "𝙍͢𝙮𝙪𝙪 𝙍͢𝙚𝙞𝙣𝙯𝙯",
|
|
66
|
-
newsletterJid: "120363419382206255@newsletter"
|
|
67
|
-
},
|
|
68
|
-
externalAdReply: {
|
|
69
|
-
title: "Haruka Tutorial",
|
|
70
|
-
body: "How to use",
|
|
71
|
-
thumbnailUrl: "https://api.ryuu-dev.offc.my.id/src/assest/bot/Haruka.jpg",
|
|
72
|
-
sourceUrl: `https://whatsapp.com/channel/0029Vb49CCWJ93wO2dLDqx14`,
|
|
73
|
-
mediaType: 1,
|
|
74
|
-
renderLargerThumbnail: true,
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
17
|
const {
|
|
80
18
|
proto,
|
|
81
19
|
generateWAMessageFromContent,
|