Code Monkey home page Code Monkey logo

hikari-arc's Introduction

hikari-arc

PyPI CI Ruff Pyright

A command handler for hikari with a focus on type-safety and correctness.

Installation

To install arc, run the following command:

pip install -U hikari-arc

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

python3 -m arc
# On Windows you may need to run:
py -m arc

Note

hikari-arc requires a Python version of at least 3.10.

If you're just getting started, you may also use the template repository to get started with.

Basic Usage

import hikari
import arc

bot = hikari.GatewayBot("TOKEN") # or hikari.RESTBot
client = arc.GatewayClient(bot) # or arc.RESTClient

@client.include
@arc.slash_command("hi", "Say hi!")
async def ping(
    ctx: arc.GatewayContext,
    user: arc.Option[hikari.User, arc.UserParams("The user to say hi to.")]
) -> None:
    await ctx.respond(f"Hey {user.mention}!")

bot.run()

To get started with arc, see the documentation, or the examples.

Issues and support

For general usage help or questions, see the hikari discord, if you have found a bug or have a feature request, feel free to open an issue!

Contributing

See Contributing.

Acknowledgements

arc is in large part a combination of all the parts I like in other command handlers, with my own spin on it. The following projects have inspired me and aided me greatly in the design of this library:

Links

hikari-arc's People

Contributors

dependabot[bot] avatar hypergonial avatar mplatypus avatar pythontryhard avatar xemay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

hikari-arc's Issues

Add meta decorators

Summary

Add meta decorators to all commands, sub-commands, and plugins, and also, be able to attach them to the options, within a command.

Why is this needed?

This is needed because I will not stop bugging you to make it, and it would be useful for others.

Ideal implementation

Here is my idea:

Have some sort of basic decorator, like this:

@arc.add_metadata(arc.Metadata(example="beans"))

but then, if people want to make custom metadata, they can subclass arc.Metadata and add their arguments to it.

I have no idea, how adding them to an option would work, so I will leave that up to you, or we can have a talk about it idk.

Checklist

  • I have searched the issue tracker and have made sure it's not a duplicate. If it is a follow up of another issue, I have specified it.

Add bucket/cause to errors.MaxConcurrencyReachedError

Summary

Add an attribute to errors.MaxConcurrencyReachedError that stores which bucket (user/channel/guild/global) was reached

Why is this needed?

This attribute would allow people to create custom error messages instead of using a generic "maximum concurrency limit reached" message.

Ideal implementation

To be decided.

Checklist

  • I have searched the issue tracker and have made sure it's not a duplicate. If it is a follow up of another issue, I have specified it.

Globally set default_permissions per plugin

Summary

Pretty much be able to set default_permissions for the entire plugin rather than each individual command you add within that plugin.

Why is this needed?

Pretty much just removes the pain of adding default_permissions to every command.

Ideal implementation

ideally would be nice to just be able to set it within the implementation of a plugin like so

plugin = GatewayPlugin(name="admin_cmds", default_permissions=..)

Checklist

  • I have searched the issue tracker and have made sure it's not a duplicate. If it is a follow up of another issue, I have specified it.

Locale provider

Summary

Add the ability to attach a locale provider to the client which can be queried by commands for localizations.

Why is this needed?

It would provide a nicer interface for i18n.

Ideal implementation

Ideally a LocaleProvider or something similar would be provided to the client on initialization, and commands that are being added can then query the LocaleProvider to set their locale options. The user should also be able to query localization strings through the provider manually for creating localized responses.

Checklist

  • I have searched the issue tracker and have made sure it's not a duplicate. If it is a follow up of another issue, I have specified it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.