mubble


Namemubble JSON
Version 1.5.0 PyPI version JSON
download
home_pagehttps://github.com/vladislavkovalskyi/mubble
SummaryAsync Telegram framework for bot building
upload_time2024-12-10 14:03:20
maintainerNone
docs_urlNone
authorvladislavkovalskyi
requires_python<4.0,>=3.12
licenseMIT
keywords asyncio async bot api telegram telegram bot api telegram framework mubble best framework mubble framework bot building bot building framework
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Mubble 1.5.0 (stable)

[![Downloads](https://img.shields.io/pypi/dm/mubble.svg?style=flat-square)](https://pypi.python.org/pypi/mubble)
[![Downloads](https://img.shields.io/pypi/pyversions/mubble.svg?style=flat-square)](https://pypi.python.org/pypi/mubble)

<a href="https://github.com/vladislavkovalskyi/mubble">
  <img src="https://github.com/vladislavkovalskyi/mubble/blob/master/images/mubble_logo.png?raw=true" alt="Github" width="100%">
</a>

<a href="https://github.com/vladislavkovalskyi/mubble/blob/master/examples">
  <img src="https://github.com/vladislavkovalskyi/mubble/blob/master/images/click_here.png?raw=true" alt="Examples" width="100%">
</a>

<br>

**Mubble** is a next-generation framework known for its great speed and simplicity. It is written using aiohttp, asyncio, and msgspec.<br>
*([Author](https://github.com/vladislavkovalskyi)'s words)*
**Make the fastest bot ever!**

<br>

# Speed measurement
Each test contains **100 different API calls**

| Test    | Mubble (sec/avg)  | Aiogram (sec/avg) | Telebot (sec/avg) | Winner     |
|---------|-------------------|-------------------|-------------------|------------|
| 1       | **0.12896**       | 0.30656           | 0.24000           | Mubble     |
| 2       | **0.12620**       | 0.14554           | 0.17649           | Mubble     |
| 3       | **0.13366**       | 0.14902           | 0.13141           | Mubble     |
| 4       | **0.12437**       | 0.14864           | 0.13717           | Mubble     |
| 5       | **0.12754**       | 0.15863           | 0.18894           | Mubble     |
| 6       | **0.12261**       | 0.15175           | 0.17157           | Mubble     |
| 7       | **0.14395**       | 0.16154           | 0.19383           | Mubble     |
| 8       | **0.12508**       | 0.15084           | 0.24207           | Mubble     |
| 9       | **0.12239**       | 0.14838           | 0.14282           | Mubble     |
| 10      | **0.12610**       | 0.14478           | 0.13068           | Mubble     |
|         |                   |                   |                   |            |
| **AVG** | **0.12869**       | 0.16687           | 0.17550           | **Mubble** |

<br>

# Getting started

### Installing:
```bash
pip install mubble
```

```bash
poetry add mubble
```

```bash
poetry add git+https://github.com/vladislavkovalskyi/mubble.git#master
```

### Simple bot example:
```python
import random

from mubble import Token, API, Mubble, Message, CallbackQuery
from mubble.rules import StartCommand, Text, Markup, CallbackData
from mubble.tools.keyboard import InlineKeyboard, InlineButton

api = API(Token("Your token"))
bot = Mubble(api)


class Keyboard:
    menu = (
        InlineKeyboard()
        .add(InlineButton("✍️ Write hello", callback_data="hello"))
        .row()
        .add(InlineButton("🍌 Choice banana", callback_data="banana"))
    ).get_markup()

    back = (
        InlineKeyboard().add(InlineButton("⬅️ Back", callback_data="menu"))
    ).get_markup()


@bot.on.message(StartCommand())
async def start_handler(message: Message):
    await message.answer(
        "πŸ‘‹ Hello, I'm Mubble! How can I help you?\n\n"
        "My available commands:\n"
        "- /start\n"
        "- /menu\n"
        "- /random [from number] [to number]"
    )


@bot.on.message(Text("/menu"))
async def menu_handler(message: Message):
    await message.answer(
        "πŸ“ƒ Here's your menu! Use the keyboard.", reply_markup=Keyboard.menu
    )


@bot.on.message(Markup(["/random", "/random <a:int> <b:int>"]))
async def random_handler(message: Message, a: int = None, b: int = None):
    if None in (a, b):
        await message.answer(
            "πŸ€“ Wrong syntax. You also need to write the first number and the second number."
        )
        return

    await message.answer(f"🎲 Your random number is {random.randint(a, b)}")


@bot.on.callback_query(CallbackData("menu"))
async def menu_handler(cq: CallbackQuery):
    await cq.edit_text(
        "πŸ“ƒ Here's your menu! Use the keyboard.", reply_markup=Keyboard.menu
    )


@bot.on.callback_query(CallbackData("hello"))
async def hello_handler(cq: CallbackQuery):
    await cq.edit_text("πŸ‘‹ Hello, I'm Mubble!", reply_markup=Keyboard.back)


@bot.on.callback_query(CallbackData("banana"))
async def fruits_handler(cq: CallbackQuery):
    await cq.answer("You clicked on the 🍌!")


bot.run_forever()
```

Π‘Π»Π°Π²Π° Π£ΠΊΡ€Π°Ρ—Π½Ρ–! πŸ‡ΊπŸ‡¦


*by Vladyslav Kovalskyi*

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/vladislavkovalskyi/mubble",
    "name": "mubble",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.12",
    "maintainer_email": null,
    "keywords": "asyncio, async, bot api, telegram, telegram bot api, telegram framework, mubble, best framework, mubble framework, bot building, bot building framework",
    "author": "vladislavkovalskyi",
    "author_email": "vladislavkovalskyi@icloud.com",
    "download_url": "https://files.pythonhosted.org/packages/a7/34/5f851584e1d4d893eefbadd405ee0e1d9ecf5b1ca1f7b92877c6c4858b90/mubble-1.5.0.tar.gz",
    "platform": null,
    "description": "# Mubble 1.5.0 (stable)\n\n[![Downloads](https://img.shields.io/pypi/dm/mubble.svg?style=flat-square)](https://pypi.python.org/pypi/mubble)\n[![Downloads](https://img.shields.io/pypi/pyversions/mubble.svg?style=flat-square)](https://pypi.python.org/pypi/mubble)\n\n<a href=\"https://github.com/vladislavkovalskyi/mubble\">\n  <img src=\"https://github.com/vladislavkovalskyi/mubble/blob/master/images/mubble_logo.png?raw=true\" alt=\"Github\" width=\"100%\">\n</a>\n\n<a href=\"https://github.com/vladislavkovalskyi/mubble/blob/master/examples\">\n  <img src=\"https://github.com/vladislavkovalskyi/mubble/blob/master/images/click_here.png?raw=true\" alt=\"Examples\" width=\"100%\">\n</a>\n\n<br>\n\n**Mubble** is a next-generation framework known for its great speed and simplicity. It is written using aiohttp, asyncio, and msgspec.<br>\n*([Author](https://github.com/vladislavkovalskyi)'s words)*\n**Make the fastest bot ever!**\n\n<br>\n\n# Speed measurement\nEach test contains **100 different API calls**\n\n| Test    | Mubble (sec/avg)  | Aiogram (sec/avg) | Telebot (sec/avg) | Winner     |\n|---------|-------------------|-------------------|-------------------|------------|\n| 1       | **0.12896**       | 0.30656           | 0.24000           | Mubble     |\n| 2       | **0.12620**       | 0.14554           | 0.17649           | Mubble     |\n| 3       | **0.13366**       | 0.14902           | 0.13141           | Mubble     |\n| 4       | **0.12437**       | 0.14864           | 0.13717           | Mubble     |\n| 5       | **0.12754**       | 0.15863           | 0.18894           | Mubble     |\n| 6       | **0.12261**       | 0.15175           | 0.17157           | Mubble     |\n| 7       | **0.14395**       | 0.16154           | 0.19383           | Mubble     |\n| 8       | **0.12508**       | 0.15084           | 0.24207           | Mubble     |\n| 9       | **0.12239**       | 0.14838           | 0.14282           | Mubble     |\n| 10      | **0.12610**       | 0.14478           | 0.13068           | Mubble     |\n|         |                   |                   |                   |            |\n| **AVG** | **0.12869**       | 0.16687           | 0.17550           | **Mubble** |\n\n<br>\n\n# Getting started\n\n### Installing:\n```bash\npip install mubble\n```\n\n```bash\npoetry add mubble\n```\n\n```bash\npoetry add git+https://github.com/vladislavkovalskyi/mubble.git#master\n```\n\n### Simple bot example:\n```python\nimport random\n\nfrom mubble import Token, API, Mubble, Message, CallbackQuery\nfrom mubble.rules import StartCommand, Text, Markup, CallbackData\nfrom mubble.tools.keyboard import InlineKeyboard, InlineButton\n\napi = API(Token(\"Your token\"))\nbot = Mubble(api)\n\n\nclass Keyboard:\n    menu = (\n        InlineKeyboard()\n        .add(InlineButton(\"\u270d\ufe0f Write hello\", callback_data=\"hello\"))\n        .row()\n        .add(InlineButton(\"\ud83c\udf4c Choice banana\", callback_data=\"banana\"))\n    ).get_markup()\n\n    back = (\n        InlineKeyboard().add(InlineButton(\"\u2b05\ufe0f Back\", callback_data=\"menu\"))\n    ).get_markup()\n\n\n@bot.on.message(StartCommand())\nasync def start_handler(message: Message):\n    await message.answer(\n        \"\ud83d\udc4b Hello, I'm Mubble! How can I help you?\\n\\n\"\n        \"My available commands:\\n\"\n        \"- /start\\n\"\n        \"- /menu\\n\"\n        \"- /random [from number] [to number]\"\n    )\n\n\n@bot.on.message(Text(\"/menu\"))\nasync def menu_handler(message: Message):\n    await message.answer(\n        \"\ud83d\udcc3 Here's your menu! Use the keyboard.\", reply_markup=Keyboard.menu\n    )\n\n\n@bot.on.message(Markup([\"/random\", \"/random <a:int> <b:int>\"]))\nasync def random_handler(message: Message, a: int = None, b: int = None):\n    if None in (a, b):\n        await message.answer(\n            \"\ud83e\udd13 Wrong syntax. You also need to write the first number and the second number.\"\n        )\n        return\n\n    await message.answer(f\"\ud83c\udfb2 Your random number is {random.randint(a, b)}\")\n\n\n@bot.on.callback_query(CallbackData(\"menu\"))\nasync def menu_handler(cq: CallbackQuery):\n    await cq.edit_text(\n        \"\ud83d\udcc3 Here's your menu! Use the keyboard.\", reply_markup=Keyboard.menu\n    )\n\n\n@bot.on.callback_query(CallbackData(\"hello\"))\nasync def hello_handler(cq: CallbackQuery):\n    await cq.edit_text(\"\ud83d\udc4b Hello, I'm Mubble!\", reply_markup=Keyboard.back)\n\n\n@bot.on.callback_query(CallbackData(\"banana\"))\nasync def fruits_handler(cq: CallbackQuery):\n    await cq.answer(\"You clicked on the \ud83c\udf4c!\")\n\n\nbot.run_forever()\n```\n\n\u0421\u043b\u0430\u0432\u0430 \u0423\u043a\u0440\u0430\u0457\u043d\u0456! \ud83c\uddfa\ud83c\udde6\n\n\n*by Vladyslav Kovalskyi*\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Async Telegram framework for bot building",
    "version": "1.5.0",
    "project_urls": {
        "Homepage": "https://github.com/vladislavkovalskyi/mubble",
        "Repository": "https://github.com/vladislavkovalskyi/mubble"
    },
    "split_keywords": [
        "asyncio",
        " async",
        " bot api",
        " telegram",
        " telegram bot api",
        " telegram framework",
        " mubble",
        " best framework",
        " mubble framework",
        " bot building",
        " bot building framework"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f2df2b8ce9c61d5ef98dcf110d529f18694916ffcbbde17522ed236075ee5acb",
                "md5": "7dc7f7349c9a8fb3af1195c7e261308f",
                "sha256": "3b0641f80c70af34d3e7f02c381771313962a1069ade87181f6aeefd38ec7d47"
            },
            "downloads": -1,
            "filename": "mubble-1.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7dc7f7349c9a8fb3af1195c7e261308f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.12",
            "size": 239704,
            "upload_time": "2024-12-10T14:03:18",
            "upload_time_iso_8601": "2024-12-10T14:03:18.198775Z",
            "url": "https://files.pythonhosted.org/packages/f2/df/2b8ce9c61d5ef98dcf110d529f18694916ffcbbde17522ed236075ee5acb/mubble-1.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a7345f851584e1d4d893eefbadd405ee0e1d9ecf5b1ca1f7b92877c6c4858b90",
                "md5": "e84226e1a9c186c880cb96418e3ddc4b",
                "sha256": "4e78213c22d10abf61bb896bf05c53f09541258d47054c5acbebec0c261b974d"
            },
            "downloads": -1,
            "filename": "mubble-1.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e84226e1a9c186c880cb96418e3ddc4b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.12",
            "size": 177871,
            "upload_time": "2024-12-10T14:03:20",
            "upload_time_iso_8601": "2024-12-10T14:03:20.927279Z",
            "url": "https://files.pythonhosted.org/packages/a7/34/5f851584e1d4d893eefbadd405ee0e1d9ecf5b1ca1f7b92877c6c4858b90/mubble-1.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-10 14:03:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "vladislavkovalskyi",
    "github_project": "mubble",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mubble"
}
        
Elapsed time: 0.38159s