A sane Discord API for Python 3 built on asyncio and good intentions
Project description
Note: this API is still under active daily development, and is in a pre-alpha stage. If you are looking to give feedback, or want to help us out, then feel free to join our Discord server and chat to us. Any help is greatly appreciated, no matter what your experience level may be! :-)
hikari.py
An opinionated Discord API for Python 3 and asyncio. Built on good intentions and the hope that it will be extendable and reusable, rather than an obstacle.
import hikari
bot = hikari.StatelessBot(config=hikari.BotConfig(token="..."))
@bot.on()
async def ping(event: hikari.MessageCreateEvent) -> None:
if not event.author.is_bot and event.content.startswith("hk.ping"):
await bot.rest.create_message(event.channel_id, content="Pong!")
bot.run()
And if that is too verbose, this will be actively reduced with the functionality provided by the Stateful bot implementation coming soon!
What does hikari aim to do?
- Provide 100% documentation for the entire library. Build your application bottom-up or top-down with comprehensive documentation as standard.
- Ensure all components are reusable. Most people want a basic framework for writing a bot, and hikari will provide that. However, if you decide on a bespoke solution using custom components, such as a Redis state cache, or a system where all events get put on a message queue, then hikari provides the conduit to make that happen.
- Automate testing as much as possible. You don't want to introduce bugs into your bot with version updates, and neither do we. hikari aims for 100% test coverage as standard. This significantly reduces the amount of bugs and broken features that appear in library releases -- something most Python Discord libraries cannot provide any guarantee of.
- Small improvements. Regularly. Discord is known for pushing sudden changes to their public APIs with little or no warning. When this happens, you want a fix, and quickly. You do not want to wait for weeks for a usable solution to be released. hikari is developed using a fully automated CI pipeline with extensive quality assurance. This enables bugfixes and new features to be shipped within 30 minutes, not 30 days.
What does hikari currently support?
Library features
hikari has been designed with the best practises at heart to allow developers to freely contribute and help the library grow. This is achieved in multiple ways.
- Modular, reusable components.
- Extensive documentation.
- Full type-checking.
- Minimal dependencies.
- Full unit test suite.
Network level components
The heart of any application that uses Discord is the network layer. hikari exposes all of these components with full documentation and with the ability to reuse them in as many ways as you can think of.
Most mainstream Python Discord APIs lack one or more of the following features. hikari aims to implement each feature as part of the design, rather than an additional component. This enables you to utilize these components as a black box where necessary.
- Low level REST API implementation.
- Low level gateway websocket shard implementation.
- Rate limiting that complies with the
X-RateLimit-Bucket
header properly. - Gateway websocket ratelimiting (prevents your websocket getting completely invalidated).
- Intents
- Proxy support for websockets and REST API.
- File IO that doesn't block you.
High level components
- Stateless, object-oriented bot API. Serve thousands of servers on little memory.
- Sensible, type-safe event dispatching system that is reactive to type annotations, and supports PEP-563 without broken hacks and bodges.
- Models that extend the format provided by Discord, not fight against it. Working as close to the original format of information provided by Discord as possible ensures that minimal changes are required when a breaking API design is introduced. This reduces the amount of stuff you need to fix in your applications as a result.
- REST only API functionality. Want to write a web dashboard? Feel free to just reuse the REST client components to achive that!
Stuff coming soon
- Optional, optimised C implementations of internals to give large applications a well-deserved performance boost.
- Voice support.
- Stateful bot support (intents will be supported as first-class citizens).
Planned extension modules for the future
- Command framework (make commands and groups with the flick of a wrist).
- Optional dependency injection tools (declare what components you want in your application, and where you want them. Let hikari work out how to put it together!)
- Full voice transcoding support, natively in your application. Do not rely on invoking ffmpeg in a subprocess ever again!
Getting started
This section is still very bare, and we are still actively writing this framework every day. Why not pop in and say hi? More comprehensive tutorials will be provided soon!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hikari-1.0.1.dev75.tar.gz
.
File metadata
- Download URL: hikari-1.0.1.dev75.tar.gz
- Upload date:
- Size: 176.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fa7b19dd72a607f87e9589b979082046c60da384255e0da946834581af02418 |
|
MD5 | 37684057759029174b6d2d140459e60b |
|
BLAKE2b-256 | c1f6a06e64b02e94474b375e0ac5f17f3ad6d65aa14702e3335920e4c1a48627 |
File details
Details for the file hikari-1.0.1.dev75-py3-none-any.whl
.
File metadata
- Download URL: hikari-1.0.1.dev75-py3-none-any.whl
- Upload date:
- Size: 225.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92f611a216be39c8e6c864f4c3e26bb68d5079879b99bcdbc0e54ee11a554142 |
|
MD5 | 39822373bf78ebc0317f4feb693a6ac9 |
|
BLAKE2b-256 | 5d71b383448c5394222cf3ff3e6db9d357e9bcc76561024b3f432253ad707e29 |