keralabots / tgrambot Goto Github PK
View Code? Open in Web Editor NEWTGramBot is a partially auto-generated and asynchronous Minimal Telegram Bot API framework in Python for bots
License: GNU General Public License v3.0
TGramBot is a partially auto-generated and asynchronous Minimal Telegram Bot API framework in Python for bots
License: GNU General Public License v3.0
Hello! I want to table a proposal to add a special submodule to generate Telegram-specific markup easily.
A common markdown format that every programmer uses is really simple and doesn’t require special utils for that, but MarkdownV2 and HTML which let include spoiler, strikethrough and other telegram innovations are different. For example, MarkdownV2 also requires to escape 18 characters, and if it’s not, reject the request. This may make the task of designing markup generation for bots that include business logic complicated enough and I suppose it’s better to have a ready-made out-of-the-box solution for this.
I have recently worked on a related challenge and I’m writing this to propose to re-use my solution. It’s the telegram-text
module. The general structure in the context of the tgrambot
module I propose to implement is the following:
telegram-text
as a dependency (maybe even optional)tgrambot
module core to import styles and other needed classes as from tgrambot import ...
. Or it’s quite pretty to add a separated file (text.py
or markup.py
for example) to import as from tgrambot.text import ...
telegram-text
module?Example of the module:
from telegram_text import Bold, Italic, Underline
text = Underline(Bold("Bold") + "and" + Italic("italic") + "with underline.")
tgrambot
contextfrom tgrambot import Bot
from tgrambot.text import Spoiler
bot = Bot("token", workers=50, parse_mode='MarkdownV2')
@bot.on_message(Filters.command('start'))
async def start_bot(c: Bot, m: Message):
await c.send_message(m.chat.id, Spoiler("Hola Amigo!"))
I tried to install tgrambot, but it keeps raising an error.
/storage/emulated/0 $ pip3 install tgrambot
Collecting tgrambot
Downloading TGramBot-0.0.1b1.tar.gz (36 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [10 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module> File "/data/data/ru.iiec.pydroid3/cache/pip-install-alvimup5/tgrambot_50d7f24ab9b644ba8ae2cbf4df223581/setup.py", line 6, in <module>
from compiler import build_types, build_methods
File "/data/data/ru.iiec.pydroid3/cache/pip-install-alvimup5/tgrambot_50d7f24ab9b644ba8ae2cbf4df223581/compiler/__init__.py", line 3, in <module>
from .build_api import build_api
File "/data/data/ru.iiec.pydroid3/cache/pip-install-alvimup5/tgrambot_50d7f24ab9b644ba8ae2cbf4df223581/compiler/build_api.py", line 10, in <module>
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
/storage/emulated/0 $
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.