Created install script and updated tasks to match

This commit is contained in:
Ulysse Cura 2025-10-05 15:56:58 +02:00
parent 8fe263901e
commit 5cf5b75be4
3 changed files with 50 additions and 2 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
.env
.env
launch.sh

2
.vscode/tasks.json vendored
View File

@ -4,7 +4,7 @@
{
"label": "Run Project",
"type": "shell",
"command": "source ${workspaceFolder}/.deltabotenv/bin/activate && ${workspaceFolder}/.deltabotenv/bin/python ${workspaceFolder}/src/main.py",
"command": "launch.sh",
"problemMatcher": [],
"group": {
"kind": "build",

47
install.sh Normal file → Executable file
View File

@ -1 +1,48 @@
#!/usr/bin/env bash
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
# Print commands
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Creating virtualenv
if ! python3 -m venv .deltabotenv; then
print_error "Python3 returnded a non-zero error code during virtualenv creation"
fi
# Activate python vitualenv to install librairies
source .deltabotenv/bin/activate
# Install librairies
if ! pip install discord.py; then
print_error "Pip returned a non-zero error code during installation of discord.py"
exit 1
fi
if ! pip install python-dotenv; then
print_error "Pip returned a non-zero error code during installation of python-dotenv"
exit 1
fi
# Quit python virtualenv
deactivate
# Create launch file
cat > launch.sh << 'EOF'
# Activate python vitualenv to install librairies
source .deltabotenv/bin/activate
# Launch bot
.deltabotenv/bin/python3 src/main.py
EOF
chmod +x launch.sh
echo -e "\nPython configuration created execute launch.sh to launch discord bot."