mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
saving repeatable promtp
This commit is contained in:
+6
-2
@@ -5,7 +5,7 @@ import sys
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
from pathlib import Path
|
||||
import discord
|
||||
import openai
|
||||
import requests
|
||||
@@ -356,9 +356,13 @@ class Events(commands.Cog):
|
||||
self.logger.debug("Wynikowy obrazek pod url: %s", image_url)
|
||||
response = requests.get(image_url, timeout=360)
|
||||
|
||||
|
||||
temp_file_name = message.content + ".png"
|
||||
temp_file_name = GRAPHICS_PATH + message.content + ".png"
|
||||
|
||||
num = 0
|
||||
while (Path(temp_file_name)).exists():
|
||||
temp_file_name = GRAPHICS_PATH + message.content + str(num) + ".png"
|
||||
num += 1
|
||||
with open(temp_file_name, "wb") as dalle_file:
|
||||
dalle_file.write(response.content)
|
||||
self.logger.info("Koniec procedury obrazkowej.")
|
||||
|
||||
Reference in New Issue
Block a user