Example #1
0
def yuyo_docs_command(
    ctx: tanjun.abc.Context,
    component_client: alluka.Injected[yuyo.ComponentClient],
    index: typing.Annotated[DocIndex, alluka.inject(callback=yuyo_index)],
    **kwargs: typing.Any,
) -> _CoroT[None]:
    return _docs_command(ctx, component_client, index, YUYO_PAGES, YUYO_PAGES + "/master/", "Yuyo", **kwargs)
Example #2
0
    async def _autocomplete(
        ctx: tanjun.abc.AutocompleteContext,
        value: str,
        # Annotated can't be used here cause forward annotations
        index: _DocIndexT = alluka.inject(callback=get_index),
    ) -> None:
        """Autocomplete strategy."""
        if not value:
            return

        await ctx.set_choices({entry.qualname: entry.qualname for entry, _ in zip(index.search(value), range(25))})
Example #3
0
def docs_hikari_command(
    ctx: tanjun.abc.Context,
    component_client: alluka.Injected[yuyo.ComponentClient],
    index: typing.Annotated[HikariIndex, alluka.inject(callback=hikari_index)],
    **kwargs: typing.Any,
) -> _CoroT[None]:
    """Search Hikari's documentation.

    Arguments
        * path: Optional argument to query Hikari's documentation by.
    """
    return _docs_command(
        ctx, component_client, index, HIKARI_PAGES, HIKARI_PAGES + "/hikari/", "Hikari", desc_splitter=".", **kwargs
    )