Yami
A command handler that complements Hikari. <3
Disclaimer
Still in early development. See the TODO list.
Documentation
Getting started with Yami
Stable release
pip install yami
Development
pip install git+https://github.com/Jonxslays/Yami.git
Creating a Bot
import asyncio
import datetime
import functools
import os
import typing
import hikari
import yami
bot = yami.Bot(os.environ["TOKEN"], prefix="$")
# Can only be run in guilds.
@yami.is_in_guild()
@bot.command("add", "Adds 2 numbers", aliases=["sum"])
async def add_cmd(ctx: yami.MessageContext, num1: int, num2: int) -> None:
# Basic builtin python types are converted for you using their type
# hints (int, float, bool, complex, bytes). More types coming soon™.
await ctx.respond(f"The sum is {num1 + num2}")
# Can only be run by members with one of these roles.
@yami.has_any_role("Admin", "Fibonacci")
@bot.command("fibonacci", aliases=("fib",))
async def fibonacci(ctx: yami.MessageContext, num: int) -> None:
"""Calculates the num'th term in the fibonacci sequence."""
calc: typing.Callable[[int], int] = functools.lru_cache(
lambda n: n if n < 2 else calc(n - 1) + calc(n - 2)
)
# Though we cache the function call, let's simulate thinking.
async with ctx.trigger_typing():
await asyncio.sleep(0.75)
# Make a pretty embed.
await ctx.respond(
hikari.Embed(
title=f"Fibonacci calculator",
description=f"```{calc(num)}```",
color=hikari.Color(0x8AFF8A),
timestamp=datetime.datetime.now(tz=datetime.timezone.utc),
)
.set_footer(f"Term {num}")
.set_author(
name=(author := ctx.author).username,
icon=author.avatar_url or author.default_avatar_url,
)
)
if __name__ == "__main__":
bot.run()
TODO
:heavy_check_mark: Complete
- CI
- Testing (WIP)
- Fully typed
- Bot
- Message Commands
- Message Subcommands
- Message Context
- Modules
- Exceptions (WIP)
- Checks (WIP)
- Basic arg parsing (builtin types)
- Docs
- Events (Mostly)
:x: Incomplete
- Module listeners
- Hooks?
- Slash Commands
- Slash Context
- Converters (WIP)
- Utils (WIP)
- Full blown arg parsing (hikari types)
- QOL methods (WIP)
- Logging (WIP)
Contributing
Yami is open to contributions. To get started check out the contributing guide.
License
Yami is licensed under the GPLV3 license.
Metadata
Release files for yami 0.4.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 | Actions |
|---|---|---|---|---|
| Yami-0.4.1.tar.gz | 37.2 kB | Without provenance | Details for Yami-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Yami-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for Yami-0.4.1-py3-none-any.whl |
Total release size: 83.3 kB
Release files / Yami-0.4.1.tar.gz
| Download URL | Yami-0.4.1.tar.gz |
|---|---|
| Size | 37.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c60be969a9df406b1eea0b0dbd37dd5bc5312a04a4f185e88685b9701e9e25e
|
|
BLAKE2b-256 checksum How to use checksums |
96bad16f73ee2426ddb58bcf07743ae43db46b5c834e5980e447f73fa450f65e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.8.2 Linux/5.13.0-1022-azure
|
Release files / Yami-0.4.1-py3-none-any.whl
| Download URL | Yami-0.4.1-py3-none-any.whl |
|---|---|
| Size | 46.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6bf9848b6fde0fbdcdfe0b81a03bd69dad92899573ff66fe5288939bb04adf13
|
|
BLAKE2b-256 checksum How to use checksums |
f47b125ea930f0690d869cd379f342fb1b6db3cfeb0b7931090df14d938d1c19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.8.2 Linux/5.13.0-1022-azure
|
Security for yami 0.4.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.