From 0568d4f679d835749f4f411d0ee2536e78675b58 Mon Sep 17 00:00:00 2001 From: Vrabor Date: Wed, 22 May 2024 12:15:21 +0200 Subject: [PATCH] Add documentation and examples for creating custom commands --- docs/chatbot/commands/custom/examples.md | 96 +++++++++++++++++++++++- docs/chatbot/commands/custom/index.md | 67 ++++++++++++++++- 2 files changed, 161 insertions(+), 2 deletions(-) diff --git a/docs/chatbot/commands/custom/examples.md b/docs/chatbot/commands/custom/examples.md index fe7a446..22cc112 100644 --- a/docs/chatbot/commands/custom/examples.md +++ b/docs/chatbot/commands/custom/examples.md @@ -1,5 +1,99 @@ # Examples +Commands can be created in either the dashboard or in chat. +These examples create custom commands directly in chat, but +you can just aswell create these commands by pasting them +into your dashboard. +Please refer to [Custom Commands](index.md) + +### The simplest command + +The simplest type of command just responds with text + +#### Creating the command + +``` +!command add test This is a test command +``` + +#### Example input + +``` +!test +``` + +#### Example output + +``` +This is a test command +``` + +### Accepting arguments in a command +Arguments can be used with `${}` and the number of the passed argument + +``` +!command add greet Welcome to the stream ${1}! +``` + +#### Example input + +``` +!greet styler +``` + +#### Example output + +``` +Welcome to the stream styler! +``` + +### Accepting multiple arguments in a command +Arguments can be used with `${}` and the number of the passed argument. +If you pass the wrong number of arguments, the command won't run. + ``` -tbd +!command add greet Welcome to the stream ${1} and ${2}! ``` + +#### Example input + +``` +!greet styler styler2 +``` + +#### Example output + +``` +Welcome to the stream styler and styler2! +``` + +### Using Variables + +Chat commands support variables in a dynamic way. Variables are placeholders that can be used in chat commands to represent a specific value or piece of information. When a command is triggered, these variables are replaced with the actual values they represent. See [Variables](../../Variables) + +``` +!command add shoutout Check out ${1}, they are playing ${game ${1}} at https://twitch.tv/${channel ${1}} +``` + +#### Example input + +``` +!shoutout styler +``` + +#### Example output + +``` +Check out styler, they are playing Minecraft at https://twitch.tv/styler +``` + +### Setting permission level + +You may may want to restrict who can use what command: + +``` +!command options shoutout -level 500 +``` +This only allows users with access level `moderator` or higher to use the command. +For a list of all available access levels see [!level](../default/level) + diff --git a/docs/chatbot/commands/custom/index.md b/docs/chatbot/commands/custom/index.md index fbca55b..007824d 100644 --- a/docs/chatbot/commands/custom/index.md +++ b/docs/chatbot/commands/custom/index.md @@ -1,5 +1,70 @@ +--- +id: custom commands +description: Learn how to create Custom Commands +tags: + - chatbot + - custom commands +keywords: + - streamelements + - chatbot + - commands + - custom commands + - add command + - create command + - remove command + - delete command + - edit command +--- # Custom Commands In addition to the default commands, you can also create your own custom commands. Custom commands allow you to create commands that are tailored to your channel and your community. You can use custom commands to create unique interactions and functionalities that are not possible with the default commands. -## Creating a Custom Command +## Managing Custom Commands + +There are 2 ways to manage a custom commands: +1. Through the creator dashboard +1. Directly in chat with the [!command](../default/command.md) command + +### Using the Dashboard to manage custom commands + +See [Creating a command](../../gettingstarted/customcommands/creating.md) in `Getting Started` + +### Using chat to manage Custom Commands +#### Creating a Custom Command in chat + +The general Syntax is the following: +``` +!command add +``` + +#### Modifying a Custom Command in chat + +``` +!command edit +``` + +#### Deleting a Custom Command in chat + +``` +!command remove +``` + +#### Displaying the commands text in chat + +``` +!command show +``` + +##### Example Output: + +``` +@Styler, command test: ${channel} This is a test command. ${settitle ${1:}} +``` + +#### Changing the options / permissions / cooldowns of a command + +``` +!command options <-option> +``` + +For specifics read the documentation for the [!command](../default/command.md) command