@ryuu-reinzz/haruka-lib 1.2.18 → 1.2.20

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 (2) hide show
  1. package/main/socket.js +7 -63
  2. 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,
@@ -335,6 +273,12 @@ Object.assign(socket, {
335
273
  mediaInput.document = { url: document };
336
274
  }
337
275
 
276
+ if (fileName) {
277
+ if (typeof mediaInput.document === "object") {
278
+ mediaInput.document.fileName = fileName;
279
+ }
280
+ }
281
+
338
282
  if (mimetype) {
339
283
  if (typeof mediaInput.document === "object") {
340
284
  mediaInput.document.mimetype = mimetype;
@@ -453,7 +397,7 @@ Object.assign(socket, {
453
397
  mediaType: externalAdReply.mediaType || 1,
454
398
  sourceUrl: externalAdReply.sourceUrl || externalAdReply.url || "",
455
399
  thumbnailUrl:
456
- externalAdReply.thumbnailUrl || externalAdReply.thumbnail || "",
400
+ externalAdReply.thumbnailUrl || "",
457
401
  renderLargerThumbnail: externalAdReply.renderLargerThumbnail || false,
458
402
  showAdAttribution: externalAdReply.showAdAttribution !== false,
459
403
  containsAutoReply: externalAdReply.containsAutoReply || false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuu-reinzz/haruka-lib",
3
- "version": "1.2.18",
3
+ "version": "1.2.20",
4
4
  "description": "Library extra for bot WhatsApp",
5
5
  "main": "main/index.js",
6
6
  "type": "module",