Skip to main content

minimalistic telegram bot framework that can be used in AWS Lambda or anywhere

Project description

MiniGram 🤖📬

MiniGram is an ultraminimalistic Python library for building Telegram bots that's perfect for use in restricted environments like AWS Lambdas. Say goodbye to bloated libraries and hello to MiniGram's sleek and efficient design! 🚀✨

Features 🌟

  • Lightweight and minimalistic 🍃
  • Works in both synchronous and asynchronous modes ⚡️
  • Seamless integration with popular web libraries like Starlette/FastAPI and aiohttp 🌐
  • Easy to use and understand API 😊
  • Perfect for deploying bots in restricted environments like AWS Lambdas 🔒

Installation 📦

To start building your super cool Telegram bot with MiniGram, simply install it using pip:

pip install minigram-py

Usage 🚀

Using MiniGram is as easy as 1-2-3! Here are a few examples to get you started:

Basic Example

from minigram import MiniGram

class MyAwesomeBot(MiniGram):
    def incoming(self, msg):
        if msg.text == "/start":
            return msg.reply("Welcome to my awesome bot! 🎉")
        return self.sent_text(msg.chat.id, "I don't understand that command. 😕")

bot = MyAwesomeBot("YOUR_BOT_TOKEN")
bot.start_polling()

In just a few lines of code, you've created a bot that responds to the "/start" command. How cool is that? 😎

Starlette Integration

from starlette.applications import Starlette
from starlette.routing import Route
from minigram import StarletteMiniGram

class MyStarletteBot(StarletteMiniGram):
    async def incoming(self, msg):
        if msg.text == "/hello":
            return msg.reply("Hello from Starlette! 👋")

bot = MyStarletteBot("YOUR_BOT_TOKEN")
bot.set_webhook("https://yourwebsite.com/webhook")

app = Starlette(debug=True, routes=[
    Route("/webhook", bot.starlette_handler, methods=["POST"]),
])

This example shows how seamlessly MiniGram integrates with Starlette, allowing you to create a webhook endpoint for your bot in no time! 🌐

Asynchronous Mode

from minigram import AsyncMiniGram

class MyAsyncBot(AsyncMiniGram):
    async def incoming(self, msg):
        if msg.text == "/sync":
            return msg.reply("I'm a asynchronous bot, for sure! ⚙️")

async def main():
    bot = MyAsyncBot("YOUR_BOT_TOKEN")
    await bot.sent_text(YOUR_CHAT_ID, "Hello from an asynchronous bot! 🚀")
    await bot.start_polling()

MiniGram works just as well in asynchronous mode, making it easy to integrate with your existing async application. 🎛️

Contributing 🤝

We love contributions! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request on our GitHub repository. Let's make MiniGram even better together! 💪

License 📄

MiniGram is released under the MIT License, so feel free to use it in your projects, whether they're open-source or commercial. 😄


Now go forth and build some amazing bots with MiniGram! 🎈🤖

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minigram_py-0.2.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

minigram_py-0.2.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file minigram_py-0.2.0.tar.gz.

File metadata

  • Download URL: minigram_py-0.2.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.15.4 CPython/3.12.3 Darwin/23.5.0

File hashes

Hashes for minigram_py-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fc6d7b84db66ad54ec227aeda5099529f2e08f9bb501e429e1e4faf92b860eb8
MD5 96bff5fca13713119a6d03723f242587
BLAKE2b-256 4b799cac4c2fea0ff30f548a769e71552ce78a0030b4d192bc871867a757c066

See more details on using hashes here.

File details

Details for the file minigram_py-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: minigram_py-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.15.4 CPython/3.12.3 Darwin/23.5.0

File hashes

Hashes for minigram_py-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c4050a8b0b34e5eed73e6eed14dd3c2f60efbc60c5e2f86e9daa16009b36a42
MD5 9e54d63ea912c77d709853a27fab5427
BLAKE2b-256 085d5a053ae12cc890114bfefd91f3cf190b33c272cfba4a38953887e1cea3c5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page