cleaned up sparky folders
should have fixed generate blog in phixxycom
This commit is contained in:
parent
7b5f7f630b
commit
5dd6018f41
2 changed files with 16 additions and 19 deletions
|
|
@ -207,7 +207,6 @@ class PhixxyCom(commands.Cog):
|
|||
current_struct_time = time.localtime(current_time)
|
||||
date = time.strftime("%B %d, %Y", current_struct_time)
|
||||
if date in html_data:
|
||||
print("I already wrote a blog post today!")
|
||||
return
|
||||
blogpost_file = f"{self.data_dir}blog_topics.txt"
|
||||
if os.path.isfile(blogpost_file):
|
||||
|
|
@ -254,7 +253,7 @@ class PhixxyCom(commands.Cog):
|
|||
run_time = time.time() - start_time
|
||||
print("It took " + str(run_time) + " seconds to generate the blog post!")
|
||||
output = "Blog Updated! (" + str(run_time) + " seconds) https://ai.phixxy.com/ai-blog"
|
||||
print(output)
|
||||
return output
|
||||
|
||||
@commands.command(
|
||||
description="Website",
|
||||
|
|
@ -296,20 +295,20 @@ class PhixxyCom(commands.Cog):
|
|||
#await ctx.send("Failed, Try again.")
|
||||
print(error)
|
||||
|
||||
@tasks.loop(seconds=1)
|
||||
@tasks.loop(seconds=60)
|
||||
async def phixxy_loop(self):
|
||||
current_time = time.localtime()
|
||||
#Run every minute
|
||||
if current_time.tm_sec == 0:
|
||||
await self.meme_handler('tmp/meme/')
|
||||
await self.upload_ftp_ai_images('tmp/stable_diffusion/sfw/')
|
||||
if current_time.tm_hour == 17 and current_time.tm_min == 0 and current_time.tm_sec == 0:
|
||||
await self.meme_handler('tmp/meme/')
|
||||
await self.upload_ftp_ai_images('tmp/stable_diffusion/sfw/')
|
||||
|
||||
@tasks.loop(hours=1)
|
||||
async def blog_loop(self):
|
||||
try:
|
||||
message = await self.generate_blog()
|
||||
bot_stuff_channel = self.bot.get_channel(544408659174883328)
|
||||
await bot_stuff_channel.send("Running Daily Tasks")
|
||||
try:
|
||||
await self.generate_blog()
|
||||
except Exception as error:
|
||||
print("Failed to generate blog")
|
||||
await bot_stuff_channel.send(message)
|
||||
except Exception as error:
|
||||
print("Failed to generate blog")
|
||||
|
||||
@commands.command(
|
||||
description="Moderate",
|
||||
|
|
|
|||
|
|
@ -33,16 +33,15 @@ bot = commands.Bot(command_prefix='!', intents=intents)
|
|||
|
||||
|
||||
async def folder_setup():
|
||||
# Only tmp, extensions and data are supported, all other folders only exist for backwards compatibility and will be removed soon!
|
||||
folder_names = ["tmp", "extensions", "data", "channels","channels/config", "channels/logs"]
|
||||
folder_names = ["tmp", "extensions", "data"]
|
||||
for folder_name in folder_names:
|
||||
if not os.path.exists(folder_name):
|
||||
os.mkdir(folder_name)
|
||||
return folder_names
|
||||
|
||||
async def delete_all_files(path, safe_folders=None):
|
||||
async def delete_all_files(path):
|
||||
for filename in os.listdir(path):
|
||||
if os.path.isdir(path+filename) and not path+filename in safe_folders:
|
||||
if os.path.isdir(path+filename):
|
||||
shutil.rmtree(path+filename)
|
||||
elif os.path.isfile(path+filename):
|
||||
os.remove(path+filename)
|
||||
|
|
@ -78,8 +77,7 @@ async def on_disconnect():
|
|||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
folders_made = await folder_setup()
|
||||
await delete_all_files("tmp/", folders_made)
|
||||
await delete_all_files("tmp/")
|
||||
# Import plugins from extensions folder
|
||||
for plugin_file in os.listdir('extensions/'):
|
||||
if plugin_file[0] != '_' and plugin_file[-3:] == '.py':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue