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
django_oscarbot-0.61.tar.gz
(51.6 kB
view hashes)
Built Distribution
Close
Hashes for django_oscarbot-0.61-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6683233e52ad6bab7cd937f19cfb46b19d56b9d06c3884c9bbec0d805817b21 |
|
MD5 | b00cb1348f2444d16c7a5d54dd8f871e |
|
BLAKE2b-256 | 10f929f9b1bdad2e41a856b5cf0b1f96a4ac4c58f6c16269a43cb8c337c3f300 |