Websocket based IPC for discord.py bots
Project description
winerp
An IPC based on Websockets. Fast, Stable, and Reliable, perfect for communication between your processes or discord.py bots.
Installation
Stable:
pip install winerp
Main branch (can be unstable/buggy):
pip install git+https://www.github.com/BlackThunder01001/winerp
Working:
This library uses a central server for communication between multiple processes. You can connect a large number of clients for sharing data, and data can be shared between any connected client.
Example Usage:
Server Side:
import winerp
server = winerp.Server(port=8080)
server.start()
Client 1 (some-random-bot
):
import discord
from discord.ext.commands import Bot
import winerp
bot = Bot(command_prefix="!", intents=discord.Intents.all())
bot.ipc = winerp.Client(local_name = "some-random-bot", loop = bot.loop, port=8080)
@bot.command()
async def request(ctx):
# Fetching data from a client named "another-bot" using route "get_some_data"
data = await bot.ipc.request("get_some_data", source = "another-bot")
await ctx.send(data)
@bot.ipc.route()
async def get_formatted_data(user_id = None):
return f"<@{user_id}>"
@bot.ipc.event
async def on_winerp_ready():
print("Winerp Client is ready for connections")
bot.loop.create_task(bot.ipc.start())
bot.run("TOKEN")
Client 2 (another-bot
)
import discord
from discord.ext.commands import Bot
import winerp
bot = Bot(command_prefix="?", intents=discord.Intents.all())
bot.ipc = winerp.Client(local_name = "another-bot", loop = bot.loop, port=8080)
@bot.command()
async def format(ctx):
# Fetching data from a client named "some-random-bot" using route "get_formatted_data"
data = await bot.ipc.request("get_formatted_data", source = "some-random-bot", user_id = ctx.author.id)
await ctx.send(data)
@bot.ipc.route()
async def get_some_data():
return "You are very cool"
bot.loop.create_task(bot.ipc.start())
bot.run("TOKEN")
Features
- Fast: Minimum Response Time Recorded:
0.001s
. - Reliable, Stable and Easy to integrate.
- A single hosted server can be used to serve all clients on the machine.
- No limitation on number of connected clients.
- Inter bot-communication possible.
- Inter server-communication possible.
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
winerp-1.0.7.1.tar.gz
(7.8 kB
view details)
Built Distribution
File details
Details for the file winerp-1.0.7.1.tar.gz
.
File metadata
- Download URL: winerp-1.0.7.1.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bef72894df347e5732cef3cb7178dcbbd363f2b8652e27cf91aaa1154a3d4b5 |
|
MD5 | bf24be5154b0b52aaf6a95958655bac8 |
|
BLAKE2b-256 | 70bec11da4a8c6c3b3f0d9f05f4ff99ec5798d299039f593bdc81f59e2aa65d2 |
File details
Details for the file winerp-1.0.7.1-py3-none-any.whl
.
File metadata
- Download URL: winerp-1.0.7.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69118390e495de7ca600caddcf030f42e75f80adf1a2fd333dd327022d33412c |
|
MD5 | 059201244bed3e5d941f82900bfb6082 |
|
BLAKE2b-256 | 267d101573d89adb61e232d3de1f55034ab21836ce7fe730139e0870fcbd1b89 |