django-telegram-objects 0.0.2

Creator: codyrutscher

Last updated:

Add to Cart

Description:

djangotelegramobjects 0.0.2

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

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.