Skip to content

Preparations Source Code

Marcel edited this page Feb 3, 2020 · 1 revision

Python

To run the source code version of the bot a python 3 installation is requiered. Many Linux distributions already have python 3 preinstalled. To install python 3 on a Ubuntu Server distribution you can follow the following steps:

  • Open a terminal window (only if you are using a graphical user interface)
  • Install the Ubuntu software properties by entering
    sudo apt update
    and
    sudo apt install software-properties-common
  • Add the PPA repository with
    sudo add-apt-repository ppa:deadsnakes/ppa
  • Finally install python 3 with the two commands
    sudo apt update
    and
    sudo apt install python3.7

If there was already a Python 3.6 version installed use this tutorial to upgrade to Python 3.7.

Python 3 installation packages for Windows or MacOs can be downloaded on the official site.

On Windows: Be sure to check the "Add Python 3.X to PATH" Checkbox

Package-management-system

For the next step the package-management-system of python, called pip, is required. On Windows pip will be installed with the Python 3 installer. On Linux and MacOS pip must be installed manually.

Install pip on Linux

On Linux (Ubuntu Server) enter the following commands in the terminal:
sudo apt update
sudo apt install python3-pip

Install pip on MacOS

On MacOS enter the following two commands in a terminal window:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py

Used python modules

In the implementation of the bot script two libraries are used. First is the Advanced Python Scheduler that lets us schedule Python code to be executed later. The second one is the python-telegram-bot library, which provides a Python interface to the Telegram Bot API.

Python module installation

The two mentioned libraries can be installed with the package-management-system called pip (see Software). To install you can enter the two following commands:

pip3 install python-telegram-bot
pip3 install apscheduler

Or you navigate to the "Install" folder of the bot script in your terminal and enter:
pip3 install -r requirements.txt

Next page: Download, Configure and Run