Repository navigation
Expand file tree
/
Copy pathbot
More file actions
executable file
·69 lines (54 loc) · 2.45 KB
/
Copy pathbot
File metadata and controls
executable file
·69 lines (54 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
if [[ "$1" =~ python.* ]]
then
PYTHON_COMMAND=$1
else
PYTHON_COMMAND=python3
fi
echo Loading...
DIR=$(cd "$(dirname "$0")"; pwd)
cd $DIR
if command -v $PYTHON_COMMAND &> /dev/null
then
# Retrieve the version number
VERSION=$($PYTHON_COMMAND -c 'import platform; print(platform.python_version())')
IFS='.' read -ra VERSION_ARRAY <<< "$VERSION" # Split the version number into its components
MAJOR=${VERSION_ARRAY[0]}
MINOR=${VERSION_ARRAY[1]}
PATCH=${VERSION_ARRAY[2]}
if [ "$MAJOR" -lt 3 ] || ([ "$MAJOR" -eq 3 ] && [ "$MINOR" -lt 12 ]); then
echo "You cannot run this script. Python version is too old. (Python 3.12 and above, you have $VERSION) You can download Python 3.12 at https://python.org"
exit 1
else
. "$DIR/bin/activate" &> /dev/null
IN_VE=$(python3 -c 'import sys; print(sys.prefix != sys.base_prefix)')
if [ ! "$IN_VE" = "True" ]
then
echo Installing... You may need to enter your password, and take some time.
if [ "$OSTYPE" = "linux-gnu" ]
then
sudo apt install python3.12-venv
sudo apt-get -y install flac
fi
echo Creating enviroment. Please wait...
PYTHON_PATH=$(which $PYTHON_COMMAND)
$PYTHON_PATH -m venv $DIR && . "$DIR/bin/activate"
$PYTHON_COMMAND -m pip install -q --upgrade pip
$PYTHON_COMMAND -m pip install -q -r "$DIR/dependencies/requirements.txt"
$PYTHON_COMMAND "$DIR/sources/install/download_libs.py"
fi
if [ ! -e "$DIR/dependencies/api-keys.yaml" ]
then
echo 'I do not detect a "dependencies/api-keys.yaml" file.
You can enter the keys right now. Or leave both prompts blank and a blank key file will be made so you can fill it later.
If you have any other files to insert (Voice Libraries) do it now. If not, you can do it later.
If you want to exit press "CTRL + C" to do so.'
read -p 'Discord API Key (Most likely starting with "MT"): ' -r DISCORD_KEY
read -p 'OpenAI API Key (Starting with "sk-"): ' -r OPENAI_KEY
fi
echo Performing bot startup..
$PYTHON_COMMAND "$DIR/main.py" $DISCORD_KEY $OPENAI_KEY
fi
else
echo "Python is not installed on this system, or is configured improperly. (Given Python Version: $PYTHON_COMMAND)"
fi