A compatability shim between Discord.py and Hikari.
Project description
Usage:
import discord
import hikari
import hikari_shim
dpy_bot = discord.Client(intents=discord.Intents.all(), enable_debug_events=True)
hikari_bot = hikari.GatewayBot("TOKEN")
@dpy_bot.event
async def on_message(message):
if message.content == "discord.py is cool":
await message.channel.send("yes it is!")
@hikari_bot.listen(hikari.MessageCreateEvent)
async def hikari_on_message(evt):
if evt.content == "hikari is cool":
await evt.message.respond("yes it is!")
hikari_shim.partial_load(dpy_bot, hikari_bot)
dpy_bot.run("TOKEN")
There's also a full (?) shim, but it runs into loop issues and whatnot. It requires you to use a Hikari client with no intents and start both clients.
caveat emptor
- This does not work with
discord.AutoShardedClient
. - This has a peer dependency on discord.py, make sure to install that!
- There are some operations that are not shimmed (voice and chunking guild members, to be specific, because I do not know how to do them in dpy).
- Ratelimiting is not shared.
- You will have double the CPU usage and double the memory usage. (or something in that range).
- Some components may not have been started yet. (if you're using a non- standard client).
- You will get all the incompatibilities Discord.py gives. This means, for example, you cannot get thread events on dpy 1.7 even if Hikari has those.
- More, probably.
why though?
Incrementally rewrite your bot in a whole library. This means that you can have a total rewrite without people ever noticing (though they will, probably). Also, this lets you stick with discord.py while the Hikari community matures for some parts (though caveats still apply, so you'll want to have the entire bot in Hikari eventually).
contact me
You can find me in the Hikari Discord server.
Download from PyPI!
pip install hikari_shim
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_shim-1.0.3.tar.gz
.
File metadata
- Download URL: hikari_shim-1.0.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.26.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bedc7ad06ddc74ee52f41c7f195b542a32b2ae4f31bd49193f938685a5aa39c1 |
|
MD5 | bd4683fab62a17d2f349f85770573b73 |
|
BLAKE2b-256 | b7aa32545f2c88b325bebe9ca687e93ede909145ef7bd15049012dfdbdfc04d2 |
File details
Details for the file hikari_shim-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: hikari_shim-1.0.3-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.26.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33233bfbea02f933725da1408ef8c187c541e894ad6541b311a0d503e8449949 |
|
MD5 | 18b5984228afc6a24f1e4d8575b3cadf |
|
BLAKE2b-256 | d87befdd168f10a58b14aa02f30a41b2d3ffe885f1651771528373c64d75d212 |