Zeres Plugin Library -
ZeresPluginLibrary (ZPL) is a foundational utility resource for BetterDiscord, designed to provide common functions and developer tools that other plugins rely on to function correctly. ⚠️ Status: End of Life (EOL) As of November 2025, ZeresPluginLibrary is deprecated and discontinued . Reason : Most of its core functionality has been integrated directly into BetterDiscord's built-in API. Impact : While many legacy plugins still require it, the library will no longer receive updates to fix compatibility issues caused by Discord client changes. 🛠️ Core Purpose and Features For years, ZPL served as the "standard library" for Discord modding, offering: Utility Functions : Simplified common tasks like searching for servers, managing role members, and handling UI elements. Developer Build Scripts : Tools for developers to initialize, build, and automatically copy plugins to the BetterDiscord directory. Plugin Emulation : The ability to emulate older "v2" plugin structures, ensuring older mods continued to work after BetterDiscord updates. 📦 Notable Plugins Requiring ZPL Many popular BetterDiscord plugins were built on top of this library, including: BetterRoleColors : Adds server-based role colors to various UI elements like typing indicators and voice channels. PermissionsViewer : Allows users to view specific permissions for others directly within the app. BlurNSFW : Automatically blurs images in NSFW-marked channels or DMs until hovered over. DoNotTrack : Disables Discord's built-in tracking and analytics. 🔧 Troubleshooting & Common Issues Because the library is now in a legacy state, users often encounter specific errors: zerebos/BDPluginLibrary: Plugin library for BetterDiscord.
White Paper: Zeres Plugin Library A Metadata-Driven, Type-Safe Architecture for Dynamic Extensibility Authors: [Your Name/Organization] Date: October 2023 Version: 1.0
Abstract As software systems grow in complexity, the need for modular, extensible architectures becomes paramount. However, existing plugin frameworks often struggle with a trilemma: sacrificing type safety for flexibility, incurring high runtime overhead, or creating opaque dependency graphs. This paper introduces Zeres , a next-generation plugin library designed to resolve these conflicts. By utilizing a metadata-driven registration system and compile-time trait verification, Zeres provides a robust environment for dynamic loading that ensures interface compliance without sacrificing performance.
1. Introduction In modern software engineering, the "monolithic" approach is increasingly yielding to modular designs. Plugin architectures allow developers to extend application functionality without modifying the core codebase. However, standard implementations often rely on dynamic casting (e.g., dynamic_cast in C++ or reflection in Java/C#) which introduces runtime overhead and potential segmentation faults if version mismatches occur. Zeres is proposed as a lightweight, header-only (or native binary) library that treats plugins not merely as external symbols, but as first-class citizens of the application's dependency graph. Zeres enforces a strict contract between the Host and the Plugin, ensuring that objects are validated before instantiation. 2. The Problem: Fragility in Dynamic Loading Current plugin systems face three primary issues: zeres plugin library
The "Fat Interface" Problem: To avoid complex dynamic casting, developers often expose massive "God Interfaces" to plugins, leading to tight coupling and security risks. ABI Instability: Plugins compiled against different versions of the host library may crash the application upon load due to mismatched memory layouts, often without a clear error message. Discovery Overhead: Locating and categorizing plugins often requires parsing configuration files or expensive filesystem scanning.
3. The Zeres Architecture The Zeres library proposes a three-layer architecture to address these issues: 3.1 The Trait Verification Layer (TVL) Zeres moves type checking from the call-site to the load-site. Instead of casting an object to a specific type during execution, Zeres uses a compile-time hash mechanism.
Mechanism: Each interface (e.g., IPlugin , IRenderer ) is assigned a unique compile-time hash. Verification: Upon loading a shared library ( .dll / .so ), Zeres queries the plugin's entry point to verify that it implements the required trait hashes. If a hash mismatch is detected, the library fails gracefully with a TraitMismatchException before any code is executed. Impact : While many legacy plugins still require
3.2 The Metadata Manifest Every Zeres plugin contains an embedded JSON or binary manifest section. This allows the host to query plugin capabilities (Name, Version, Dependencies, Author) without initializing the plugin's code logic.
Benefit: This enables "Lazy Loading" strategies. The host can index thousands of potential plugins and load only the memory-efficient metadata, instantiating the actual code only when the user requests that specific functionality.
3.3 The Lifecycle Manager Zeres introduces a standardized lifecycle state machine: Registered -> Instantiated -> Active -> Suspended -> Unloaded . Unlike simple factories, the Lifecycle Manager handles dependency injection. If Plugin A requires Plugin B, Zeres resolves the dependency graph topologically before instantiation, preventing circular dependency deadlocks. 4. Implementation Details 4.1 The ZeresInterface Macro Zeres utilizes a macro to simplify boilerplate code. // In the Plugin project class MyCustomEffect : public IEffect { public: void apply(Image* img) override { /* ... */ } }; Plugin Emulation : The ability to emulate older
ZERES_EXPORT_PLUGIN(MyCustomEffect, "com.example.effects.custom", "1.0.2")
4.2 Host Integration The host application uses a PluginRegistry to manage the ecosystem. Zeres::PluginRegistry registry;