The "Telegram Groups Indexer Bot" (TGroupsIndexerBot) project was born out of the need, in its time by the "Sapienza Students" organization, and today by the "Sapienza Students Network" organization, to promote and make the Telegram groups of students of different courses and their different subjects more easily discoverable from other prospective students
This first version lays the foundations for indexing in particular with regard to the listing of indexed groups to bot users, but there is still a long way to go, since the main functionality, which consists of the bot's users being able to add the bot to a group and autonomously make the group indexed by choosing a category (e.g. a degree course) and a sub-category, is still to be implemented.
🔔 Keep up to date with updates to this GitHub repository by joining https://t.me/TGroupsIndexerBotGit
Initially the "Sapienza Students" organization opted for a solution in the GO programming language (whose code is still available on GitLab), recently, with the management of @SapienzaStudentsBot entrusted to Matypist and Sapienza Students Network, it was decided to rewrite the bot from scratch in Python. The reason behind this choice is that Python is a mandatory subject in the Computer Science course at Sapienza, mainly through the teaching of "Fondamenti di Programmazione" in the first semester of the first year of the course, as well as in other Computer Science-related courses available at Sapienza and also most other Italian universities, whereas GO is actually usually only found in teachings at the student's choice. The new aim was therefore the choice of a programming language within the reach of most of the students who will then actually use the bot, so as to facilitate any voluntary collaboration in its development.
-
Create your bot instance on BotFather
-
Start https://t.me/BotFather on Telegram
-
Send
/newbot
to https://t.me/BotFather on Telegram -
Follow the prompts to choose a name and username for your bot instance
-
Once you are done following the instructions, you should receive a token in the final confirmation message, that will be your TOKEN value
-
-
Create your PostgreSQL instance
a. Get an instance hosted for free by ElephantSQL
-
Enter your email address
-
Check your inbox for a confirmation mail from ElephantSQL
-
Open the link contained in the confirmation mail to open the account creation page
-
Enter a password of your choosing and check the "Yes" checkbox to accept the Terms of Service
-
Click the "Create Account" button
-
Click the "Create New Instance" button and follow the instructions to name, set up and create your instance
-
Once created, go to the Instance Panel (https://customer.elephantsql.com/instance/) and access the instance
-
In the instance details page, copy the postgres:// URL with the copy icon, that will be your DATABASE_URL value
-
Install python3 and python3-pip on your operating system
-
Windows (not tested)
- Download Python3 from the official website
- Run the installer and follow the prompts to install Python3 on your system
- Open the Command Prompt and type
python3 -m ensurepip --upgrade
to install python3-pip
-
Debian-based GNU/Linux distributions
- Open the terminal and run the command
sudo apt update
to update the package lists - Run the command
sudo apt install python3 python3-pip
to install Python3 and python3-pip
- Open the terminal and run the command
-
Arch Linux
- Open the terminal and run the command
sudo pacman -Syu
to update the package lists - Run the command
sudo pacman -S python python-pip
to install Python3 and python3-pip
- Open the terminal and run the command
-
-
Clone this repository on your filesystem
a. Using
git
:git clone https://github.com/sapienzastudentsnetwork/tgroupsindexerbot/
b. Downloading it as ZIP [Mirror] and extracting it in a directory
-
Verify that python3 and python3-pip are correctly installed and functioning by running the
python3 -V
andpip3 -V
commands respectively -
Open a terminal window or command prompt window and go to the local project root directory using the
cd
command followed by the directory path (e.g.cd "C:\Users\matypist\Downloads\tgroupsindexerbot"
) -
Run the
pip install pipenv
command to install pipenv, a tool required to create and manage a virtual environment containing this project's dependencies and environment variables -
Run the
pipenv install
command to install all the dependencies required for this project (which, should you be interested, are specified in this project's Pipfile) -
Create a file named
.env
on the local project root directory, with the two following lines:TOKEN=(your TOKEN value without parentheses) DATABASE_URL=(your DATABASE_URL value without parentheses)
To define the environment variable values required for the bot functioning
N.B.: replace the values with the ones you got in the "Prerequisites" section
-
Open a terminal window or command prompt window and go to the project root directory using the
cd
command followed by the directory path (e.g.cd "C:\Users\matypist\Downloads\tgroupsindexerbot"
) -
Run the
pipenv shell
command to activate this project's virtual environment (previously set up in the "Set up a local running environment" section) and load the environment variables -
Run the
python main.py
command to finally run your bot instance -
Start a chat with your bot instance on Telegram finding it through the username that you had previously chosen, e.g. via https://telegram.me/(your_bot_instance_username)
N.B.: for example the original instance's username is SapienzaStudentsBot (https://telegram.me/SapienzaStudentsBot) and you can also find it directly inside Telegram search by searching for @SapienzaStudentsBot