Skip to content

Installation

Chitranjan Gupta edited this page Jul 16, 2023 · 10 revisions

Windows

Setting up the windows environment to run the bot locally

  1. Install Git in your system from https://git-scm.com.
  2. Install python interpreter in your system from https://python.org.
  3. Clone this repository by running the command in your command prompt git clone https://github.com/chitranjan-gupta/Flipkart-Bot.
  4. Enter the Flipkart-Bot directory by running the command in your command prompt cd Flipkart-Bot.
  5. Create virtual environment by running the command in your command prompt python -m venv venv.
  6. Activate virtual environment by running the command in your command prompt venv\Scripts\activate.bat.
  7. Install the python libraries by running the command in your command prompt pip install -U -r requirements.txt.
  8. Add the token value in the environment variable of your system or Edit the BOT_TOKEN variable in the bot.py.

Steps to add the token value in the environment variable of your system:

  1. Search 'Environment variables'.
  2. Select the first choice 'Edit System Environment Variables for your account'.
  3. A popup box will open. Click on 'Environment Variables'.
  4. A window will open. In the Your Section 'Use variables for Your Name' not on system variable section. Click on New.
  5. A Dialog box will open. In the Variable Name Section type 'BOT_TOKEN'. And in the variable value section paste the token value which you have copied from Bot-Father
  6. Click on ok and ok and ok.

Steps to edit the BOT_TOKEN variable in the bot.py

  1. Open the bot.py python file inside any text editor
  2. Search for BOT_TOKEN
  3. Paste the token value which you have copied from the telegram right side of the BOT_TOKEN variable
  4. Save the bot.py file

Finally

Run the bot.py by running the command in command prompt python bot.py Now go and /start the bot in Telegram. If everything went fine, the bot will respond with welcome message.

Linux

Setting up the Linux environment to run the bot locally

  1. Install Git in your system by running the command in your terminal apt install git.
  2. Install python interpreter in your system by running the command in your terminal apt install python3.
  3. Clone this repository by running the command in your terminal git clone https://github.com/chitranjan-gupta/Flipkart-Bot.
  4. Enter the Flipkart-Bot directory by running the command in your terminal cd Flipkart-Bot.
  5. Create virtual environment by running the command in your terminal python3 -m venv venv.
  6. Activate virtual environment by running the command in your terminal source venv/bin/activate.
  7. Install the python libraries by running the command in your terminal pip3 install -U -r requirements.txt.
  8. Add the token value in the environment variable of your system or Edit the BOT_TOKEN variable in the bot.py.

Steps to add the token value in the environment variable of your system:

  1. Copy the token from the telegram.
  2. Set the environment variable by running the command in your terminal export BOT_TOKEN='your_token'. For example export BOT_TOKEN='5775884958:AAdhfhjjfjjhf'

Steps to edit the BOT_TOKEN variable in the bot.py

  1. Open the bot.py python file inside any text editor
  2. Search for BOT_TOKEN
  3. Paste the token value which you have copied from the telegram right side of the BOT_TOKEN variable
  4. Save the bot.py file

Finally

Run the bot.py by running the command in terminal python3 bot.py Now go and /start the bot in Telegram. If everything went fine, the bot will respond with welcome message.

Android

Setting up the Android environment to run the bot locally

  1. Install F-Droid Android Application in your system from https://f-droid.org.
  2. Update the repository of F-Droid Application in your system by pulling down inside F-Droid Application.
  3. Search Termux inside F-Droid Application.
  4. Install Termux (Terminal emulator with packages) Application (size of nearly 100 Mega Bytes).
  5. Allow The Installation of Apps from Unknown Source.
  6. Update the packages of Termux Application by running the command inside Termux Application pkg upgrade -y.
  7. Install required packages by running the command in your Termux terminal pkg install python3 git libxml2 libxslt -y.
  8. Clone this repository by running the command in your Termux terminal git clone https://github.com/chitranjan-gupta/Flipkart-Bot.
  9. Enter the Flipkart-Bot directory by running the command in your Termux terminal cd Flipkart-Bot.
  10. Create virtual environment by running the command in your Termux terminal python3 -m venv venv.
  11. Activate virtual environment by running the command in your Termux terminal source venv/bin/activate.
  12. Install the python library wheel by running the command in your Termux terminal pip3 install -U wheel.
  13. Install the python libraries by running the command in your Termux terminal pip3 install -U -r requirements.txt.
  14. Add the token value in the environment variable of your system or Edit the BOT_TOKEN variable in the bot.py.

Steps to add the token value in the environment variable of your system:

  1. Copy the token from the telegram.
  2. Set the environment variable by running the command in your terminal export BOT_TOKEN='your_token'. For example export token='5775884958:AAdhfhjjfjjhf'

Steps to edit the BOT_TOKEN variable in the bot.py

  1. Open the bot.py python file inside any text editor
  2. Search for BOT_TOKEN
  3. Paste the token value which you have copied from the telegram right side of the BOT_TOKEN variable
  4. Save the bot.py file

Finally

Run the bot.py by running the command in terminal python3 bot.py Now go and /start the bot in Telegram. If everything went fine, the bot will respond with welcome message.