Skip to content

Automatic Responses

Kneemund edited this page Jun 10, 2022 · 9 revisions

Creating an Automatic Response

You can create an automatic response using /automaticresponse create, where the alias argument is used to reference it and the regex argument is the regular expression that will trigger the automatic response. When specifying the regular expression, make sure to escape every backslash (\\) because JavaScript consumes them by default. In order to fill it with content, you must use the /automaticresponse update command.

Reading/Listing Automatic Responses

You can display the raw JSON data of an automatic response using /automaticresponse read. If you don't specify the alias argument, the bot will send a list of all automatic responses instead.

Updating an Automatic Response

You can update an automatic response using /automaticresponse update, where path is the path to the object or value which you want to replace (separated using dots, e.g. embedData.author.name) and value is the new value (must be valid JSON). Not providing a value will delete the JSON key, and updating a non-existent key will automatically create it.

An automatic response can contain the following data:

{
    "alias": "", // name that will be used to reference the automatic response (required)
    "regex": "", // regex that will trigger the automatic response if it matches the message content (required)
    "flags": "", // regex flags, e.g. "i" for case insensitivity (optional)
    "content": "", // content of the message (required unless "embedData" is specified)
    "embedData": {}, // embed constructor (required, unless "content" is specified)
    "attachmentURLs": [""], // attachment URLs (optional)
    "directMessage": false, // if true, the bot will send the message as a DM or in the bot channel if the DM fails (optional, false by default)
    "deleteAfter": 10, // seconds after which the auto response message will be deleted (optional)
    "maxMemberDuration": 100, // if specified, users that have been a member of the server for a bigger amount of time than the one specified (in seconds) will not be able to trigger the automatic response (optional)
    "cooldown": 10 // the response cooldown in seconds (optional)
}

In order to create the embed object, visit https://leovoel.github.io/embed-visualizer/.
When specifying the regular expression, make sure to escape every backslash (\\) because JavaScript consumes them by default. Every instance of {user} in the embed and message will be replaced with a mention of the user that triggered the automatic response.

Deleting an Automatic Response

You can delete an automatic response using /automaticresponse delete.

Clone this wiki locally