20 lines
476 B
Bash
Executable File
20 lines
476 B
Bash
Executable File
#! /usr/bin/env bash
|
|
|
|
# Get the runtime path of the bot
|
|
ABS_PATH="$(readlink -f "$0")"
|
|
RUN_DIR="$(dirname "$ABS_PATH")"
|
|
|
|
# Relative paths to the virtual environment and main.py
|
|
VENV='./venv/bin/activate'
|
|
ENTRY='./src/main.py'
|
|
|
|
# cd into the bot's root path, set up the virtual environment, and run
|
|
cd "$RUN_DIR"
|
|
[ ! -f "$VENV" ] && echo "Virtual environment not found: ${VENV}" && cd - > /dev/null && exit 1
|
|
source "$VENV"
|
|
"$ENTRY" "$@"
|
|
|
|
# Cleanup
|
|
deactivate
|
|
cd - > /dev/null
|