Updated interview documentation
Updated links
This commit is contained in:
parent
63f5d9fce2
commit
d43cfecb29
4 changed files with 113 additions and 55 deletions
|
@ -18,14 +18,14 @@ public class StatusCommand
|
|||
long closedTickets = Database.GetNumberOfClosedTickets();
|
||||
|
||||
DiscordEmbed botInfo = new DiscordEmbedBuilder()
|
||||
.WithAuthor("Emotion-stuff/supportchild @ Toastielab", "https://toastielab.dev/Emotions-stuff/SupportChild", "https://cdn.discordapp.com/attachments/765441543100170271/914327948667011132/Ellie_Concept_2_transparent_ver.png")
|
||||
.WithAuthor("Emotion-stuff/supportchild @ Toastielab", "https://toastielab.dev/toastie-stuff/SupportChild", "https://cdn.discordapp.com/attachments/765441543100170271/914327948667011132/Ellie_Concept_2_transparent_ver.png")
|
||||
.WithTitle("Bot information")
|
||||
.WithColor(DiscordColor.Cyan)
|
||||
.AddField("Version:", SupportChild.GetVersion(), true)
|
||||
.AddField("Open tickets:", openTickets + "", true)
|
||||
.AddField("Closed tickets:", closedTickets + " ", true)
|
||||
.AddField("Report bugs:", "[Toastielab Issues](https://toastielab.dev/Emotions-stuff/SupportChild/issues)", true)
|
||||
.AddField("Commands:", "[Toastielab Repository](https://toastielab.dev/Emotions-stuff/SupportChild/src/branch/main/docs/Commands.md)", true);
|
||||
.AddField("Report bugs:", "[Toastielab Issues](https://toastielab.dev/toastie-stuff/SupportChild/SupportChild/issues)", true)
|
||||
.AddField("Commands:", "[Toastielab Repository](https://toastielab.dev/toastie-stuff/SupportChild/src/branch/main/docs/Commands.md)", true);
|
||||
await command.RespondAsync(botInfo);
|
||||
}
|
||||
}
|
|
@ -54,11 +54,6 @@ public class ReferencedInterviewStep
|
|||
[JsonProperty("after-reference-step")]
|
||||
public InterviewStep afterReferenceStep;
|
||||
|
||||
public DiscordButtonStyle GetButtonStyle()
|
||||
{
|
||||
return InterviewStep.GetButtonStyle(buttonStyle);
|
||||
}
|
||||
|
||||
public bool TryGetReferencedStep(Dictionary<string, InterviewStep> definitions, out InterviewStep step, bool ignoreReferenceParameters = false)
|
||||
{
|
||||
if (!definitions.TryGetValue(id, out step))
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
<Description>A Discord support ticket bot built for the Ellie's home server</Description>
|
||||
<NeutralLanguage>en</NeutralLanguage>
|
||||
<RepositoryType>Git</RepositoryType>
|
||||
<RepositoryUrl>https://toastielab.dev/Emotions-stuff/SupportChild</RepositoryUrl>
|
||||
<RepositoryUrl>https://toastielab.dev/toastie-stuff/SupportChild</RepositoryUrl>
|
||||
|
||||
<PackageIconUrl>https://cdn.discordapp.com/attachments/765441543100170271/914327948667011132/Ellie_Concept_2_transparent_ver.png</PackageIconUrl>
|
||||
<PackageIconUrl>https://cdn.elliebot.net/Ellie.png</PackageIconUrl>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<PackageProjectUrl>https://toastielab.dev/Emotions-stuff/SupportChild</PackageProjectUrl>
|
||||
<PackageProjectUrl>https://toastielab.dev/toastie-stuff/SupportChild</PackageProjectUrl>
|
||||
<PackageVersion>4.0.0</PackageVersion>
|
||||
<LangVersion>default</LangVersion>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# Writing Interview Templates
|
||||
|
||||
The bot can automatically interview users when they open a ticket. These interviews are defined in interview templates.
|
||||
The bot can automatically interview users when they open a ticket. These interviews are defined in interview templates.
|
||||
The templates each apply to a single ticket category so you can have different interviews depending on the type of ticket.
|
||||
|
||||
## Interview Template Commands
|
||||
|
||||
Whether you already have a template or not the first step is always to use the `/interviewtemplate get <category>` command on the
|
||||
Whether you already have a template or not the first step is always to use the `/interviewtemplate get <category>` command on the
|
||||
ticket category you want to edit. If you haven't yet, use the `/addcategory` command on the category to register it with the bot.
|
||||
|
||||
The bot will reply with a JSON template file which you can edit and upload using the `/interviewtemplate set` command.
|
||||
|
@ -34,7 +34,7 @@ The bot will check that your template is correctly formatted and provide feedbac
|
|||
|
||||
It is highly recommended to use the interview template JSON schema to get live validation of your template while you write it:
|
||||
|
||||
### Guides for Different Editors:
|
||||
### Guides for Different Editors
|
||||
|
||||
<details>
|
||||
|
||||
|
@ -44,6 +44,7 @@ It is highly recommended to use the interview template JSON schema to get live v
|
|||
2. Search for `json schema`.
|
||||
3. Click `Edit in settings.json` on the schema setting.
|
||||
4. Set the `json.schemas` property to the following to automatically validate template files:
|
||||
|
||||
```json
|
||||
{
|
||||
"json.schemas":
|
||||
|
@ -53,11 +54,12 @@ It is highly recommended to use the interview template JSON schema to get live v
|
|||
[
|
||||
"interview-template*.json"
|
||||
],
|
||||
"url": "https://toastielab.dev/Emotions-stuff/SupportChild/raw/branch/main/Interviews/interview_template.schema.json"
|
||||
"url": "https://toastielab.dev/toastie-stuff/SupportChild/raw/branch/main/Interviews/interview_template.schema.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
5. Open an interview template, you should now get suggestions for things like message types and color names, and error highlighting for any invalid sections.
|
||||
|
||||
</details>
|
||||
|
@ -67,7 +69,8 @@ It is highly recommended to use the interview template JSON schema to get live v
|
|||
<summary>Jetbrains Editors</summary>
|
||||
|
||||
1. Go to `File->Settings->Languages & Frameworks->Schemas->JSON Schema Mapping`.
|
||||
2. Add a new schema with the following URL: `https://toastielab.dev/Emotions-stuff/SupportChild/raw/branch/main/Interviews/interview_template.schema.json`.
|
||||
2. Add a new schema with the following URL: `https://toastielab.dev/toastie-stuff/SupportChild/raw/branch/main/Interviews/interview_template.schema.json`.
|
||||

|
||||
3. Restart your editor and all interview templates should now automatically be set to the correct schema in the bottom right of the window.
|
||||
|
||||
</details>
|
||||
|
@ -77,7 +80,7 @@ It is highly recommended to use the interview template JSON schema to get live v
|
|||
This section lists all the properties that can be used in an interview template.
|
||||
If you have set up your editor as suggested above it will handle a lot of this for you automatically.
|
||||
|
||||
Here is a simple example of an interview asking a user for their favourite colour out of the different button colours:
|
||||
Here is a simple example of an interview asking a user for their favourite colour out of the different button colours. Two of the options are added as step references and two are normal steps. References are meant to be used when you want to re-use the same step in several places while normal steps are just used in one location.
|
||||
```json
|
||||
{
|
||||
"category-id": "1006863882301755503",
|
||||
|
@ -87,12 +90,26 @@ Here is a simple example of an interview asking a user for their favourite colou
|
|||
"message-type": "BUTTONS",
|
||||
"color": "BLUE",
|
||||
"summary-field": "Favourite colour",
|
||||
"step-references":
|
||||
{
|
||||
"Green":
|
||||
{
|
||||
"id": "green",
|
||||
"button-style": "SUCCESS"
|
||||
},
|
||||
"Red":
|
||||
{
|
||||
"id": "red",
|
||||
"button-style": "DANGER"
|
||||
}
|
||||
},
|
||||
"steps":
|
||||
{
|
||||
"Blue":
|
||||
{
|
||||
"message": "Summary",
|
||||
"message-type": "END_WITH_SUMMARY",
|
||||
"message-type": "INTERVIEW_END",
|
||||
"add-summary": true,
|
||||
"color": "BLUE",
|
||||
"button-style": "PRIMARY",
|
||||
"steps": {}
|
||||
|
@ -100,40 +117,45 @@ Here is a simple example of an interview asking a user for their favourite colou
|
|||
"Gray":
|
||||
{
|
||||
"message": "Summary",
|
||||
"message-type": "END_WITH_SUMMARY",
|
||||
"message-type": "INTERVIEW_END",
|
||||
"add-summary": true,
|
||||
"color": "GRAY",
|
||||
"button-style": "SECONDARY",
|
||||
"steps": {}
|
||||
},
|
||||
"Green":
|
||||
{
|
||||
"message": "Summary",
|
||||
"message-type": "END_WITH_SUMMARY",
|
||||
"color": "GREEN",
|
||||
"button-style": "SUCCESS",
|
||||
"steps": {}
|
||||
},
|
||||
"Red":
|
||||
{
|
||||
"message": "Summary",
|
||||
"message-type": "END_WITH_SUMMARY",
|
||||
"color": "RED",
|
||||
"button-style": "DANGER",
|
||||
"steps": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions":
|
||||
{
|
||||
"green":
|
||||
{
|
||||
"message": "Summary",
|
||||
"message-type": "INTERVIEW_END",
|
||||
"add-summary": true,
|
||||
"color": "GREEN",
|
||||
"steps": {}
|
||||
},
|
||||
"red":
|
||||
{
|
||||
"message": "Summary",
|
||||
"message-type": "INTERVIEW_END",
|
||||
"add-summary": true,
|
||||
"color": "RED",
|
||||
"steps": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Template Root
|
||||
|
||||
| Property | Required | Description |
|
||||
|----------------------------------------------------------------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `category-id` | Yes | The id of the category this template applies to. You can change this and re-upload the template to apply it to a different category. |
|
||||
| `interview` | Yes | Contains the interview conversation tree, starting with one interview step which branches into many. |
|
||||
| Property | Required | Description |
|
||||
|----------------------------------------------------------------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `category-id` | Yes | The id of the category this template applies to. You can change this and re-upload the template to apply it to a different category. |
|
||||
| `interview` | Yes | Contains the interview conversation tree, starting with one interview step which branches into many. |
|
||||
| `definitions` | Yes | Contains a list of steps which can be referenced in the interview, see example above. These steps can also reference each other or themselves for more advanced interview trees. |
|
||||
|
||||
### Interview Paths
|
||||
### Interview Steps
|
||||
|
||||
<!-- This is an HTML table to allow for markdown formatting inside -->
|
||||
<table>
|
||||
|
@ -153,7 +175,7 @@ Here is a simple example of an interview asking a user for their favourite colou
|
|||
<td>Yes</td>
|
||||
<td>String</td>
|
||||
<td>
|
||||
The text in the embed message that will be sent to the user when they reach this step.
|
||||
The text in the embed message that will be sent to the user when they reach this step. Required for all message types except `REFERENCE_END`.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -174,7 +196,7 @@ The type of message, decides what the bot will do when the user gets to this ste
|
|||
|
||||
`color`
|
||||
</td>
|
||||
<td>Yes</td>
|
||||
<td>No</td>
|
||||
<td>String</td>
|
||||
<td>
|
||||
|
||||
|
@ -189,6 +211,17 @@ Colour of the message embed. You can either enter a colour name or a hexadecimal
|
|||
<td>Steps</td>
|
||||
<td>
|
||||
One or more interview steps. The name of the step is used as a regex match against the user's answer,
|
||||
except for selection boxes and buttons where each step becomes a button or selection option.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
`step-references`
|
||||
</td>
|
||||
<td>No</td>
|
||||
<td>Step References</td>
|
||||
<td>
|
||||
One or more references to steps in the `definitions` property. The name of the step is used as a regex match against the user's answer,
|
||||
except for selection boxes and buttons where each step becomes a button or selection option.
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -223,6 +256,7 @@ The value of this property is the name which will be displayed next to the answe
|
|||
<td>
|
||||
The style of this step's button. Requires that the parent step is a `BUTTONS` step.
|
||||
Must be one of the following:
|
||||
|
||||
- `PRIMARY`
|
||||
- `SECONDARY`
|
||||
- `SUCCESS`
|
||||
|
@ -273,20 +307,49 @@ The maximum length of the user's response message. Requires that this step is a
|
|||
The minimum length of the user's response message. Requires that this step is a `TEXT_INPUT`.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
`add-summary`
|
||||
</td>
|
||||
<td>No</td>
|
||||
<td>Boolean</td>
|
||||
<td>
|
||||
Whether to add a summary of all of the user's answers to this message.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
`answer-delimiter`
|
||||
</td>
|
||||
<td>No</td>
|
||||
<td>String</td>
|
||||
<td>
|
||||
If the user answers several questions with the same `summary-field` the last answer will be used in the summary by default. If you set this parameter all of the answers will be combined using this delimiter instead.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### Step References
|
||||
|
||||
| Property | Required | Description |
|
||||
|----------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `id` | Yes | The ID of the definition to refer to. |
|
||||
| `button-style` | No | Same as the `button-style` property in a normal step. |
|
||||
| `selector-description` | No | Same as the `selector-description` property in a normal step. |
|
||||
| `after-reference-step` | No | If the step tree you referenced using the `id` ends in a `REFERENCE_END` the interview will continue from here when the user reaches it. |
|
||||
|
||||
### Message Types
|
||||
|
||||
| Message Type | Description |
|
||||
|------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `ERROR` | Sends an error message but does not stop the interview. The interview remains on the same step as before allowing the user to try again. |
|
||||
| `END_WITH_SUMMARY` | End the interview and create a summary of the answers. |
|
||||
| `END_WITHOUT_SUMMARY` | End the interview with a simple message without a summary. |
|
||||
| `BUTTONS` | Creates a message with one button per child step where the button text is the name of the child step. |
|
||||
| `TEXT_SELECTOR` | Creates a selection box with one option per child step where the option text is the name of the child step. |
|
||||
| `USER_SELECTOR` | Creates a selection box where the user can select a user from the Discord server. The value used for the summary is the user's mention. |
|
||||
| `ROLE_SELECTOR` | Same as above but for a role. |
|
||||
| `MENTIONABLE_SELECTOR` | Same as above but works for both roles and users. |
|
||||
| `CHANNEL_SELECTOR` | Same as above but for channels and categories. |
|
||||
| `TEXT_INPUT` | Lets the user reply to the bot message with their own text. |
|
||||
| Message Type | Description |
|
||||
|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `ERROR` | Sends an error message but does not stop the interview. The interview remains on the same step as before allowing the user to try again. |
|
||||
| `INTERVIEW_END` | End the interview and deletes the previous messages if enabled in the config. |
|
||||
| `BUTTONS` | Creates a message with one button per child step where the button text is the name of the child step. |
|
||||
| `TEXT_SELECTOR` | Creates a selection box with one option per child step where the option text is the name of the child step. |
|
||||
| `USER_SELECTOR` | Creates a selection box where the user can select a user from the Discord server. The value used for the summary is the user's mention. |
|
||||
| `ROLE_SELECTOR` | Same as above but for a role. |
|
||||
| `MENTIONABLE_SELECTOR` | Same as above but works for both roles and users. |
|
||||
| `CHANNEL_SELECTOR` | Same as above but for channels and categories. |
|
||||
| `TEXT_INPUT` | Lets the user reply to the bot message with their own text. |
|
||||
| `REFERENCE_END` | Use this in a reference to go back to the step which used the reference. When the user reaches this step the `after-reference-step` where this reference was used will be run. |
|
Loading…
Add table
Reference in a new issue