From ad48552196ae821da523cc19ecc4727e53c428ee Mon Sep 17 00:00:00 2001 From: Guzzy Date: Wed, 15 Nov 2023 06:05:31 +0000 Subject: [PATCH] Upload files to "/" --- update_marseys.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 update_marseys.py diff --git a/update_marseys.py b/update_marseys.py new file mode 100644 index 0000000..8cef450 --- /dev/null +++ b/update_marseys.py @@ -0,0 +1,28 @@ +import os, shutil +import requests, zipfile, io +import time, schedule + +#directory for marsey folder +bot_dir = os.path.dirname(__file__) +old_folder_dir = os.path.join(bot_dir, 'emojis') +new_folder_dir = os.path.join(bot_dir, 'emojis2') + +#url for zip file +zip_url = 'https://rdrama.net/assets/emojis.zip' + +# function to update marseys +def get_new_marseys(): + r = requests.get(zip_url) + z = zipfile.ZipFile(io.BytesIO(r.content)) + z.extractall(new_folder_dir) + shutil.rmtree(old_folder_dir) + os.rename(new_folder_dir, old_folder_dir) + print('updated successfully') + return + +#updates everyday at 7 am +schedule.every().day.at("07:00").do(get_new_marseys) + +while True: + schedule.run_pending() + time.sleep(1) # wait one minute