Metadata-Version: 2.1
Name: jackfruit
Version: 0.12
Summary: Generic views for python-telegram-bot
Home-page: https://github.com/zzzzlzzzz/jackfruit
Author: Tosha
Author-email: zzzzlzzzz@yandex.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Internet
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Description-Content-Type: text/markdown
Requires-Dist: python-telegram-bot

# Jackfruit
## Introduction
This library provides a simple way for creating telegram bots with deep level menu.
## Components
Library give users components, like:

* Menu (_MenuView_) - give user ability select menu item and navigate on menus;
* Text Input (_TextDataInputView_) - give user ability enter text data;
* Image Input (_PhotoDataInputView_) - give user ability send image to bot;
* Document Input (_DocumentDataInputView_) - give user ability send files to bot;
* Audio Input (_AudioDataInputView_) - give user ability send audio files to bot;
* Video Input (_VideoDataInputView_) - give user ability send video files to bot;
* Voice Input (_VoiceDataInputView_) - give user ability send voice messages to bot;
* Sticker Input (_StickerDataInputView_) - give user ability send sticker to bot;

You can use class _GenericDataView_ for show user screen, that blocking next navigation and force user to use command syntax.

All components may be easy customized, for more details please see source code (it have commented).
## Usage
```python
from os import environ

from telegram.ext import Updater

from jackfruit import *


class MainMenu(MenuView):
    text = 'Hello from my bot!'
    menu_items = [[('Enter my name', 'EnterName'), ('Select my age', 'SelectAge')], ]


class EnterName(TextDataInputView):
    text = 'Enter my name:'

    def process_data(self, state, update, context, data):
        return 'MainMenu'


class SelectAge(MenuView):
    text = 'Select my age:'
    menu_items = [[('Below 18', 'MainMenu'), ('Above 18', 'MainMenu')]]


updater = Updater(environ['TOKEN'], use_context=True)
main_menu = MainMenu()
enter_name = EnterName()
select_age = SelectAge()
Jackfruit(updater.dispatcher, main_menu, [('start', 'MainMenu')]).register(enter_name, select_age)
updater.start_polling()
updater.idle()
```

