From 32c4693ca0b886d7fe37fdbe6f1c88d5fa00770b Mon Sep 17 00:00:00 2001 From: DonutDeveloperKis Date: Fri, 22 Nov 2024 02:08:51 +0300 Subject: [PATCH] add method set avatar --- bot/bot.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bot/bot.py b/bot/bot.py index 59a7887..499c3ef 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -529,6 +529,20 @@ def set_chat_rules(self, chat_id, rules): timeout=self.timeout_s ) + def set_chats_avatar(self, chat_id, image): + request = Request( + method="GET", + url="{}/chats/avatar/set".format(self.api_base_url), + params={ + "token": self.token, + "chatId": chat_id + } + ) + if image: + request.method = "POST" + request.files = {"image": image} + return self.http_session.send(request.prepare(), timeout=self.timeout_s) + def get_file_info(self, file_id): return self.http_session.get( url="{}/files/getInfo".format(self.api_base_url),