Skip to main content

django-telegram-objects is a Django application that creates Telegram objects of a bot in a Postgres Database.

Project description

https://img.shields.io/github/workflow/status/ramiboutas/django-telegram-objects/CI/master?style=for-the-badge https://img.shields.io/badge/Coverage-100%25-success?style=for-the-badge https://img.shields.io/pypi/v/django-telegram-objects.svg?style=for-the-badge https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge pre-commit

About

A Django App that creates Telegram objects of a bot in a Postgres Database. The bot has to have permission to read the messages of the Chat objects where is the member of.

Requirements

Python 3.7 to 3.11 supported.

Django 3.2 to 4.1 supported.


Setup

Install from pip:

python -m pip install django-telegram-objects

Add it to your installed apps:

INSTALLED_APPS = [
    ...,
    "telegram_objects",
    ...,
]

Make sure you are using a Postgres database and migrate the tables:

python manage.py migrate

Set up

In you project settings:

Add your bot token: TELEGRAM_BOT_API_KEY

Recommendation: save your bot token a .env file

TELEGRAM_BOT_API_KEY=<your-token>

Load your secrets keys and tokens using, for example, [python-dotenv](https://pypi.org/project/python-dotenv/) and access to the key using os.environ.get method:

TELEGRAM_BOT_API_KEY = os.environ.get("TELEGRAM_BOT_API_KEY")

Add models you would like to see in your Django admin:

Example:

TELEGRAM_MODELS_IN_ADMIN_SITE = (
    "Chat",
    "Message",
    "Document",
)

How to use

Once the app is set up, you can get updates by running the command:

python manage.py get_updates

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-telegram-objects-0.0.2.tar.gz (66.9 kB view hashes)

Uploaded Source

Built Distribution

django_telegram_objects-0.0.2-py3-none-any.whl (69.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page