APIs ‐ Payload Injection - altoiddealer/ad_discordbot GitHub Wiki

ad_discordbot has a flexible and sensible payload management system which can inject dynamic bot variables into unknown / complex payload structures.

This system is generally not necessary for A1111-like APIs (A1111 / Forge / ReForge) as their payload structure is simple and internal handling already manages it correctly


Payload Overrides Utility

There is a utility to help get you started in /utils/inject_bot_vars_to_payload/

Simply drag-and-drop your payload files onto the inject_values.bat and it will try finding matching key names to swap in the placeholder values. It will also add a __overrides__ dict populated with default values. Or, copy/paste this from one of the example payloads (/examples/payloads/).

The utility outputs a new version of the file suffixed with _updated as well as a log file detailing what was modified in the file.

New Util


How the System Works

While the bot processes payloads, handles Tags behavior, etc - it will automatically update the __overrides__ dict and finally format the values into the placeholders before posting to the API.

You are not restricted to the variables defined in the examples. You can define your own via the Tags system (the payload tag), and in 'dict_imgmodels.yaml' (model presets). Any key values you set, will be injected into 'overrides' and resolved into the payload.

NOTE: When using {seed} it will inject a randomized seed integer.