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 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! 🎉")

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 MiniGram
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 MiniGram

class MySyncBot(MiniGram):
    async def incoming(self, msg):
        if msg.text == "/sync":
            return msg.reply("I'm a synchronous bot! ⚙️")

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

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.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

minigram_py-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: minigram_py-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.12.4 CPython/3.12.2

File hashes

Hashes for minigram_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eaf15df8c29ec0ed6aa1b32e3b8663b62e744a0e203527def48ce4f20bd9405b
MD5 3439afadfcc1dbd27799401f7bd7b57e
BLAKE2b-256 b1b1e05c22d9e1381ba8c109e8b93c60772afdd5dfd1f3cca12ffe24d11595b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: minigram_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.12.4 CPython/3.12.2

File hashes

Hashes for minigram_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c59e7191511699dcafb909e37e77d94a95a127db7538594a81ee4af204491c3
MD5 53aec72f22f7d125f952545eee359079
BLAKE2b-256 0c3adcad7635576d45434d6c2479c4076cb10af0af67f556cfb8396a09f544d7

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