Skip to main content

Handler for DiSwarm

Project description

DiSwarm Handler

Basic DiSwarm bot handling class, and standardized communication protocol

Usage

Main class: Handler(channel, token, swarm_id, bot_id, lead_timeout=5, role=None) Channel: Discord server channel to run swarm in Token: Discord bot token Swarm_id: Unique id of entire swarm Bot_id: Unique id of bot Lead_timeout: Seconds before bot declares itself swarm leader Role: Role in swarm. Changing this from None overrides leader/drone selection.

Subclass this, and redefine the function process_one(self, response) to perform different tasks based on input. This is much like the socketserver.BaseRequestHandler.handle() method.

Other functions: request(req, args=()) Requests data from swarm. Req: Request text Args: tuple of arguments to pass to swarm

process(): Processes swarm queue and returns list of process_one() outputs

Notes

  • Swarm ID: the same for all bots in your swarm, but it should be unique from any other swarm, at least on your swarm channel. To be safe, use a randomly generated string or number. Make sure every bot in your swarm has the same id, because bots with different ids cannot see eachother's messages.

Requires

  • pip install DiSwarm (Will install all dependencies

As an alternative, run pip install diswarm-handler to download this and all dependencies.

Project details


Release history Release notifications | RSS feed

This version

1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diswarm-handler-1.1.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

diswarm_handler-1.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file diswarm-handler-1.1.tar.gz.

File metadata

  • Download URL: diswarm-handler-1.1.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.5.4

File hashes

Hashes for diswarm-handler-1.1.tar.gz
Algorithm Hash digest
SHA256 577f71d4aa4a46ef0ad90d6977d013bfcb1ccbf43713f9a26378bbcd398bd34f
MD5 9c3254c4730d675bcfb06ff468c59c2f
BLAKE2b-256 94411284e10391b32b012103b005cf803cdee699f15a5c2c450bc2b66e6b7477

See more details on using hashes here.

File details

Details for the file diswarm_handler-1.1-py3-none-any.whl.

File metadata

  • Download URL: diswarm_handler-1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.5.4

File hashes

Hashes for diswarm_handler-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a3d43879c9ec8ef7afcde503ddba3c82af3d152d2972d4d1b208fa40ccf10ba
MD5 ebbf01acc76fcd9471eee158e265a05c
BLAKE2b-256 e133afe2752482cc133c2c7d2c48c7bfa23126af319755cce45e898171284240

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