An advanced yet easy-to-use clustering tool for Hikari.
Project description
hikari-clusters
hikari-clusters allows you to scale your Discord bots horizontally by using multiprocessing and websockets. This means that your bot can use multiple cores, as well as multiple VPSes.
See the #clusters channel in the hikari-py discord for help.
# brain.py
from hikari_clusters import Brain
Brain(
host="localhost",
port=8765,
token="ipc token",
total_servers=1,
clusters_per_server=2,
shards_per_cluster=3,
).run()
# server.py
from hikari import GatewayBot
from hikari_clusters import Cluster, ClusterLauncher, Server
class MyBot(GatewayBot):
cluster: Cluster
def __init__(self):
super().__init__(token="discord token")
# load modules & events here
Server(
host="localhost",
port=8765,
token="ipc token",
cluster_launcher=ClusterLauncher(MyBot),
).run()
Run examples with python -m examples.<example name>
(python -m examples.basic
)
Creating Self-Signed Certificate:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout cert.key -out cert.cert && cat cert.key cert.cert > cert.pem
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
hikari_clusters-1.1.4.tar.gz
(17.0 kB
view hashes)
Built Distribution
Close
Hashes for hikari_clusters-1.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14a8fe70231292708de1a38f47995bb53943fd25683ede8d2ca45b8360d21480 |
|
MD5 | ca143611b224264ca1bfb17626bc62c2 |
|
BLAKE2b-256 | 18669387a2b5baf70bc9c05851a80c5a18b81f50b2d43ff641a8b47bd69e3134 |