hikari-miru
A component handler for hikari, aimed at making the creation & management of Discord UI components easy.
[!TIP] Like what you see? Check out arc, a command handler with a focus on type-safety and correctness.
Installation
To install miru, run the following command:
pip install -U hikari-miru
To check if miru has successfully installed or not, run the following:
python3 -m miru
# On Windows you may need to run:
py -m miru
Usage
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, or the examples.
Extensions
miru has two extensions built-in:
ext.nav- To make it easier to build navigators (sometimes called paginators).ext.menu- To make it easier to create nested menus.
Check the corresponding documentation and the examples on how to use them.
Issues and support
For general usage help or questions, see the #miru channel in the hikari discord, if you have found a bug or have a feature request, feel free to open an issue!
Contributing
See Contributing
Links
Metadata
Release files for hikari-miru 4.3.1
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 | |
|---|---|---|---|---|
| hikari_miru-4.3.1.tar.gz | 365.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hikari_miru-4.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 455.3 kB
Release files / hikari_miru-4.3.1.tar.gz
| Download URL | hikari_miru-4.3.1.tar.gz |
|---|---|
| Size | 365.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
923298d8a6bd5c1c7d8c8a9e33a8faf3cd6dc889787017c48383b00dffd2359f
|
|
BLAKE2b-256 checksum How to use checksums |
22bb451546aac01fdd6246d82a5d8117c57e5e3c26593bd32a6fe4b28afbee2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / hikari_miru-4.3.1-py3-none-any.whl
| Download URL | hikari_miru-4.3.1-py3-none-any.whl |
|---|---|
| Size | 90.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e315d3096b549466c83cafd7f40d543ca865fd64b5d24c2b8b0952329288c7ed
|
|
BLAKE2b-256 checksum How to use checksums |
e099cd84e841a9b215f18839086823eca38744cf107938792d862034d9370b71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for hikari-miru 4.3.1
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.