add init_database arg

This commit is contained in:
Philipp 2022-09-24 22:34:00 +02:00
parent 4153aeef8f
commit c09b1e4a30
Signed by: Philipp
GPG key ID: 9EBD8439AFBAB750
3 changed files with 7 additions and 4 deletions

View file

@ -16,3 +16,4 @@ services:
volumes:
- .:/code
entrypoint: ./code/docker-entrypoint.sh
command: init_database

View file

@ -4,5 +4,5 @@ echo "Installing requirements..."
pip install -r /code/requirements.txt
echo "Starting discord bot..."
python -u /code/src/main.py
python -u /code/src/main.py $1

View file

@ -1,11 +1,12 @@
import os
import sys
import interactions
import database
from dotenv import load_dotenv
from steamid import SteamID
def main():
def main(args):
load_dotenv()
token = os.getenv('DISCORD_TOKEN')
host = os.getenv('MYSQL_HOST')
@ -16,6 +17,7 @@ def main():
bot = interactions.Client(token=token)
mysql = database.create_connection(host, user, password, db)
if args[0] == "init_database":
database.init_test_database(mysql)
@bot.command(
@ -59,4 +61,4 @@ def main():
if __name__ == '__main__':
main()
main(sys.argv[1:])