TwitchCommandHelp Node
The TwitchCommandHelp node provides an automated help system for your application's chat commands. It extends the standard TwitchCommand functionality to automatically generate and reply with information about other available commands.
Overview
This node acts as a self-contained help command handler. When a user invokes the command associated with this node (commonly configured as !help):
- It receives the command via its inherited
command_receivedsignal. - It identifies the context (regular chat message or whisper).
- It accesses a list of all other registered
TwitchCommandnodes within your project. - It filters these commands based on:
- Whether the command is usable in the current context (Chat vs. Whisper, based on the command's
whereflag). - (Optional) If the user provided arguments (e.g.,
!help specific_cmd), it filters to show only details for the requested command(s).
- Whether the command is usable in the current context (Chat vs. Whisper, based on the command's
- It formats a help message:
- A list of available commands if no specific command was requested.
- Detailed descriptions for requested commands.
- It uses an assigned
TwitchAPIinstance to send the generated help message back to the user:- As a direct reply in chat if triggered via chat.
- As a whisper if triggered via whisper.
This automates the process of providing users with information about your bot's or application's commands.
Prerequisites
- Add the Node: Add a
TwitchCommandHelpnode to your scene. - Functional
TwitchAPI: A correctly configured and authorizedTwitchAPInode must be available and assigned. This is essential for sending the reply messages. - Other
TwitchCommandNodes: There must be otherTwitchCommandnodes registered in the project for this node to discover and list.
Configuration (Inspector Properties)
- Inherited
TwitchCommandProperties:Command(String): Set the command name users will type (e.g.,"help"). Defaults to"help"if left empty.Aliases(Array[String]): Optional alternative names (e.g.,["commands", "?"]).Description(String): A description for this help command itself (e.g., "Shows available commands or details for a specific command.").Args Min/Args Max: Typically0and-1(optional arguments accepted for specific command help).Permission Level(PermissionFlag): Set the minimum permission needed to use the help command. DefaultEVERYONE.Where(WhereFlag): Where the help command can be used. DefaultANYWHERE.
- Specific
TwitchCommandHelpProperties:Twitch Api(TwitchAPI): Required. TheTwitchAPIinstance used to send the generated help message replies.Sender User(TwitchUser): Optional. TheTwitchUserresource representing the user who will send the help message. If leftnull, the currently authenticated user (associated with theTwitchAPItoken) will be used as the sender.
Signals
This node does not introduce new public signals. It utilizes the inherited command_received signal from TwitchCommand to trigger its own help generation logic.
Methods
This node does not introduce new public methods intended for direct user calls. Its functionality is primarily executed internally when its command is triggered.
Usage Example
- Add Nodes: Add your regular
TwitchCommandnodes (e.g.,!dice,!socials) and oneTwitchCommandHelpnode to your scene (perhaps underTwitchService). - Configure
TwitchCommandHelp:- Select the
TwitchCommandHelpnode. - In the Inspector, ensure
Commandis set to"help". - Assign your active
TwitchAPIinstance (e.g., fromTwitchService) to theTwitch Apiproperty. - Optionally assign a specific
TwitchUsertoSender Userif you don't want the bot to reply as itself. - Set
Permission LevelandWhereas desired (e.g.,EVERYONE,ANYWHERE).
- Select the
- Configure Other Commands: Ensure your other commands (
!dice,!socials) have appropriatedescriptionproperties set, as these are used by the help command. Also, ensure theirwhereflags are set correctly.
Example Interactions (in Twitch Chat):
- User:
!help- Bot (Reply):
List of all Commands: !help, !dice, !socials | You can use '!help COMMAND' for details!(Order may vary)
- Bot (Reply):
- User:
!help dice- Bot (Reply):
[!dice - Rolls a six-sided die](Assuming the description for the !dice command is "Rolls a six-sided die")
- Bot (Reply):
- User:
!help socials dice- Bot (Reply):
[!socials - Shows social media links] [!dice - Rolls a six-sided die](Order may vary)
- Bot (Reply):