Skip to main content

A powerful asynchronous library for creating Discord bots in Python.

Project description

Hata

A blazing fast Discord API wrapper that you can't deny

Support | Documentation | Source

About

Hata is an async Discord API wrapper written in Python named after Hata no Kokoro.

Why hata?

  • Multiple simultaneous clients

    Hata can run multiple clients from the same instance without sacrificing performance, all while being easy to code.

  • Performant

    Fast concurrent code based on async/await paradigm with cache control, PyPy support and much more!

  • Newest API features

    Whatever Discord decides to release/update/break Hata will support it natively in no time!

  • 100% Python

    Built in Python! Easy to code, easy to read, easy to maintain.

Why not hata?

  • Small community

    Hata has a small but, slowly growing community. The chance of getting help outside of our cosy discord server equals to zero.

Documentation

The library reference is available here & the tutorials are available here.

Usage

The following example answers on ping message.

from hata import Client

Nue = Client('TOKEN')

@Nue.events
async def ready(client):
    print(f'{client:f} logged in.')

@Nue.events
async def message_create(client, message):
    if message.author.is_bot:
        return

    if message.content == 'ping':
        await client.message_create(message.channel, 'pong')

Nue.start()

An improved example using the commands extension to handle common use cases.

from hata import Client

Saki = Client('TOKEN', extensions='commands', prefix='s!')

@Saki.events
async def ready(client):
    print(f'{client:f} logged in.')

@Saki.commands
async def ping(client, message):
    return 'pong'

Saki.start()

Or use slash commands!

from hata import Client, Guild

GUILD = Guild.precreate(guild_id)

Seija = Client('TOKEN', extensions='slash')

@Seija.events
async def ready(client):
    print(f'{client:f} logged in.')

@Seija.interactions(guild=GUILD)
async def ping():
    """ping-pong"""
    return 'pong'

Seija.start()

Note: You need to restart your client, or the slash command wont show up. If there are more than 50 integrations (bots) in a guild, some of the (integrations) bots wont be able to use slash commands. This is currently a Discord limitation.

If you are wondering, how to start more clients, just put the two code snippet into the same file.

Hata leaves the main thread free, client.start() blocks it only till the client logs in (or fails it), although you can still use the start_clients function, what as it says, starts up all the non-running clients parallelly, so go ahead and start python with -i option, then interact with the clients from your interactive console in runtime.

Installation

To install Hata simply do

# Linux/OS X
$ python3 -m pip install hata

# Windows
$ python -m pip install hata

# Voice Support
$ python -m pip install hata[voice]

And you are good to go! Hata has native pypy support as well if you need some more speed!

Dependencies

Requirements

Optional

Get in touch

If you have issues, suggestions, want to contribute, or just want to send cute neko pictures, join our discord server.

Acknowledgements

Shout-Out to our brave testers, who are helping the most to improve Hata!

  • Nekosia [Grammar]
  • Proxisha [Feature requests & Bug hunting]
  • Hime Esuto [Bug hunting]
  • BrainDead [Documentation improvements]
  • Zeref [Features & Typos & Bug hunting]
  • vinam [Bug hunting[asyncio extension]]

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

hata-1.1.117.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hata-1.1.117-py3-none-any.whl (1.6 MB view details)

Uploaded Python 3

File details

Details for the file hata-1.1.117.tar.gz.

File metadata

  • Download URL: hata-1.1.117.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.10

File hashes

Hashes for hata-1.1.117.tar.gz
Algorithm Hash digest
SHA256 630b9854d70e7bcc29210f8a0b537d4148a3762f74be405aef8743036212fc9d
MD5 30e0d53f021d3384b7bc0fea84dde483
BLAKE2b-256 1cf94973a85af8ba18badd39bba1f8d80c687963d955be963405fc6ec7cf87e1

See more details on using hashes here.

File details

Details for the file hata-1.1.117-py3-none-any.whl.

File metadata

  • Download URL: hata-1.1.117-py3-none-any.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.10

File hashes

Hashes for hata-1.1.117-py3-none-any.whl
Algorithm Hash digest
SHA256 8268ffbeeb34a755e4c8106519c497ef81461c58ff64a8f5ba5e42e65f25a80c
MD5 a392ff683442a268f3b22030aed8beeb
BLAKE2b-256 ecb77b7c0ec22e8fbb575f1b483b0fbeb004e5a57eea418100f570d95e2fe64c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page