latina-in-tech / lit-bot

Repository for the Telegram's group bot.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LatinaInTech Bot (a.k.a. LiT Bot)

Index

Introduction

The LatinaInTech (aka LiT) bot is the official bot of the Telegram group of the homonymous community.
The idea of having a bot to offer group users a series of additional features to the UX is something that espouses the philosophy of the community, that of being a point of reference for enthusiasts of the tech world of the province (and not).

Go to index ↑

Current features

At the moment, the features implemented in the bot are:

Events

Jobs

User management

General

  • download slides templates for lightining talks
  • view community contacts
  • view bot commands
  • view community FAQ
  • view community rules

Go to index ↑

Used technologies

The technologies used by the application are:

  • Python (3.12.1)
  • SQLite (3.44.2)

The libraries used by Python are:

  • python-dotenv
  • python-telegram-bot
  • SQLAlchemy
  • SQLAlchemy-Utils

Setup

Prerequisites

To use the bot, you need to have a Telegram API token, which can be obtained by following the official guide.

Then, you can choose to install the application in two ways:

  • on your PC
  • using Docker

If you want to install the application on your PC, then keep following this guide;
otherwise, jump directly to the setup guide using Docker.

In both cases, you still need to setup your .env file in order to get the application working correctly.

Setup on your PC

Once this point has been established, we can move on to the phase of creating the Python virtual environment, within which all the dependencies necessary for the correct functioning of the application will be installed.

To proceed with completing this step, you must have the virtualenv module installed.
If this is not installed, run the command:

python -m pip install virtualenv

Once the virtualenv module is installed, you can proceed with cloning this repository.
To proceed with completing this step, use the command:

git clone https://github.com/latina-in-tech/lit-bot.git

Once the repository has been cloned, you can proceed with the creation of the application's virtual environment.
To proceed with completing this step, use the command:

python -m virtualenv .\venv

Once the creation of the virtual environment of the application (hereinafter venv) has been completed, you can proceed with its activation, using the command (for Windows):

.\venv\Scripts\activate

Once venv is activated, you can proceed with installing the application dependencies (requirements.txt), using the command:

pip install -r requirements.txt

Once the application dependencies are installed, you can proceed with the creation of the .env file in the root folder, within which it is necessary to specify a series of environment variables for the correct functioning of the application.
The variables are:

BOT_TOKEN=<api_token>

SA_DB_DIALECT=sqlite
SA_DB_DRIVER=pysqlite
SA_DB_FILEPATH=database/db.sqlite

Once the .env file has been created, and the variables have been correctly valued, the application is ready to be used, running the command:

python .

Go to index ↑

Setup using Docker

In order to use Docker containers to setup the application, you need to have Docker Desktop installed in your operating system.

Once this point has been estabilished, you can proceed with building the Docker image with the command:

docker image build . --tag "lit-bot-image"

Once the Docker image has been built, you can proceed with creating and running the container with the command:

docker container run --interactive --detach --name lit-bot-container lit-bot-image

You can also use Docker Compose to build and run the application stack, using the command:

docker compose up --detach

Once the Docker container/stack is created and is running, the application is ready to be used.

Go to index ↑

How to use

To use the LatinaInTech bot, you need to search for it on Telegram by typing @latinaintechbot in the general search bar.
Once you have found the bot, you can proceed with launching it, making sure you receive the welcome message as shown below:

start command

Go to index ↑

By typing the command /cmds, the list of commands that can be used by the user will be shown.
For guidance on how to use individual commands, you can type the command you want to use, followed by the help switch:

/jobs help

Go to index ↑

Events

View community events

To see upcoming community events, you need to type the /events command, which will display a list like the one below:

TODO - Example

Go to index ↑

Jobs

Creation of a new job offer

To create a new job offer, you need to type the command /create_job, which will start a conversation with the user, asking for the various fields required to correctly register the job offer.
You can see the whole process through the following images.

Click here to expand

create_job - start

create_job - contract type

create_job - job category

create_job - job position

create_job - job description

create_job - job link

create_job - job ral

create_job - job created


Go to index ↑

View job offers registered by community users

To view the list of job offers registered within the community, you need to type the /jobs command, which will show a list like the one below:

jobs - jobs start

jobs - jobs category

jobs - jobs category selected

Go to index ↑

User management

Set user role

This command can only be used by a user with an administrator role (Telegram), through which the role specified in the command itself can be assigned to a user. User role assignment can be done in two ways:

  • specifying the name of the user set on Telegram and the role you want to assign to the user;
  • by replying to a message from the user, specifying only the role you want to assign to it.

Examples:

  • Set the role "Administrator" to the user with the command:

/set_user_role @username Administrator

set_user_role - with username

  • Set the role "Administrator" to the user replying to the user's message with the command:

/set_user_role Administrator

set_user_role - without username

Go to index ↑

About

Repository for the Telegram's group bot.


Languages

Language:Python 99.8%Language:Dockerfile 0.2%