Televiewshka
Note: as for now, this is neither stable nor working code. Being Created in ... purposes it is a subject for further updates and improvements
viewshka - Russian noun: informal of eng. "view", obtained by adding a diminutive suffix "shka"
Televiewshka allows you develop UI & logic for telegram bots with class based views. In views you can define its content and how user actions and replies must be handled on it. When all stuff related particular step in user flow is held in one class, you can clearly see relationship between components
Televiewshka supposed to be developed in such a manner to be compatible with a bunch of libs and frameworks for telegram bot api widely used by community
I guess I should write few adaptors for this purpose someday
(Supposed) Example
from telebot import TeleBot
from televiewshka import KeyboardView, \
KeyboardLayout, Button, adaptors, handler, render
# create adaptor for your lib/framework
bot = TeleBot("super-secret")
bot = adaptors.create_adaptor(bot)
# specify views
class FirstView(KeyboardView):
@bot.action_handler(action="next")
def go_next(self, query: Query):
return render("NextView", inplace=True, param=42)
@staticmethod
def render():
return KeyboardLayout(
keyboard = (
Button("Go next", on_click="next"),
))
class NextView(KeyboardView):
@bot.action_handler()
def back(self, query: Query):
return render(FirstView, inplace=True)
@staticmethod
def render(param: int):
return KeyboardLayout(
text=f"Passed param: {param}",
keyboard = (
Button("Go back", on_click="back"),
))
# run the bot
bot.start()
Some details explained
Views
something that can be rendered to user and than handle user actions on itselves actions are dispatched to appropriate view' and method in accordance with user state (e.g. current_scene flag) which is set when the view is rendered
Dispatch
messages are being dispatched according to user' state state = current view callback data or message = view method
User state
pass
Metadata
Release files for televiewshka 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| televiewshka-0.0.1.tar.gz | 10.1 kB | Without provenance | Details for televiewshka-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| televiewshka-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for televiewshka-0.0.1-py3-none-any.whl |
Total release size: 21.2 kB
Release files / televiewshka-0.0.1.tar.gz
| Download URL | televiewshka-0.0.1.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb5a5754215036b178db50be63346db3ecc60ba28ccad33efc082cb4736e3e70
|
|
BLAKE2b-256 checksum How to use checksums |
e3c245a75c3a81e0dbe2e31e1cd74797caa92728931dda3d00a53eabc1fa2894
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Release files / televiewshka-0.0.1-py3-none-any.whl
| Download URL | televiewshka-0.0.1-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0bf0885c168ba52cbe64540bc447faf885853b9a3a1879e1cae223ced00baf6b
|
|
BLAKE2b-256 checksum How to use checksums |
7d26695c4c3b99041067ee54488f83ac1238894ef821a5f51c7d13353bb000e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Security for televiewshka 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.