An implementation of IPC using websockets.
Project description
Verox
Verox (inspired by discord-ext-ipc) is an implementation of IPC using websockets. It's designed to make dashboard development a lot easier and quicker. While it's aimed at the hikari community, it does not depend on it at all which means you can use it for any discord API wrapper you like.
Installation
pip install verox
Didn't work?
-
pip
is not inPATH
python -m pip install verox
-
Check if the path of your python executable matches the path of the interpreter you run your code with
In UNIX-like systems:which python
Usage
Verox is split into client-side and server-side. The client-side is usually the web app, the server-side is the bot.
The following example uses quart and hikari:
webapp.py
from quart import Quart
from verox import Client
app = Quart(__name__)
client = Client("your_secret_key")
@app.route("/")
async def home():
count = await client.request("guild_member_count", guild_id=1234567890)
return str(count)
@app.after_serving
async def close_client():
await client.close()
app.run(debug=True)
bot.py
import hikari
import verox
bot = hikari.GatewayBot(token="your_token", intents=hikari.Intents.ALL)
server = verox.Server("your_secret_key") #must match the secret key of your client
@verox.endpoint()
async def guild_member_count(context: verox.Context):
return len(bot.cache.get_members_view_for_guild(context.data.guild_id))
@bot.listen()
async def close_server(event: hikari.StoppingEvent):
await server.close()
server.start()
bot.run()
For more advanced examples, please take a look at examples and its README
Project details
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 verox-0.0.11.tar.gz
.
File metadata
- Download URL: verox-0.0.11.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a47eee78d6e389e65f71cefe01b19cc24ce9633b542fd9ae3b10df166dfff31 |
|
MD5 | 291f60e664142bf94b44ae17769175da |
|
BLAKE2b-256 | 5e56c9595f34604a716355d33c31c7b5d0e2db24a937396dcbac5e7f8ea5a536 |
File details
Details for the file verox-0.0.11-py3-none-any.whl
.
File metadata
- Download URL: verox-0.0.11-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e66f119012438733840032cfd0cae5db0bf3a3df835f73a77042e91e1050b7f6 |
|
MD5 | 0ea2ce6051336fd67c2a431db2aa7342 |
|
BLAKE2b-256 | 5772f05e684bdb4b5a1b12f68647d7c02018bc6cb03ae3ad6314648f56c38e5a |