Update main.py
Browse files
main.py
CHANGED
@@ -140,17 +140,18 @@ async def get_user_story(link: str = None):
|
|
140 |
)
|
141 |
caption = story.caption or f"By {user_client.me.mention}"
|
142 |
if file_id:
|
143 |
-
|
144 |
|
145 |
-
|
146 |
-
|
147 |
# url_dl = await upload_to_catbox(image_path)
|
148 |
return {
|
149 |
-
"download":
|
150 |
"random_file_id": file_id,
|
151 |
"caption": caption
|
152 |
}
|
153 |
return {
|
|
|
154 |
"random_file_id": None,
|
155 |
"caption": None
|
156 |
}
|
|
|
140 |
)
|
141 |
caption = story.caption or f"By {user_client.me.mention}"
|
142 |
if file_id:
|
143 |
+
image_path = await user_client.download_media(file_id)
|
144 |
|
145 |
+
with open(image_path, "rb") as f:
|
146 |
+
base64_image = base64.b64encode(f.read()).decode("utf-8")
|
147 |
# url_dl = await upload_to_catbox(image_path)
|
148 |
return {
|
149 |
+
"download": base64_image,
|
150 |
"random_file_id": file_id,
|
151 |
"caption": caption
|
152 |
}
|
153 |
return {
|
154 |
+
"download": None,
|
155 |
"random_file_id": None,
|
156 |
"caption": None
|
157 |
}
|