Skip to content
Entity Info serverRestore

$serverRestore[] — Recreate what is missing

$serverRestore[] reads a text made by $serverSnapshot and recreates the roles and channels that do not exist any more (roles are matched by name, channels by type, name and category). It never deletes or changes anything that exists. With dryRun left to true, nothing is created and the report only lists what would be. Protect it with a permission check such as $onlyPerms[ManageGuild].

Syntax

$serverRestore[json;(dryRun);(serverID)]

Parameters

Parameter Description
json Required. The text returned by $serverSnapshot. Anything else raises Invalid backup JSON.
dryRun Optional. true (default) only lists; false creates.
serverID Optional. The server to restore into. If omitted, the current server.

Return Value

  • Type: string (JSON) such as {"dryRun":true,"createdRoles":["VIP"],"createdChannels":["news"],"skippedRoles":3,"skippedChannels":12,"failed":[]}. failed lists the items Discord refused.

Examples

$var[plan;$serverRestore[$fileRead[backups/$guildID/1700000000000.json]]]
$jsonParse[$var[plan]]
$sendMessage[Missing channels: $jsonArrayCount[createdChannels]]

Try it

Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.