Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

https://github.com/YazdanRa/django-itelegram/blob/master/itelegram/static/img/iTelegram.png?raw=true https://img.shields.io/pypi/pyversions/django-itelegram.svg https://img.shields.io/pypi/v/django-itelegram.svg https://img.shields.io/github/license/YazdanRa/django-itelegram.svg https://img.shields.io/badge/code%20style-black-000000.svg

Django iTelegram

It’s a library for building Telegram bot on Django with extra built-in options. created from django-telegrambot with a lot of extra features

Compatibility

  • Python: 3.5, 3.6, 3.7, 3.8

  • Django: 3.0, 3.1, 3.2

Installation

You can install this package by the PyPI with the following command line:

pip install django-itelegram

Configuration

Add itelegram and your bot app to INSTALLED_APPS:

INSTALLED_APPS = [
    # Other apps
    "itelegram",
    "YOUR_BOT_APP",
]

Then Add The DJANGO_TELEGRAMBOT to the settings just like the following structure:

DJANGO_TELEGRAMBOT = {
    "DISABLE_SETUP": False,
    #
    # TODO: Explain more about this key

    "MODE": "POLLING",  # (Optional [str])
    #
    # The default value is WEBHOOK, otherwise you may use "POLLING"
    # NB: if use polling mode you must provide to run a management command that starts a worker

    "WEBHOOK_SITE": "https://mywebsite.com",  # Required on WEBHOOK mode
    #
    # TODO: Explain more

    "WEBHOOK_PREFIX": "/prefix",  # (Optional[str])
    #
    # If this value is specified, a prefix is added to webhook url
    # "WEBHOOK_CERTIFICATE" : "cert.pem",
    # If your site use self-signed certificate, must be set with location of your public key
    # certificate.(More info at https://core.telegram.org/bots/self-signed )

    "STRICT_INIT": True,  # Optional[bool]
    #
    # TODO: Explain more about this key

    "BOTS": [
        {
            "ID": "MyBot",  # (Optional[str])
            #
            # You can use this ID to get your bot in all the installed apps

            "TOKEN": "1062412615:AAHLZ974OBY3goSSoX6HePTapjgdJMYFnEY",  # (Required[str])
            #
            # Your bot token.
            # you can get it from ( https://t.me/BotFather )

            "CONTEXT": True,
            #
            # TODO: Explain more about this key

            # "ALLOWED_UPDATES": [],  # (Optional[list[str]])
            #
            # List the types of updates you want your bot to receive.
            # For example, specify ``["message", "edited_channel_post", "callback_query"]``
            # to only receive updates of these types.
            # See ``telegram.Update`` for a complete list of available update types.
            # Specify an empty list to receive all updates regardless of type (default).
            # If not specified, the previous setting will be used.
            # Please note that this parameter doesn't affect updates created before the call to the setWebhook,
            # so unwanted updates may be received for a short period of time.

            # "TIMEOUT": 60,  # (Optional[int|float])
            #
            # If this value is specified, use it as the read timeout from the server

            # "WEBHOOK_MAX_CONNECTIONS": 40,  # (Optional[int])
            #
            # Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100.
            # Defaults to 40. Use lower values to limit the load on your bot's server,
            # and higher values to increase your bot's throughput.

            # "POLL_INTERVAL": 0.0,  # (Optional[float])
            #
            # Time to wait between polling updates from Telegram in seconds.
            # Default is 0.0

            # "POLL_CLEAN": False,  # (Optional[bool])
            #
            # Whether to clean any pending updates on Telegram servers before actually starting to poll.
            # Default is False.

            # "POLL_BOOTSTRAP_RETRIES": 0,  # (Optional[int])
            #
            # Whether the bootstrapping phase of the `Updater`
            # will retry on failures on the Telegram server.
            # |   < 0 - retry indefinitely
            # |     0 - no retries (default)
            # |   > 0 - retry up to X times

            # "POLL_READ_LATENCY": 2,  # (Optional[float|int])
            #
            # Grace time in seconds for receiving the reply from server.
            # Will be added to the `timeout` value and used as the read timeout from server.
            # Default is 2

            # "PROXY": {}, # (Optional[dict]),
            #
            # Use proxy to communicate with Telegram API server. Example:
            #    {
            #        "proxy_url": "socks5://ip:port",
            #        "urllib3_proxy_kwargs": {
            #             "username": "username",
            #             "password": "password"
            #        }
            #    }
            # Default is not to use any proxy.
        },
        # Other bots here with same structure.
    ],
}

Add the following line to the url to configure the urls.

urlpatterns = [
    # Other urls patterns
    path("itelegram/", include("itelegram.urls")),
]

Usage

TODO :D

License

MIT

Note

  1. This is a fork from django-telegrambot!

  2. Thanks to Negar Nadian for designing the Django iTelegram Logo.

Release files for django-itelegram 1.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-itelegram 1.2.6
File Size Uploaded
django-itelegram-1.2.6.tar.gz 200.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-itelegram 1.2.6
File Interpreter ABI Platform
django_itelegram-1.2.6-py3-none-any.whl Python 3 none any Details

Total release size:401.4 kB

Release files / django-itelegram-1.2.6.tar.gz

Download URL django-itelegram-1.2.6.tar.gz
Size 200.1 kB
Tags Source
SHA-256 checksum
How to use checksums
722d68c5049cf3cb40229adbe66457402234df7c99f241b362c42a775f792cf9
BLAKE2b-256 checksum
How to use checksums
87459bcf17b212ba091c9c614085039a9d9f4db536347ac8518b5e33004014b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

Release files / django_itelegram-1.2.6-py3-none-any.whl

Download URL django_itelegram-1.2.6-py3-none-any.whl
Size 201.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9802974ddcad7bb59bcbc1025611f94323539370783582d34bb9b884277eb45b
BLAKE2b-256 checksum
How to use checksums
c3886ffc6c5730e2ea6f0ed5becf62fd247b4c49c901093dedc2a307de4c19f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page