This repository has been archived on 2024-03-09. You can view files and clone it, but cannot push or open issues or pull requests.
YandereLewdBot/run.sh
2022-07-14 12:32:18 -07:00

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