Developing Telegram bots 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.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
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
File details
Details for the file django-itelegram-1.2.6.tar.gz
.
File metadata
- Download URL: django-itelegram-1.2.6.tar.gz
- Upload date:
- Size: 200.1 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 722d68c5049cf3cb40229adbe66457402234df7c99f241b362c42a775f792cf9 |
|
MD5 | 536e79ee739d185c0cc55737e1a13974 |
|
BLAKE2b-256 | 87459bcf17b212ba091c9c614085039a9d9f4db536347ac8518b5e33004014b8 |
File details
Details for the file django_itelegram-1.2.6-py3-none-any.whl
.
File metadata
- Download URL: django_itelegram-1.2.6-py3-none-any.whl
- Upload date:
- Size: 201.3 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9802974ddcad7bb59bcbc1025611f94323539370783582d34bb9b884277eb45b |
|
MD5 | 112d3ddcc31a83390ab189bb6e1a0e01 |
|
BLAKE2b-256 | c3886ffc6c5730e2ea6f0ed5becf62fd247b4c49c901093dedc2a307de4c19f7 |