From 5fb3f5798fc99797528668f2fdc3fa811bdf700f Mon Sep 17 00:00:00 2001 From: godot Date: Mon, 28 Oct 2024 20:35:28 +0100 Subject: [PATCH] backing up mainbank --- disbot.py | 6 ++++-- script.sh | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/disbot.py b/disbot.py index 29bbf58..875722a 100644 --- a/disbot.py +++ b/disbot.py @@ -4,6 +4,8 @@ from discord.ext import commands import json import os +import datetime +import shutil os.chdir("/opt/disbot") @@ -11,12 +13,12 @@ intents = discord.Intents.default() intents.message_content = True bot = commands.Bot(command_prefix='$', intents=intents) - - +date = datetime.datetime.now() @bot.event # Start succes indicator async def on_ready(): + shutil.copy("./mainbank.json", f"backup/{date.year}-{date.month}-{date.day-1}.json") print(f'We have logged in as {bot.user}') diff --git a/script.sh b/script.sh index 0fff931..e0e20ff 100755 --- a/script.sh +++ b/script.sh @@ -23,6 +23,7 @@ pip install -r req.txt deactivate mv mainbank.json disbot.py /opt/disbot/ +mkdir /opt/disbot/backup/ chown -R disbot:disbot /opt/disbot/