All Projects → HuyaneMatsu → hata

HuyaneMatsu / hata

Licence: other
Async Discord API wrapper.

Programming Languages

python
139335 projects - #7 most used programming language
Markdown
49 projects

Projects that are alternatives of or similar to hata

DPP
C++ Discord API Bot Library - D++ is Lightweight and scalable for small and huge bots!
Stars: ✭ 560 (+258.97%)
Mutual labels:  discord-api, api-wrapper, discord-api-wrapper
gencord
A simple, beginner-friendly, and easy-to-use library for interacting with the Discord API, with minimal syntax.
Stars: ✭ 20 (-87.18%)
Mutual labels:  discord-api, slash-commands, discord-api-wrapper
slshx
⚔️ Strongly-typed Discord commands on Cloudflare Workers
Stars: ✭ 163 (+4.49%)
Mutual labels:  discord-api, slash-commands
Clamor
The Python Discord API Framework
Stars: ✭ 14 (-91.03%)
Mutual labels:  discord-api, discord-api-wrapper
dislash.py
A Python wrapper for discord slash-commands and buttons, designed to extend discord.py.
Stars: ✭ 172 (+10.26%)
Mutual labels:  discord-api, slash-commands
Diskord
[Mirror of GitLab] A Kotlin client for Discord with a light wrapper on the REST APIs and a simple to use DSL for basic bots.
Stars: ✭ 146 (-6.41%)
Mutual labels:  discord-api, discord-api-wrapper
nextcord
A Python wrapper for the Discord API forked from discord.py
Stars: ✭ 956 (+512.82%)
Mutual labels:  discord-api, api-wrapper
hikari
A Discord API wrapper for Python and asyncio built on good intentions.
Stars: ✭ 631 (+304.49%)
Mutual labels:  discord-api, slash-commands
Disqord
An asynchronous Discord API wrapper for .NET.
Stars: ✭ 155 (-0.64%)
Mutual labels:  discord-api, discord-api-wrapper
nyxx
Wrapper around Discord API for Dart
Stars: ✭ 217 (+39.1%)
Mutual labels:  discord-api, api-wrapper
DiscordBot-Template
A boilerplate / template for discord.js bots with 100% coverage of Discord API, command handler, error handler based on https://discordjs.guide/
Stars: ✭ 129 (-17.31%)
Mutual labels:  discord-api, slash-commands
discord.bat
🗑️ the BEST discord lib
Stars: ✭ 38 (-75.64%)
Mutual labels:  discord-api, api-wrapper
acord
An API wrapper for discord, built using aiohttp and pydantic.
Stars: ✭ 25 (-83.97%)
Mutual labels:  discord-api, api-wrapper
slash-commands
slash commands handler to make your bot support slash commands.
Stars: ✭ 59 (-62.18%)
Mutual labels:  discord-api, slash-commands
MaSH
A minimalistic Discord API wrapper made in Posix Shell
Stars: ✭ 22 (-85.9%)
Mutual labels:  discord-api, discord-api-wrapper
discljord
A Clojure wrapper library for the Discord API, with full API coverage (except voice, for now), and high scalability
Stars: ✭ 179 (+14.74%)
Mutual labels:  discord-api, discord-api-wrapper
hikari-lightbulb
The official unofficial command handler for the Python discord API wrapper library, Hikari.
Stars: ✭ 152 (-2.56%)
Mutual labels:  discord-api, api-wrapper
Dis-Snek
A Python API wrapper for Discord
Stars: ✭ 71 (-54.49%)
Mutual labels:  discord-api, api-wrapper
Lenoxbot
🖥️ LenoxBot is a Discord bot that offers many cool new features to your Discord server!
Stars: ✭ 163 (+4.49%)
Mutual labels:  discord-api
Raid Toolbox
Raid ToolBox (RTB) is a big toolkit of Spamming/Raiding/Token management tools for discord.
Stars: ✭ 211 (+35.26%)
Mutual labels:  discord-api

Hata

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

Support Guild | Topical documentation | Examples | Technical documentation | Source


New hata versions use Discord API V10 .

About

Hata is an asynchronous Discord API wrapper built on top of scarletio. It is designed to be easy to use, with also providing rich API offering everything what an advanced developer might need.

Named after Hata no Kokoro from Touhou Project.

Why hata?

  • Multiple simultaneous clients

    Hata can run multiple clients from the same instance without sacrificing performance.

  • 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.

Usage

The following example answers on ping message.

from hata import Client, wait_for_interruption

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.bot:
        return
    
    if message.content == 'ping':
        await client.message_create(message.channel, 'pong')

Nue.start()

wait_for_interruption()

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

from hata import Client, wait_for_interruption

Saki = Client('TOKEN', extensions = 'commands_v2', 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()

wait_for_interruption()

Or use slash commands!

from hata import Client, Guild, wait_for_interruption

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()

wait_for_interruption()

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.

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.

Sometimes leaving the main thread might cause problems when trying to shut down the bot(s). At this case, you might want to use wait_for_interruption(), which disconnects the clients gracefully and closes the event loop on keyboard interrupt.

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 hang out, join our discord server.

Invite

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]]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].