Skip to main content

An advanced yet easy-to-use clustering tool for Hikari.

Project description

hikari-clusters

pypi pre-commit.ci status

Documentation

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


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.2.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

hikari_clusters-1.2.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file hikari_clusters-1.2.0.tar.gz.

File metadata

  • Download URL: hikari_clusters-1.2.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.20 Linux/6.5.0-1025-azure

File hashes

Hashes for hikari_clusters-1.2.0.tar.gz
Algorithm Hash digest
SHA256 035505b285b4eb83eb64bc1cc3f86ba735be20b6ea42db25e3f82e0c50a5ad30
MD5 3fbe25e73b1ca606c5b3f27a0448aa27
BLAKE2b-256 ec7bb0b4161e1cfe72f95bb84c1dab0b05410385c21698fff042f09e62235a6b

See more details on using hashes here.

File details

Details for the file hikari_clusters-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: hikari_clusters-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.20 Linux/6.5.0-1025-azure

File hashes

Hashes for hikari_clusters-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c2defccac73250a0c27267704696d4f6ed2220b01a76b9da0f3730ea8a1ea9f
MD5 f6ff324430019c88c751d58c27379e75
BLAKE2b-256 9b371a572ec1793fe604c15e4da1e7c2803c14541f19ac755d1303a50786a4fb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page