added try:except: to upload_ftp_ai_images
This commit is contained in:
parent
e2e42e8139
commit
c0946d1e14
1 changed files with 28 additions and 25 deletions
|
|
@ -151,6 +151,7 @@ class PhixxyCom(commands.Cog):
|
||||||
os.rename(filename, 'tmp/' + new_file_name)
|
os.rename(filename, 'tmp/' + new_file_name)
|
||||||
|
|
||||||
async def upload_ftp_ai_images(self, ai_dict):
|
async def upload_ftp_ai_images(self, ai_dict):
|
||||||
|
try:
|
||||||
for folder in ai_dict:
|
for folder in ai_dict:
|
||||||
for filename in os.listdir(folder):
|
for filename in os.listdir(folder):
|
||||||
if filename[-4:] == '.png':
|
if filename[-4:] == '.png':
|
||||||
|
|
@ -175,6 +176,8 @@ class PhixxyCom(commands.Cog):
|
||||||
f.writelines(html_data)
|
f.writelines(html_data)
|
||||||
await self.upload_sftp(html_file, server_folder, "index.html")
|
await self.upload_sftp(html_file, server_folder, "index.html")
|
||||||
os.rename(filepath, f"tmp/{new_filename}")
|
os.rename(filepath, f"tmp/{new_filename}")
|
||||||
|
except:
|
||||||
|
self.bot.logger.exception("Something went wrong in upload_ftp_ai_images")
|
||||||
|
|
||||||
async def answer_question(self, topic, model="gpt-3.5-turbo"):
|
async def answer_question(self, topic, model="gpt-3.5-turbo"):
|
||||||
headers = {
|
headers = {
|
||||||
|
|
@ -326,7 +329,7 @@ class PhixxyCom(commands.Cog):
|
||||||
"data/chatgpt/dalle2/":"data/chatgpt/logs/dalle2.log"
|
"data/chatgpt/dalle2/":"data/chatgpt/logs/dalle2.log"
|
||||||
}
|
}
|
||||||
await self.meme_handler('tmp/meme/')
|
await self.meme_handler('tmp/meme/')
|
||||||
await self.upload_ftp_ai_images('tmp/stable_diffusion/sfw/')
|
await self.upload_ftp_ai_images(ai_images_dict)
|
||||||
|
|
||||||
@tasks.loop(hours=1)
|
@tasks.loop(hours=1)
|
||||||
async def blog_loop(self):
|
async def blog_loop(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue