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 datetime import datetime
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
from pathlib import Path
|
||||||
import discord
|
import discord
|
||||||
import openai
|
import openai
|
||||||
import requests
|
import requests
|
||||||
@@ -356,9 +356,13 @@ class Events(commands.Cog):
|
|||||||
self.logger.debug("Wynikowy obrazek pod url: %s", image_url)
|
self.logger.debug("Wynikowy obrazek pod url: %s", image_url)
|
||||||
response = requests.get(image_url, timeout=360)
|
response = requests.get(image_url, timeout=360)
|
||||||
|
|
||||||
|
|
||||||
temp_file_name = message.content + ".png"
|
temp_file_name = message.content + ".png"
|
||||||
temp_file_name = GRAPHICS_PATH + 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:
|
with open(temp_file_name, "wb") as dalle_file:
|
||||||
dalle_file.write(response.content)
|
dalle_file.write(response.content)
|
||||||
self.logger.info("Koniec procedury obrazkowej.")
|
self.logger.info("Koniec procedury obrazkowej.")
|
||||||
|
|||||||
Reference in New Issue
Block a user