diff --git a/sparkytron3000.py b/sparkytron3000.py
index 04a8df6..f4482af 100644
--- a/sparkytron3000.py
+++ b/sparkytron3000.py
@@ -21,6 +21,7 @@ from ftplib import FTP
import threading
import matplotlib.pyplot as plt
import aiohttp
+import aioftp
#config
STABLE_DIFFUSION_URL = "http://127.0.0.1:7861"
@@ -728,24 +729,6 @@ async def question_gpt4(ctx):
for chunk in chunks:
await ctx.send(chunk)
-
-@bot.command()
-async def save_website(ctx):
- try:
- folder_name = ctx.message.content.split(" ", maxsplit=1)[1]
- try:
- os.makedirs("websites/" + folder_name)
- except FileExistsError:
- await ctx.send(folder_name + " already exists. Choose a new name.")
- return 0
- for filename in os.listdir("webpage/"):
- if ".png" in filename or ".html" in filename:
- shutil.copyfile("webpage/" + filename, "websites/"+folder_name+"/"+filename)
- await ctx.send("Website Archived!")
- except Exception as error:
- print(error)
- await ctx.send("Usage !save_website (filename)")
-
@bot.command()
async def highscores(ctx, limit=0):
filename = str(ctx.channel.id) + ".log"
@@ -881,15 +864,16 @@ async def website(ctx):
os.remove(local_folder + filename)
async def delete_ftp_pngs(server_folder):
- with FTP(ftp_server) as ftp:
- ftp.login(ftp_username, ftp_password)
- ftp.cwd(server_folder)
- file_list = ftp.nlst()
- for filename in file_list:
- if ".png" in filename:
- print("Deleting", filename)
- ftp.delete(filename)
-
+ client = aioftp.Client()
+ await client.connect(ftp_server)
+ await client.login(ftp_username, ftp_password)
+ await client.change_directory(server_folder)
+ for path, info in (await client.list()):
+ if ".png" in path.name:
+ print("Deleting", path.name)
+ await client.remove(path.name)
+ await client.quit()
+
async def extract_image_tags(code):
count = code.count("
-
-
-
This is a list of saved websites that AI generated.
-