added folder setup

This commit is contained in:
phixxy 2023-07-09 01:57:35 -07:00
parent 723f41c5a4
commit 6d9b71374b

View file

@ -298,15 +298,18 @@ async def make_json_file(filename):
fileobj.write("{}") fileobj.write("{}")
fileobj.close() fileobj.close()
async def folder_setup():
folder_names = ["logs", "config", "webpage"]
for folder_name in folder_names:
if not os.path.exists(folder_name):
os.mkdir(folder_name)
@bot.event @bot.event
async def on_ready(): async def on_ready():
print('We have logged in as {0.user}'.format(bot)) print('We have logged in as {0.user}'.format(bot))
#stuff to do if first run #stuff to do if first run
await make_json_file("currency_db.json") await make_json_file("currency_db.json")
if not os.path.exists("logs/"): await folder_setup()
os.mkdir("logs")
if not os.path.exists("config/"):
os.mkdir("config")
@bot.command() @bot.command()
async def currency(ctx, arg1=None, arg2=None, arg3=None, arg4=None): async def currency(ctx, arg1=None, arg2=None, arg3=None, arg4=None):
@ -513,7 +516,7 @@ async def currency(ctx, arg1=None, arg2=None, arg3=None, arg4=None):
@bot.command() @bot.command()
async def meme(ctx): async def meme(ctx):
async def upload_ftp_ai_memes(filename): async def update_meme_webpage(filename):
output_file = "index.html" output_file = "index.html"
html = '''<!DOCTYPE html> html = '''<!DOCTYPE html>
<html> <html>
@ -646,7 +649,7 @@ async def meme(ctx):
channel_vars = await get_channel_config(ctx.channel.id) channel_vars = await get_channel_config(ctx.channel.id)
try: try:
if channel_vars["ftp_enabled"]: if channel_vars["ftp_enabled"]:
await upload_ftp_ai_memes(filepath) await update_meme_webpage(filepath)
except Exception as error: except Exception as error:
print("COULDN'T UPLOAD TO FTP!") print("COULDN'T UPLOAD TO FTP!")
await ctx.send(link) await ctx.send(link)