backing up mainbank

This commit is contained in:
godot 2024-10-28 20:35:28 +01:00
parent 5383bbfd4d
commit 5fb3f5798f
2 changed files with 5 additions and 2 deletions

View File

@ -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}')

View File

@ -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/