Pycord IPC
High-performance inter-process communication library designed to work with the latest version of Pycord
This library is based on Better-IPC.
Installation
Stable version
For Linux
python3 -m pip install -U pycord-ipc
For Windows
py -m pip install -U pycord-ipc
Examples
Client example
import asyncio
import websockets
import discord
from discord.ext import commands
from ipc.server import Server
from ipc.objects import ClientPayload
intents = discord.Intents.all()
bot = discord.Bot(intents=intents)
ipc = Server(bot, secret_key="🐼")
@bot.event
async def on_ready():
print(f'Logged in as {bot.user.name}')
@Server.route()
async def get_user_data(self,data: ClientPayload):
user = bot.get_user(int(data.user_id))
return user._to_minimal_user_json()
async def main():
await ipc.start()
await bot.start('BOT_TOKEN')
if __name__ == "__main__":
asyncio.run(main())
Cog example
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 Routes(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
self.ipc = ipc.Server(self.bot, secret_key="🐼")
@commands.Cog.listener()
async def on_ready(self):
await self.ipc.start()
@Server.route()
async def get_user_data(self, data: ClientPayload):
user = self.get_user(int(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('/user/<user>')
async def main(user):
resp = await ipc.request("get_user_data", user_id=user)
return str(resp.response)
if __name__ == '__main__':
app.run()
Metadata
Release files for Pycord-IPC 1.0.1
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 |
|---|---|---|---|---|
| Pycord-IPC-1.0.1.tar.gz | 20.4 kB | Without provenance | Details for Pycord-IPC-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Pycord_IPC-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for Pycord_IPC-1.0.1-py3-none-any.whl |
Total release size: 41.9 kB
Release files / Pycord-IPC-1.0.1.tar.gz
| Download URL | Pycord-IPC-1.0.1.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a8fa26bcb3309521c059dbf16c70032906b5604ad36b02f519acfbc2cc149da
|
|
BLAKE2b-256 checksum How to use checksums |
9d4efcad1422804ffb1d11c4cb79bdeaef4bd0664bfeec36bbbb030da6ba4e06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / Pycord_IPC-1.0.1-py3-none-any.whl
| Download URL | Pycord_IPC-1.0.1-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11c92b8ce3757663d9dee42ee5d2ccedb4c869af9c9bf77b54b93751b1bd57a2
|
|
BLAKE2b-256 checksum How to use checksums |
9ef753f9d5ecfd39558848029c81b517eff9fc06a41e7a3b9444dc33393dc2f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for Pycord-IPC 1.0.1
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.