https://github.com/HuyaneMatsu/hata
Async Discord API wrapper.
https://github.com/HuyaneMatsu/hata
api api-wrapper async bot discord discord-api discord-api-wrapper hata python scarletio slash-commands
Last synced: about 1 month ago
JSON representation
Async Discord API wrapper.
- Host: GitHub
- URL: https://github.com/HuyaneMatsu/hata
- Owner: HuyaneMatsu
- License: other
- Created: 2019-12-18T15:58:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-05T10:06:58.000Z (6 months ago)
- Last Synced: 2024-10-05T10:19:18.960Z (6 months ago)
- Topics: api, api-wrapper, async, bot, discord, discord-api, discord-api-wrapper, hata, python, scarletio, slash-commands
- Language: Python
- Homepage: https://www.astil.dev/project/hata/
- Size: 26.8 MB
- Stars: 179
- Watchers: 6
- Forks: 21
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- discord-api-libs - hata - Async Discord API wrapper. (Libraries / Python)
- awesome-discord - hata
README
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
.
AboutHata is an *asynchronous* [Discord API](https://discord.com/developers/docs/intro) 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](https://en.touhouwiki.net/wiki/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.
UsageSimple example implementing a `ping` command.
```py
from hata import Client, Guild, wait_for_interruptionGUILD = 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()
```*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.*
InstallationTo install Hata simply do
```shell
# 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
- Python >= 3.6
- [chardet](https://pypi.python.org/pypi/chardet) / [cchardet](https://pypi.org/project/cchardet/)#### Optional
- [dateutil](https://pypi.org/project/python-dateutil/)
- [PyNaCl](https://pypi.org/project/PyNaCl/) (for voice support)
Get in touchIf you have issues, suggestions, want to contribute, or just want to hang out, join our discord server.
AcknowledgementsShout-Out to our brave testers who are helping the most to improve Hata!
- [`Koish`](https://github.com/UnconsciousPebble) \[Feature requests\]
- [`BrainDead`](https://github.com/albertopoljak) \[Documentation improvements\]