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:
|
volumes:
|
||||||
- .:/code
|
- .:/code
|
||||||
entrypoint: ./code/docker-entrypoint.sh
|
entrypoint: ./code/docker-entrypoint.sh
|
||||||
|
command: init_database
|
||||||
|
|
|
@ -4,5 +4,5 @@ echo "Installing requirements..."
|
||||||
pip install -r /code/requirements.txt
|
pip install -r /code/requirements.txt
|
||||||
|
|
||||||
echo "Starting discord bot..."
|
echo "Starting discord bot..."
|
||||||
python -u /code/src/main.py
|
python -u /code/src/main.py $1
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import interactions
|
import interactions
|
||||||
import database
|
import database
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from steamid import SteamID
|
from steamid import SteamID
|
||||||
|
|
||||||
def main():
|
def main(args):
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
token = os.getenv('DISCORD_TOKEN')
|
token = os.getenv('DISCORD_TOKEN')
|
||||||
host = os.getenv('MYSQL_HOST')
|
host = os.getenv('MYSQL_HOST')
|
||||||
|
@ -16,6 +17,7 @@ def main():
|
||||||
bot = interactions.Client(token=token)
|
bot = interactions.Client(token=token)
|
||||||
|
|
||||||
mysql = database.create_connection(host, user, password, db)
|
mysql = database.create_connection(host, user, password, db)
|
||||||
|
if args[0] == "init_database":
|
||||||
database.init_test_database(mysql)
|
database.init_test_database(mysql)
|
||||||
|
|
||||||
@bot.command(
|
@bot.command(
|
||||||
|
@ -59,4 +61,4 @@ def main():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main(sys.argv[1:])
|
||||||
|
|
Loading…
Reference in a new issue