From b844614be7dd09a9d2370ef63ea3a3582062f835 Mon Sep 17 00:00:00 2001
From: salixor <salixor@pm.me>
Date: Thu, 26 Dec 2024 20:37:44 +0100
Subject: [PATCH] Try an additional change

---
 src/matrixeventprocessor.ts | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/matrixeventprocessor.ts b/src/matrixeventprocessor.ts
index a17c99c..455910c 100644
--- a/src/matrixeventprocessor.ts
+++ b/src/matrixeventprocessor.ts
@@ -524,22 +524,23 @@ export class MatrixEventProcessor {
         }
 
         if (profile?.avatar_url) {
-            avatarUrl = await this.bridge.botClient.mxcToHttpThumbnail(
-                profile.avatar_url,
-                32,
-                32,
-                "scale",
-            );
-            log.info(avatarUrl);
-            avatarUrl = avatarUrl.replace(this.bridge.botClient.homeserverUrl, "");
-            log.info(avatarUrl);
-            log.info(this.bridge.botClient.accessToken);
-            // eslint-disable-next-line @typescript-eslint/naming-convention
-            const res = await this.bridge.botClient.doRequest("GET", avatarUrl, { allow_remote: true }, null, undefined, true, undefined, true);
+            // avatarUrl = await this.bridge.botClient.mxcToHttpThumbnail(
+            //     profile.avatar_url,
+            //     32,
+            //     32,
+            //     "scale",
+            // );
+            // log.info(avatarUrl);
+            // avatarUrl = avatarUrl.replace(this.bridge.botClient.homeserverUrl, "");
+            // log.info(avatarUrl);
+            // log.info(this.bridge.botClient.accessToken);
+            // // eslint-disable-next-line @typescript-eslint/naming-convention
+            // const res = await this.bridge.botClient.doRequest("GET", avatarUrl, { allow_remote: true }, null, undefined, true, undefined, true);
+            const res = await this.bridge.botClient.downloadContent(profile.avatar_url, true);
             log.info(res)
-            log.info(res.body)
-            const contentType = res.headers["content-type"];
-            const data = res.body;
+            log.info(res.data)
+            const contentType = res.contentType;
+            const data = res.data;
             const base64 = `data:${contentType};base64,${data.toString('base64')}`;
             avatarUrl = base64;
         }
-- 
GitLab