Get Commands
This sub-action is useful if you want to output a list of commands to your chat.
Anywhere
Configuration
Specify the command group or select All
.
Specify the variable in which the commands are getting saved to.
Include all commands regardless of their Include
option checked or not. When paired with the Only Has Permission
option it will only get the commands the user is permitted to use.
Only get commands for which the user has permissions.
When checked it will only use the first command you have defined in the command settings. If you have a command which activates on !sb
and also on !streamerbot
, it will only get the !sb
command.
Example Usage
Import Code
U0JBRR+LCAAAAAAABADdV1lvm1gUfq/U/xDlubZYjG0q9cEmMSGJSbxiM+7D3YyJL8uweKv63+eAV7yMqqrzMpFQzPm+e5bvHODeH58/3d3dL1gUu4F///VO/pIbXC8MomR4bvZc3/VS72i/F8pSWS4hHs5QWbzfsViCAPuR3cCtjzyWUXWW3GmB5yGfxnePK+SFnN0NYuSw7TqgojSZBVFG7iURg3VRGQfJAT6meS+WhbJwACiLSeSGyQ489Rd0U79Bdoifcp5BP7eJUlRIFOW0GCx/bS13eyiHXZr5rsqsJiK1VqpTEZUqVFXhF5ZLtSmrS6IyVTGj+/j5sr9TlrJd7FM78xHmLPOZRCkrICvCU8paUeA9uXESRGsgTRGPC6xrshYCO1GQhhnjKor4Eq1jEOea7wjogXeQ7QIngU/SKGJ+cg1NItdxoFWZkN8LMS8FPhP5mLi5Le9Mte0YoMjNtNtRIJvL+rYd83MhG5xfqrwlOH4QAe6imMVXSslJMxS/s8hz493sXXWUzwapIgELlJaqSFZKldq0WlKFilyqEjJlmJJ6naCLJJfMdWaZjjDQ51iyDrMKRUGUz6FDd7PqzsGbs7WThbJV5vbU/vPLv7UkDtKIsP4unVsNOX32zqSZ1iuySOpySZKmtFQRFbWEJHiA6JRJgsym1ZpQ/R1plAvgIMxvqiL8uiqng3q1D783qVen8A+PqkIrWKGqWEIMC9mo1kuqolZLskqJjGqCwhT5j4/qfz+n+5fiRaQbX4gDPmcsBHEX7Ja0EZsyeOERdvH6ymHt62RiQcLBMp5M2i6JgjiYJmXzsT+ZtCLIahlE82plMllU4MslC7KoTiZeTIKIu7hMoe9F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EUxcb8/Pj6WfP/38B42DdriRDwAA
C# Code
Since Twitch has a message character limit of 500 and on YouTube it's 200 you may find your commands overtake this amount therefore the code below can help with splitting the list into batches of commands that fit inside the messages.
using System;
using System.Collections.Generic;
public class CPHInline
{
public bool Execute()
{
List<string> commands = (List<string>)args["commandsList"];//This is when the Variable Name in the Get Commands Sub-Action is `commands`
string message = "Commands Avaliable to you: ";
bool bot = false;
int messageMax = 495; //Limit is 500 on Twitch, 200 on YouTube.. I took a few off as a safety measure.
for (int i = 0; i < commands.Count; i++)
{
if ((commands[i].Length + message.Length) > messageMax)
{
CPH.SendAction(message, bot); // This will need to be changed to CPH.SendYouTubeMessage(message, bot); if you wish to send the message to Youtube
message = "Addional Commands for you: ";
}
message += commands[i] + ", ";
}
CPH.SendAction(message, bot); // This will need to be changed to CPH.SendYouTubeMessage(message, bot); if you wish to send the message to Youtube
return true;
}
}
Variables
The following variables will be populated after executing this sub-action:
Description | ||
---|---|---|
<variableName> | string | Comma-separated string containing all commands matching your specified criteria Example: !shoutout,!followage,!ban |
<variableName>List | List | C# List object containing all commands matching your specified criteria |
C# Usage
Returns all commands associated with Streamer.bot instance
public List<CommandData> GetCommands()