#!/bin/bash
#
# Discord Gameserver Notifier - Executable script
# This script calls the main function from the venv-installed package.
#

# Path to the virtual environment
VENV_PATH="/opt/discord-gameserver-notifier"
PYTHON_EXEC="$VENV_PATH/bin/python"

# Check if venv exists
if [ ! -f "$PYTHON_EXEC" ]; then
    echo "Error: Virtual environment not found at $VENV_PATH" >&2
    echo "Please ensure the package is properly installed." >&2
    exit 1
fi

# Check if the main module exists
if ! "$PYTHON_EXEC" -c "import discord_gameserver_notifier.main" >/dev/null 2>&1; then
    echo "Error: discord_gameserver_notifier module not found in venv" >&2
    echo "Please ensure the package is properly installed." >&2
    exit 1
fi

# Execute the main function
exec "$PYTHON_EXEC" -m discord_gameserver_notifier.main "$@" 