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
django-itelegram-1.2.5.tar.gz
(200.0 kB
view hashes)
Built Distribution
Close
Hashes for django_itelegram-1.2.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 490e50388c6508ff868ecefc195fbf2215662100c3b4df0cef78ae5a4f3336b4 |
|
MD5 | 44c309aa49d1153895d1a2dad7168cfb |
|
BLAKE2b-256 | 66fcfb981c6668f6ac52d2a12b74f6e13f44194181b37c30dda7ca8ec21aad59 |