Skip to content

Commit

Permalink
Use Virtual Environment
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Rios committed Aug 19, 2024
1 parent ec2792a commit 39a6be3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
**/.vscode/
**/__pycache__/
**/.venv/
**/data/

**/*.pyc
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ TOOLS="./tools"
help:
@ echo ""
@ echo "Usage:"
@ echo " setup: Setup Project"
@ echo " run: Launch the Bot"
@ echo " kill: Stop the Bot"
@ echo " status: Check if Bot is running"
@ echo " monitor: Check users captcha process"
@ echo " error: Check for errors in the Bot"
@ echo ""

setup:
@ chmod +x $(TOOLS)/setup
@ $(TOOLS)/setup

run:
@ chmod +x $(TOOLS)/run
@ $(TOOLS)/run
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ To generate Captchas, the Bot uses [multicolor_captcha_generator library](https:

```bash
sudo apt update
sudo apt install -y libtiff5-dev libjpeg62-turbo-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
sudo apt install -y make libtiff5-dev libjpeg62-turbo-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
```

2. Get the project and install JoinCaptchaBot requirements:
2. Get and setup the project:

```bash
git clone https://github.com/J-Rios/TLG_JoinCaptchaBot
cd TLG_JoinCaptchaBot
python3 -m pip install -r requirements.txt
make setup
```

3. Set Telegram Bot account Token (get it from @BotFather) in "src/settings.py" file:
Expand Down
2 changes: 2 additions & 0 deletions tools/run
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ rm -rf $DIR/../src/data/captchas/*

# Launch the Bot
echo "Starting Script..."
source $DIR/../.venv/bin/activate
nohup python3 -u $DIR/../src/join_captcha_bot.py >> $DIR/../output.log 2>&1 &
deactivate
sleep 1
$DIR/status

Expand Down
30 changes: 30 additions & 0 deletions tools/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

# Actual script directory path
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"

# Create Virtual Envorionment
cd $DIR/.. || exit 1
echo "Creating Virtual Environment..."
python3 -m venv .venv

# Activate Virtual Environment
echo "Accesing Virtual Environment..."
source .venv/bin/activate

# Install Project Requirements into environment
echo "Installing Requirements..."
echo ""
pip install -r requirements.txt
echo ""
echo "List of Modules Installed:"
echo ""
pip list
echo ""

# Exit Virtual Environment
deactivate
echo "Project setup completed"
echo ""

exit 0

0 comments on commit 39a6be3

Please sign in to comment.