Skip to main content

Beymax API

A high-level, functional-focused wrapper to discord.py

About

This package started off as a personal discord bot, but as it grew in scope, I found the need to add my own utilities on top of the wonderful discord.py by GitHub user Rapptz. Beymax aims to reduce the amount of boilerplate needed to create a functioning Discord bot, while also exposing an API which is familiar to those used to writing event-driven code.

Differences from discord.py

  • Essentially everything runs as an event listener. This includes tasks, commands, and context menus
    • Events now have 3 phases: For an event called event, subscribers to before:event are run first, then event, and finally after:event.
    • Events can be cancelled: Any listener to an event can call event.cancel() which will prevent any listeners in subsequent phases from being invoked. It does abort any listeners which have already ben called, such as other listeners to the current phase
  • Client differences:
    • Events can be scheduled in the future with Client.dispatch_future(). This adds an entry to the database, so the scheduled event will persist through restarts. .dispatch_future() guarantees precision within at least 30s of the scheduled time.
    • Key-value storage: Reduces boilerplate for storing/retreiving arbitrary small data points. Client.set_value() and Client.get_value() can be used to store & retreive small strings from the database
    • Database migrations: Client.migration() allows schema migrations to be added in code. Migrations are called only the first time the bot starts up after a new migration is added.
    • Special message handlers: A small convenience layer over Client.wait_for(), Client.add_special() allows a coroutine to be invoked any time a message is received which meets user-defined criteria
    • Native database integration: Beymax natively supports SQLAlchemy for interacting with databases in your bot.
  • Cogs -> Suites: discord.py's concept of a cog is essentially the same as a Beymax suite. Suites group together a set of commands, context menus, event listeners, database tables, etc which logically relate to each other. Suites can define their own interdependencies, ensuring that if a suite is loaded by your bot, all of its dependencies are also loaded.
  • UI Differences: discord.py's ui library follows an imperative style, where UI elements are defined in advance via subclassing. Beymax overrides this interface to provide a functionally-oriented style where UI elements are defined dynamically at runtime using function decorators.
  • Argument parsing and command definition: Beymax mostly follows discord.py's style of defining command/context arguments via function annotations. Beymax extends this by allowing all argument metadata to be set in the annotations, including parameter descriptions.

Metadata

Release files for beymax 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for beymax 1.3.0
File Size Uploaded Provenance
beymax-1.3.0.tar.gz 38.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for beymax 1.3.0
File Interpreter ABI Platform
beymax-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 79.6 kB

Release files / beymax-1.3.0.tar.gz

Download URL beymax-1.3.0.tar.gz
Size 38.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f727db526b3c57a83ff59a8abfbed1c16ba58dd71b2b7982f968f95c91f7b9e0
BLAKE2b-256 checksum
How to use checksums
b522095ca63ca213dd6d928d8a725f12bfc26b0bf8dd30620fc5a50719ec4337
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release files / beymax-1.3.0-py3-none-any.whl

Download URL beymax-1.3.0-py3-none-any.whl
Size 41.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fb656d3a40be31028942b78fff11ab3818b02ccfe5c074850209f2430ef9342
BLAKE2b-256 checksum
How to use checksums
753e0c854af2f9a55f3c8324200951a920931aab2dd83d876d1e025c3b481ee3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Security for beymax 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page