whatsapp-web.js 1.30.1-alpha.1 → 1.30.1-alpha.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whatsapp-web.js",
3
- "version": "1.30.1-alpha.1",
3
+ "version": "1.30.1-alpha.2",
4
4
  "description": "Library for interacting with the WhatsApp Web API ",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
@@ -843,19 +843,19 @@ exports.LoadUtils = () => {
843
843
  });
844
844
  };
845
845
 
846
- window.WWebJS.setPicture = async (chatid, media) => {
846
+ window.WWebJS.setPicture = async (chatId, media) => {
847
847
  const thumbnail = await window.WWebJS.cropAndResizeImage(media, { asDataUrl: true, mimetype: 'image/jpeg', size: 96 });
848
848
  const profilePic = await window.WWebJS.cropAndResizeImage(media, { asDataUrl: true, mimetype: 'image/jpeg', size: 640 });
849
849
 
850
- const chatWid = window.Store.WidFactory.createWid(chatid);
850
+ const chatWid = window.Store.WidFactory.createWid(chatId);
851
851
  try {
852
- const collection = window.Store.ProfilePicThumb.get(chatid);
853
- if (!collection.canSet()) return;
852
+ const collection = window.Store.ProfilePicThumb.get(chatId) || await window.Store.ProfilePicThumb.find(chatId);
853
+ if (!collection?.canSet()) return false;
854
854
 
855
855
  const res = await window.Store.GroupUtils.sendSetPicture(chatWid, thumbnail, profilePic);
856
856
  return res ? res.status === 200 : false;
857
857
  } catch (err) {
858
- if(err.name === 'ServerStatusCodeError') return false;
858
+ if (err.name === 'ServerStatusCodeError') return false;
859
859
  throw err;
860
860
  }
861
861
  };