@ryuu-reinzz/baileys 2.0.3-beta.1 → 2.0.3
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/lib/Socket/business.js +17 -7
- package/lib/Socket/tmp/tmp +0 -0
- package/package.json +1 -1
package/lib/Socket/business.js
CHANGED
|
@@ -18,32 +18,42 @@ sock.sendSticker = async (jid, options = {}) => {
|
|
|
18
18
|
if (!options.sticker)
|
|
19
19
|
throw new Error('Please enter the path or buffer of the sticker.')
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
if (!fs.existsSync('./tmp')) { fs.mkdirSync('./tmp', { recursive: true }) }
|
|
22
|
+
|
|
23
|
+
let stickerPath
|
|
22
24
|
|
|
23
25
|
if (Buffer.isBuffer(options.sticker)) {
|
|
24
|
-
|
|
26
|
+
const tmpPath = `./tmp/sticker_${Date.now()}.webp`
|
|
27
|
+
fs.writeFileSync(tmpPath, options.sticker)
|
|
28
|
+
stickerPath = tmpPath
|
|
25
29
|
} else if (typeof options.sticker === 'string') {
|
|
26
30
|
if (!fs.existsSync(options.sticker))
|
|
27
31
|
throw new Error(`File not found: ${options.sticker}`)
|
|
28
|
-
|
|
32
|
+
stickerPath = options.sticker
|
|
29
33
|
} else {
|
|
30
34
|
throw new Error('Sticker format not recognized (must be buffer or file path).')
|
|
31
35
|
}
|
|
32
36
|
|
|
33
|
-
const sticker = new Sticker(
|
|
34
|
-
pack: options.packname ||
|
|
35
|
-
author: options.author ||
|
|
37
|
+
const sticker = new Sticker(stickerPath, {
|
|
38
|
+
pack: options.packname || "Made By",
|
|
39
|
+
author: options.author || "© 𝙍͢𝙮𝙪𝙪 𝙍͢𝙚𝙞𝙣𝙯𝙯",
|
|
36
40
|
type: options.type || 'full',
|
|
37
41
|
categories: options.categories || ['🗿'],
|
|
38
42
|
quality: options.quality || 80
|
|
39
43
|
})
|
|
40
44
|
|
|
41
45
|
const buffer = await sticker.build()
|
|
42
|
-
|
|
46
|
+
const result = await sock.sendMessage(jid, { sticker: buffer })
|
|
47
|
+
|
|
48
|
+
if (Buffer.isBuffer(options.sticker)) { fs.unlinkSync(stickerPath)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return result
|
|
43
52
|
} catch (e) {
|
|
44
53
|
console.error('[sendSticker Error]', e)
|
|
45
54
|
}
|
|
46
55
|
}
|
|
56
|
+
|
|
47
57
|
const { authState, query, waUploadToServer } = sock
|
|
48
58
|
|
|
49
59
|
const updateBussinesProfile = async (args) => {
|
|
File without changes
|
package/package.json
CHANGED