hikari-miru


Namehikari-miru JSON
Version 4.2.0 PyPI version JSON
download
home_pagehttps://github.com/hypergonial/hikari-miru
SummaryAn alternative component handler for hikari, inspired by discord.py's views.
upload_time2024-10-08 16:30:20
maintainerhypergonial
docs_urlNone
authorhypergonial
requires_python<3.14,>=3.10.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # hikari-miru

<div align="center">

[![PyPI](https://img.shields.io/pypi/v/hikari-miru)](https://pypi.org/project/hikari-miru)
[![CI](https://github.com/hypergonial/hikari-miru/actions/workflows/ci.yml/badge.svg)](https://github.com/hypergonial/hikari-miru/actions/workflows/ci.yml)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)
![Pyright](https://badgen.net/badge/Pyright/strict/2A6DB2)

</div>

A component handler for [hikari](https://github.com/hikari-py/hikari), aimed at making the creation & management of Discord UI components easy.

> [!TIP]
> Like what you see? Check out [arc](https://arc.hypergonial.com), a command handler with a focus on type-safety and correctness.

## Installation

To install miru, run the following command:

```sh
pip install -U hikari-miru
```

To check if miru has successfully installed or not, run the following:

```sh
python3 -m miru
# On Windows you may need to run:
py -m miru
```

## Usage

```py
import hikari
import miru

# REST bots are also supported
bot = hikari.GatewayBot(token="...")

# Wrap the bot in a miru client
client = miru.Client(bot)

class MyView(miru.View):

    @miru.button(label="Rock", emoji="\N{ROCK}", style=hikari.ButtonStyle.PRIMARY)
    async def rock_button(self, ctx: miru.ViewContext, button: miru.Button) -> None:
        await ctx.respond("Paper!")

    @miru.button(label="Paper", emoji="\N{SCROLL}", style=hikari.ButtonStyle.PRIMARY)
    async def paper_button(self, ctx: miru.ViewContext, button: miru.Button) -> None:
        await ctx.respond("Scissors!")

    @miru.button(label="Scissors", emoji="\N{BLACK SCISSORS}", style=hikari.ButtonStyle.PRIMARY)
    async def scissors_button(self, ctx: miru.ViewContext,  button: miru.Button) -> None:
        await ctx.respond("Rock!")

    @miru.button(emoji="\N{BLACK SQUARE FOR STOP}", style=hikari.ButtonStyle.DANGER, row=1)
    async def stop_button(self, ctx: miru.ViewContext, button: miru.Button) -> None:
        self.stop() # Stop listening for interactions


@bot.listen()
async def buttons(event: hikari.GuildMessageCreateEvent) -> None:

    # Ignore bots or webhooks pinging us
    if not event.is_human:
        return

    me = bot.get_me()

    # If the bot is mentioned
    if me.id in event.message.user_mentions_ids:
        view = MyView()  # Create a new view
        # Send the view as message components
        await event.message.respond("Rock Paper Scissors!", components=view)
        client.start_view(view) # Attach to the client & start it

bot.run()
```

To get started with `miru`, see the [documentation](https://miru.hypergonial.com), or the [examples](https://github.com/hypergonial/hikari-miru/tree/main/examples).

## Extensions

miru has two extensions built-in:

- [`ext.nav`](https://miru.hypergonial.com/guides/navigators/) - To make it easier to build navigators (sometimes called paginators).
- [`ext.menu`](https://miru.hypergonial.com/guides/menus/) - To make it easier to create nested menus.

Check the corresponding documentation and the [examples](https://github.com/hypergonial/hikari-miru/tree/main/examples) on how to use them.

## Issues and support

For general usage help or questions, see the `#miru` channel in the [hikari discord](https://discord.gg/hikari), if you have found a bug or have a feature request, feel free to [open an issue](https://github.com/hypergonial/hikari-miru/issues/new)!

## Contributing

See [Contributing](./CONTRIBUTING.md)

## Links

- [**Documentation**](https://miru.hypergonial.com)
- [**Examples**](https://github.com/hypergonial/hikari-miru/tree/main/examples)
- [**License**](https://github.com/hypergonial/hikari-miru/blob/main/LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hypergonial/hikari-miru",
    "name": "hikari-miru",
    "maintainer": "hypergonial",
    "docs_url": null,
    "requires_python": "<3.14,>=3.10.0",
    "maintainer_email": null,
    "keywords": null,
    "author": "hypergonial",
    "author_email": "46067571+hypergonial@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/2d/ce/d97375fa52eaf9c66639e97b0dfb528a1f9cc38c982efa667e4e57bd69da/hikari_miru-4.2.0.tar.gz",
    "platform": null,
    "description": "# hikari-miru\n\n<div align=\"center\">\n\n[![PyPI](https://img.shields.io/pypi/v/hikari-miru)](https://pypi.org/project/hikari-miru)\n[![CI](https://github.com/hypergonial/hikari-miru/actions/workflows/ci.yml/badge.svg)](https://github.com/hypergonial/hikari-miru/actions/workflows/ci.yml)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)\n![Pyright](https://badgen.net/badge/Pyright/strict/2A6DB2)\n\n</div>\n\nA component handler for [hikari](https://github.com/hikari-py/hikari), aimed at making the creation & management of Discord UI components easy.\n\n> [!TIP]\n> Like what you see? Check out [arc](https://arc.hypergonial.com), a command handler with a focus on type-safety and correctness.\n\n## Installation\n\nTo install miru, run the following command:\n\n```sh\npip install -U hikari-miru\n```\n\nTo check if miru has successfully installed or not, run the following:\n\n```sh\npython3 -m miru\n# On Windows you may need to run:\npy -m miru\n```\n\n## Usage\n\n```py\nimport hikari\nimport miru\n\n# REST bots are also supported\nbot = hikari.GatewayBot(token=\"...\")\n\n# Wrap the bot in a miru client\nclient = miru.Client(bot)\n\nclass MyView(miru.View):\n\n    @miru.button(label=\"Rock\", emoji=\"\\N{ROCK}\", style=hikari.ButtonStyle.PRIMARY)\n    async def rock_button(self, ctx: miru.ViewContext, button: miru.Button) -> None:\n        await ctx.respond(\"Paper!\")\n\n    @miru.button(label=\"Paper\", emoji=\"\\N{SCROLL}\", style=hikari.ButtonStyle.PRIMARY)\n    async def paper_button(self, ctx: miru.ViewContext, button: miru.Button) -> None:\n        await ctx.respond(\"Scissors!\")\n\n    @miru.button(label=\"Scissors\", emoji=\"\\N{BLACK SCISSORS}\", style=hikari.ButtonStyle.PRIMARY)\n    async def scissors_button(self, ctx: miru.ViewContext,  button: miru.Button) -> None:\n        await ctx.respond(\"Rock!\")\n\n    @miru.button(emoji=\"\\N{BLACK SQUARE FOR STOP}\", style=hikari.ButtonStyle.DANGER, row=1)\n    async def stop_button(self, ctx: miru.ViewContext, button: miru.Button) -> None:\n        self.stop() # Stop listening for interactions\n\n\n@bot.listen()\nasync def buttons(event: hikari.GuildMessageCreateEvent) -> None:\n\n    # Ignore bots or webhooks pinging us\n    if not event.is_human:\n        return\n\n    me = bot.get_me()\n\n    # If the bot is mentioned\n    if me.id in event.message.user_mentions_ids:\n        view = MyView()  # Create a new view\n        # Send the view as message components\n        await event.message.respond(\"Rock Paper Scissors!\", components=view)\n        client.start_view(view) # Attach to the client & start it\n\nbot.run()\n```\n\nTo get started with `miru`, see the [documentation](https://miru.hypergonial.com), or the [examples](https://github.com/hypergonial/hikari-miru/tree/main/examples).\n\n## Extensions\n\nmiru has two extensions built-in:\n\n- [`ext.nav`](https://miru.hypergonial.com/guides/navigators/) - To make it easier to build navigators (sometimes called paginators).\n- [`ext.menu`](https://miru.hypergonial.com/guides/menus/) - To make it easier to create nested menus.\n\nCheck the corresponding documentation and the [examples](https://github.com/hypergonial/hikari-miru/tree/main/examples) on how to use them.\n\n## Issues and support\n\nFor general usage help or questions, see the `#miru` channel in the [hikari discord](https://discord.gg/hikari), if you have found a bug or have a feature request, feel free to [open an issue](https://github.com/hypergonial/hikari-miru/issues/new)!\n\n## Contributing\n\nSee [Contributing](./CONTRIBUTING.md)\n\n## Links\n\n- [**Documentation**](https://miru.hypergonial.com)\n- [**Examples**](https://github.com/hypergonial/hikari-miru/tree/main/examples)\n- [**License**](https://github.com/hypergonial/hikari-miru/blob/main/LICENSE)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An alternative component handler for hikari, inspired by discord.py's views.",
    "version": "4.2.0",
    "project_urls": {
        "Homepage": "https://github.com/hypergonial/hikari-miru"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a72108aaaafba09d193898ba296d2903d16f6cef696ff6770a7626e613e6aff4",
                "md5": "2fd5c2ac78c28463a1c70053c8612d98",
                "sha256": "0a9e25cea76b6dbf6ec0efd64ac2f0b0a4c51de31a19bc6c101779c5ca06ea80"
            },
            "downloads": -1,
            "filename": "hikari_miru-4.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2fd5c2ac78c28463a1c70053c8612d98",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.10.0",
            "size": 90612,
            "upload_time": "2024-10-08T16:30:19",
            "upload_time_iso_8601": "2024-10-08T16:30:19.143400Z",
            "url": "https://files.pythonhosted.org/packages/a7/21/08aaaafba09d193898ba296d2903d16f6cef696ff6770a7626e613e6aff4/hikari_miru-4.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2dced97375fa52eaf9c66639e97b0dfb528a1f9cc38c982efa667e4e57bd69da",
                "md5": "39526b57cefc526213186baae94e90b0",
                "sha256": "1bb6737c7f1fe062ab0d7b357b9b447de2e84e9cea27b8bb826f66f307abb8a0"
            },
            "downloads": -1,
            "filename": "hikari_miru-4.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "39526b57cefc526213186baae94e90b0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.10.0",
            "size": 52243,
            "upload_time": "2024-10-08T16:30:20",
            "upload_time_iso_8601": "2024-10-08T16:30:20.863526Z",
            "url": "https://files.pythonhosted.org/packages/2d/ce/d97375fa52eaf9c66639e97b0dfb528a1f9cc38c982efa667e4e57bd69da/hikari_miru-4.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-08 16:30:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hypergonial",
    "github_project": "hikari-miru",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "hikari-miru"
}
        
Elapsed time: 0.30675s