@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.
@@ -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
- let stickerInput
21
+ if (!fs.existsSync('./tmp')) { fs.mkdirSync('./tmp', { recursive: true }) }
22
+
23
+ let stickerPath
22
24
 
23
25
  if (Buffer.isBuffer(options.sticker)) {
24
- stickerInput = options.sticker
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
- stickerInput = fs.readFileSync(options.sticker)
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(stickerInput, {
34
- pack: options.packname || global.packname || '',
35
- author: options.author || global.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
- return await sock.sendMessage(jid, { sticker: buffer })
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuu-reinzz/baileys",
3
- "version": "2.0.3-beta.1",
3
+ "version": "2.0.3",
4
4
  "description": "Baileys is a lightweight JavaScript library for interacting with the WhatsApp Web API using WebSocket.",
5
5
  "keywords": [
6
6
  "facebook",