Getting Started with Hikari#

What is Hikari?#

Hikari is a static typed Python3 framework for working with the Discord RESTApi and Gateway.

The library focuses on being extendable and reusable, rather than an obstacle for future development.


Currently supported python versions: 3.8, 3.9, 3.10

Github Repository: https://github.com/hikari-py/hikari

Documentation: https://www.hikari-py.dev/hikari/index.html

Support Server: https://discord.com/invite/Jx4cNGG


Installation#

Linux/MacOS

$python -m pip install -U hikari

Windows

> py -3 pip install -U hikari

Basic Example#

import hikari  # importing the hikari library.

intents = hikari.Intents(
    hikari.Intents.ALL_UNPRIVILEGED | hikari.Intents.MESSAGE_CONTENT
)  # defining the intents to be used for the bot. It's set to `hikari.Intents.ALL_UNPRIVILEGED` by default.
bot = hikari.GatewayBot("bot token here", intents=intents,)  # creating a GatewayBot class instance which will be used to recieve events from the discord gateway.

@bot.listen()
async def message_created(event: hikari.MessageCreateEvent) -> None:
    """
    A simple MessageCreateEvent which sends Pong as a response for !ping.
    """

    if event.message.content == "!ping":
        await event.message.respond("Pong")


bot.run()  # calling the run function to run the bot.