Django app for create Telegram bot
Project description
TG Core from Oscar
Telegram bot core only for webhooks way working
Telegram bot core, created in django style with routing and views(handlers) where you can use included builders for menu or messages
Installing / Getting started
This is package only for using with Django project.
pip install django-oscarbot
Initial Configuration
In settings.py file you need to specify application for tg use:
OSCARBOT_APPS = ['main']
# set Telegram api url in your env variables TELEGRAM_URL
# set Telegram message parse mode:
TELEGRAM_PARSE_MODE = 'HTML'
# or
TELEGRAM_PARSE_MODE = 'MARKDOWN'
Run django server and open localhost:8000/admin/ and create new bot, at least fill bot token for testing ability
Features
- User model
from oscarbot.models import User
some_user = User.objects.filter(username='@maslov_oa').first()
- Menu and Buttons builder
from oscarbot.menu import Menu, Button
button_list = [
Button(text='Text for callback', callback='/some_callback/'),
Button(text='Text for external url', url='https://oscarbot.site/'),
Button(text='Web app view', web_app='https://oscarbot.site/'),
]
menu = Menu(button_list)
- Message builder
from oscarbot.shortcut import QuickBot
quick_bot = QuickBot(
chat=111111111,
message='Hello from command line',
token='token can be saved in DB and not required'
)
quick_bot.send()
-
Application with routing and views(handlers):
-
Long polling server for testing
python manage.py runbot
- Update messages available
# TODO: work in progress
- Messages log
# TODO: work in progress
Links
- Project homepage: https://oscarbot.site/
- Repository: https://github.com/oscarbotru/oscarbot/
Licensing
The code in this project is licensed under MIT license.
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_oscarbot-0.36.tar.gz
.
File metadata
- Download URL: django_oscarbot-0.36.tar.gz
- Upload date:
- Size: 41.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b0f2d74ce04079670190d76bad76e5d51cac183d0fd84e337038304b9cc73e5 |
|
MD5 | e0cf0b8e22ba9f432ac63a690aa6d70d |
|
BLAKE2b-256 | 8477a1f484fe6d08a4a876ccea9a5465085450964387ceb8edb8a82af542ffca |
File details
Details for the file django_oscarbot-0.36-py3-none-any.whl
.
File metadata
- Download URL: django_oscarbot-0.36-py3-none-any.whl
- Upload date:
- Size: 61.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0a78a562bb0829c1931db567abcc5d9d168da2f091b906c6148b6f49b30c996 |
|
MD5 | b62133d81105c779ab5b304c394d307f |
|
BLAKE2b-256 | 6afed0d8ad00914b79fcbaca449f750ab0007485b4bc3db06e4b9673ec74e213 |