Better IPC
High-performance inter-process communication library designed to work with the latest version of discord.py
This library is based on discord-ext-ipc, which is no longer maintained.
Installation
Stable version
For Linux
python3 -m pip install -U better-ipc
For Windows
py -m pip install -U better-ipc
Development version
For Linux
python3 -m pip install -U git+https://github.com/MiroslavRosenov/better-ipc
For Windows
py -m pip install -U git+https://github.com/MiroslavRosenov/better-ipc
Support
Examples
Client example
import discord
from typing import Dict
from discord.ext import commands, ipc
from discord.ext.ipc.server import Server
from discord.ext.ipc.objects import ClientPayload
class MyBot(commands.Bot):
def __init__(self) -> None:
intents = discord.Intents.all()
super().__init__(
command_prefix="$.",
intents=intents,
)
self.ipc = ipc.Server(self, secret_key="🐼")
async def setup_hook(self) -> None:
await self.ipc.start()
@Server.route()
async def get_user_data(self, data: ClientPayload) -> Dict:
user = self.get_user(data.user_id)
return user._to_minimal_user_json()
Cog example
from typing import Dict
from discord.ext import commands, ipc
from discord.ext.ipc.server import Server
from discord.ext.ipc.errors import IPCError
from discord.ext.ipc.objects import ClientPayload
class Routes(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
if not hasattr(bot, "ipc"):
bot.ipc = ipc.Server(self.bot, secret_key="🐼")
async def cog_load(self) -> None:
await self.bot.ipc.start()
async def cog_unload(self) -> None:
await self.bot.ipc.stop()
self.bot.ipc = None
@Server.route()
async def get_user_data(self, data: ClientPayload) -> Dict:
user = self.bot.get_user(data.user_id)
return user._to_minimal_user_json()
async def setup(bot):
await bot.add_cog(Routes(bot))
Inside your web application
from quart import Quart
from discord.ext.ipc import Client
app = Quart(__name__)
ipc = Client(secret_key="🐼")
@app.route('/')
async def main():
resp = await ipc.request("get_user_data", user_id=383946213629624322)
return str(resp.response)
if __name__ == '__main__':
app.run()
Metadata
Release files for better-ipc 2.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| better-ipc-2.0.3.tar.gz | 20.3 kB | Without provenance | Details for better-ipc-2.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| better_ipc-2.0.3-py3-none-any.whl | Python 3 | none | any | Details for better_ipc-2.0.3-py3-none-any.whl |
Total release size: 42.0 kB
Release files / better-ipc-2.0.3.tar.gz
| Download URL | better-ipc-2.0.3.tar.gz |
|---|---|
| Size | 20.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
000c19f279760e88361d06318b51f970a8bf916a1e45fd35a812570ee317cfc6
|
|
BLAKE2b-256 checksum How to use checksums |
e4c26d7a30eca8036e6bc67aa8fa8bb9fd73fd5a3740e7af5771e5761c979c8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / better_ipc-2.0.3-py3-none-any.whl
| Download URL | better_ipc-2.0.3-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dfb82c2497591d711f05c07b38e0886d6327d678d5e090c33174706c0ff0e5b1
|
|
BLAKE2b-256 checksum How to use checksums |
71db3bae8f4a2c267af670d935d6df9a7e2664522656b0423d7c4029b5435869
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for better-ipc 2.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.