It's a library for building Telegram bot on Django with extra built-in features
Project description
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.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 django-itelegram and your bot app to INSTALLED_APPS:
INSTALLED_APPS = [
# Other apps
"django-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
url(r"^", include("django_itelegram.urls")),
]
Usage
TODO :D
License
Note
This is a fork from django-telegrambot!
Thanks to Negar Nadian for designing the Django iTelegram Logo.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for Django_iTelegram-1.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50ee4060a6742d0c9ded42ec1e38d7bc2993ef2f9fe4bac6a96b0c1de945dfd6 |
|
MD5 | 94a75ef9a064599ebbc26f87febdb8bd |
|
BLAKE2b-256 | 66520ff459282639a23413339bd947b729074f4bb53d754227bacc9b9b1bd053 |