From f267ba214fe22fc8a463ff85741ae39756a64491 Mon Sep 17 00:00:00 2001 From: insert-usernamehere Date: Mon, 25 Jan 2021 16:59:04 -0500 Subject: [PATCH] add public redirect to things that need it --- database bot.py | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/database bot.py b/database bot.py index 23d5313..2b860a9 100644 --- a/database bot.py +++ b/database bot.py @@ -12,15 +12,40 @@ client = commands.Bot(command_prefix='.') @client.command() -async def save(ctx): +async def addcharacter(ctx): await ctx.message.attachments[0].save("newcharacter.zip") await ctx.send("adding to database please wait") zf = ZipFile('newcharacter.zip', 'r') - zf.extractall('a') - zf.extractall('b') + zf.extractall('public/singlecharacter') zf.close() - shutil.make_archive('a/test', 'zip', 'a') + if os.path.exists("newcharacter.zip"): + os.remove("newcharacter.zip") + else: + pass + if os.path.exists("public/characters.zip"): + os.remove("public/characters.zip") + else: + pass + shutil.make_archive('public/characters', 'zip', 'public/singlecharacter') + await ctx.send("added to database") + +async def addsound(ctx): + await ctx.message.attachments[0].save("newsound.zip") + + await ctx.send("adding to database please wait") + zf = ZipFile('newsound.zip', 'r') + zf.extractall('public/singlesound') + zf.close() + if os.path.exists("newsound.zip"): + os.remove("newsound.zip") + else: + pass + if os.path.exists("public/sounds.zip"): + os.remove("public/sounds.zip") + else: + pass + shutil.make_archive('public/sounds', 'zip', 'public/singlesound') await ctx.send("added to database") client.run('botid')