From f63ab33cd87c0204da557a8b416505205a8b854f Mon Sep 17 00:00:00 2001 From: justme_herza <157363409+herzonly@users.noreply.github.com> Date: Sat, 31 Jan 2026 08:52:16 +0800 Subject: [PATCH] Update simple.js --- lib/simple.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/simple.js b/lib/simple.js index fbfa4a4..5e99ffa 100644 --- a/lib/simple.js +++ b/lib/simple.js @@ -307,6 +307,27 @@ function initializeHelper(bot) { } }; + bot.profilePictureUrl = async function(userId) { + try { + const photos = await this.telegram.getUserProfilePhotos(userId, 0, 1); + + if (!photos || !photos.photos || photos.photos.length === 0) { + return null; + } + + const photo = photos.photos[0]; + const fileId = photo[photo.length - 1].file_id; + const file = await this.telegram.getFile(fileId); + const fileUrl = `https://api.telegram.org/file/bot${this.telegram.token}/${file.file_path}`; + const response = await axios.get(fileUrl, { responseType: 'arraybuffer' }); + + return Buffer.from(response.data); + } catch (error) { + return null; + } +}; + + bot.sendDocument = async function(chatId, document, options = {}) { try { let docBuffer;