Telegrask
Flask-inspired Telegram bot micro framework for Python. Main idea is to use callback function decorators and make bot creating more intuitive for developer.
Installing
$ python3 -m pip install Telegrask
Simple "Hello World" bot example
from telegrask import Telegrask
bot = Telegrask("BOT_TOKEN")
@bot.command("hello", help='display "Hello, World!"')
def hello_command(update, context):
update.message.reply_text("Hello, World!")
if __name__ == "__main__":
bot.run(debug=True)
More examples in examples folder.
Equivalent in pure python-telegram-bot
Click to show
from telegram.ext import Updater, CommandHandler
from telegram import ParseMode
import logging
logging.basicConfig(format="%(levelname)s - %(message)s", level=logging.DEBUG)
logger = logging.getLogger(__name__)
def hello_command(update, context):
update.message.reply_text("Hello, World!")
def help_command(update, context):
help_content = """*Available commands*
/hello
display "Hello, World!"
/help
display this message
"""
update.message.reply_text(help_content, parse_mode=ParseMode.MARKDOWN)
def main():
global updater
updater = Updater("BOT_TOKEN")
dispatcher = updater.dispatcher
dispatcher.add_handler(CommandHandler("hello", hello_command))
dispatcher.add_handler(CommandHandler(["help", "start"], help_command))
updater.start_polling()
updater.idle()
if __name__ == "__main__":
main()
Useful links
Metadata
Release files for telegrask 0.3.10
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 |
|---|---|---|---|---|
| Telegrask-0.3.10.tar.gz | 9.4 kB | Without provenance | Details for Telegrask-0.3.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Telegrask-0.3.10-py3-none-any.whl | Python 3 | none | any | Details for Telegrask-0.3.10-py3-none-any.whl |
Total release size: 21.7 kB
Release files / Telegrask-0.3.10.tar.gz
| Download URL | Telegrask-0.3.10.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aba4e3e69762c4d7fcb9a9d7a0d7bffac69afabdd6c4cf80b20528e7e3b0d38d
|
|
BLAKE2b-256 checksum How to use checksums |
07f9d761acbddd0741df51f5119bc76adfeddd8da3fbdc76f5d7ce488dc2b389
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.7 CPython/3.9.6 Linux/5.12.5-zen1-1-zen
|
Release files / Telegrask-0.3.10-py3-none-any.whl
| Download URL | Telegrask-0.3.10-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9335057b4f769838f694e69f964089d4b7dc45b2c9fc1943ec0febf9fb39ab45
|
|
BLAKE2b-256 checksum How to use checksums |
e8293fb4e0cddad159ee9187eef43c2cc41cf4cfe8ddf7aad66a072821291304
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.7 CPython/3.9.6 Linux/5.12.5-zen1-1-zen
|
Security for telegrask 0.3.10
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.