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