add init_database arg
This commit is contained in:
parent
4153aeef8f
commit
c09b1e4a30
3 changed files with 7 additions and 4 deletions
|
@ -16,3 +16,4 @@ services:
|
|||
volumes:
|
||||
- .:/code
|
||||
entrypoint: ./code/docker-entrypoint.sh
|
||||
command: init_database
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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,7 +17,8 @@ def main():
|
|||
bot = interactions.Client(token=token)
|
||||
|
||||
mysql = database.create_connection(host, user, password, db)
|
||||
database.init_test_database(mysql)
|
||||
if args[0] == "init_database":
|
||||
database.init_test_database(mysql)
|
||||
|
||||
@bot.command(
|
||||
name="reserve_slot",
|
||||
|
@ -59,4 +61,4 @@ def main():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main(sys.argv[1:])
|
||||
|
|
Loading…
Reference in a new issue