👨🏼🔧 Manage Discord server settings with a repeatable, versionable config file.
⚠️ WARNING : While the library is now publicly available, it is still greatly unstable : files can be moved or renamed anytime. On the other hand, the CLI is future proof and the configuration format should not change much.
cargoshell
cargo install dac
To validate installation, run :
shell
dac
Not yet available.
If you don't have created a bot yet, here's how to do it :
Bot on the sidebar and create a bot.DAC_DISCORD_BOT_TOKEN for dac).P.S.: The same bot can be used for all of your Discord servers :wink:
If your bot hasn't been already added to the server that you want to manage with dac, here's how do add it :
OAuth2 on the sidebarGeneral section, add a placeholder Redirect URL (can be http://localhost) and SaveURL Generator section, select the identify scope. A new section for the redirect URL will appear, make sur to select one.bot scope. A new pannel with Permissions will appear. dac only needs the Manage Roles and Manage Channels permissions, so you can select those.
P.S.: You will need to redo those steps for every server
P.P.S.: You can change the bot's permissions directly in the Server Settings without redoing all those steps :wink:
To validate the bot's read access, run :
shell
dac list
:warning: All commands needs the evironment variable DAC_DISCORD_BOT_TOKEN to be set.
listList bot's accessible servers. If you don't see access to your server, make sure to add your bot to it.
compileCompile a template config to a full config file. Only the handlebars format is supported for now. Will compile to the original format (JSON or YAML).
Arguments
--template, -t <TEMPLATE_FILE> : File to use as a template (contains handlebars tokens).--vars, -v <VARS_FILE> : File containing variables that populates the template. can be either YAML or JSON.--output, -o <OUTPUT_FILE> : Compiled config output file.--force, -f : Bypass the user confirmation step.saveSave a server (guild) configuration.
Arguments:
--guild, -g <GUILD_ID> : Id of the guild to save. To find your guild id, use list.--output, -o <OUTPUT_FILE> : Output file path. Both .json and .yaml/.yml files are supported.--force, -f : Bypass the user confirmation step.applyApply changes to a server based on a configuration file.
Arguments
--guild, -g <GUILD_ID> : Id of the guild to save. To find your guild id, use list.--input, -i <INPUT_FILE> : Configuration file to use. Both .json and .yaml/.yml files are supported. Make sure to correctly follow the configuration file schemas.--force, -f : Bypass the user confirmation step.The configuration file can be either a JSON file (.json) or a YAML file (.yaml or .yml). YAML file can include anchors and merges. It is used to describe the wanted state or a Discord server (guild).
Some examples can be found here.
rolesFields
name (string) : Name of the role. :warning: Every role needs to have a unique name.permissions (string[]) : List of permissions by name. You can read more about Discord's permissions on the Discord Developer Portal.show_in_sidebar (bool) : Show connection status of members with this role in the Members sidebar. The members will be categorized by role.is_mentionable (bool) : Allow everyone to mention this role with @ (ex: @team-01).color (optional string) : Color of the role, in hexadecimal format (without the #).categoriesFields
name (string) : Name of the category. :Warning: Every category needs to have a unique name.permissions_overwrites (PermissionsOverwrite[]) : List of permissions overwrites. You can read more on the Discord Developer Portal.PermissionsOverwrite :
role (string) : Role to apply overwrites to.allow (string[]) : Specifically allowed permissions overwrites for the role.deny (deny[]) : Specifically denied permissions overwrites for the role.