Custom Commands

Custom Commands Extension for Streamer.bot

Description

This extension aims to emulate the functionality of simple chat command/responses that StreamElements and Nightbot are capable of. The goal is to give your moderators the ability to create simple command/responses without needing access to Streamer.bot. This extension also works cross-platform between Twitch, YouTube, and Trovo and works across these platforms even when multi-streaming to some or all platforms at the same time.

Import Code

CustomCommands-0.3.0.sb (38.1 KB)

The Custom Commands extension is designed for Streamer.bot v0.2.3 and higher and will not work for older versions.

Installation

In Streamer.bot click the Import button in the top menu. Drag and drop the .sb file into the Import String field.

In case you missed the popup, imported commands are disabled by default as a security measure. Follow the first step to enable these commands.

Enabling commands

  1. Go to the commands tab
  2. In the filter input, type Custom Command
  3. Right-click the Custom Commands group, select Group, then select Enable All

enableCommands

Configuration

All configuration is done through the Custom Commands 1. Configuration action.

Send responses as bot

Edit the Set Argument subaction to change %customCommandsSendAsBot% value to:

  • True - send response as bot account
  • False - send response as broadcaster account

sendAsBot

Custom Commands Moderator Permissions

You can edit the value of %permissionSetting% to:

  • 4 - broadcaster only
  • 3 - moderators and higher
  • 2 - VIPs and higher
  • 1 - anyone (this is NOT recommended)

permission

Give specific users Custom Commands Moderator Permissions

You can add users to the user group specified in the Set Argument subaction.

groupPermission

You can add to the user group in Settings > Groups or from the Viewers tab

Command Moderation Usage/Syntax

Adding, editing, removing of commands, as well as creating/removing aliases and cooldowns for existing commands can be done with the commands:

  • !commands
  • !command
  • !cmd

Adding / renaming / editing / removing commands or aliases

!commands <function> <command> <response>
Functions Description
add
create
create a new custom command
rename rename an existing custom command or alias
edit
modify
edit the response of an existing custom command
del
delete
rem
remove
remove an existing custom command or alias
alias
nick
nickname
add an alias to an existing custom command OR
see a list of aliases for a custom command

Adding a command

Rondhi: !commands add test2 this is a test

RondhiBot: Rondhi -> The command "test2" has been added successfully.

Rondhi: !test2

RondhiBot: this is a test

Renaming a command/alias

Rondhi: !commands rename test2 test3

RondhiBot: Rondhi -> The command "test2" has been renamed successfully to "test3".

Editing a command/alias response

Rondhi: !commands edit test2 this is a test of editing the command for test2

RondhiBot: Rondhi -> The command "test2" has been edited successfully.

Rondhi: !test2

RondhiBot: this is a test of editing the command for test2

Adding aliases

!commands alias <command> <desired alias>

Example:

Rondhi: !commands alias test2 test3

RondhiBot: Rondhi -> Alias 'test3' added for command 'test2'.

Rondhi: !test3

RondhiBot: this is a test of editing the command for test2

Removing a command

Rondhi: !commands remove test2

RondhiBot: Rondhi -> The command "test2" has been deleted successfully.

Removing an alias

Rondhi: !commands remove test3

RondhiBot: Rondhi -> Alias 'test3' removed for command 'test2'.

Listing available aliases for a command

If an alias exists

Rondhi: !commands alias test2

RondhiBot: Rondhi -> The aliases for the command 'test2' are !test3

If an alias doesn’t exist

Rondhi: !commands alias test2

RondhiBot: No aliases found for command 'test2'

Editing cooldowns

Global cooldowns

Rondhi: !commands cooldown test2 15s

RondhiBot: Rondhi -> The command global cooldown for "test2" has been updated to 15 seconds.

User cooldowns

Rondhi: !commands cooldown test2 10s

RondhiBot: Rondhi -> The command user cooldown for "test2" has been updated to 10 seconds.

Cooldown durations use the following syntax:

d for days, h for hours, m for minutes, s for seconds

Examples: 5d4h3m, 1h30m, 5m, 1h

Variables in Responses

You can use these variables in your response to get some dynamic responses. All variable names are case-insensitive.

Variable Name Description Syntax Example
%Count% Get and increment every time you call this command This command has been used %Count% times! This command has been used 1 times!
This command has been used 2 times!
This command has been used 3 times!
%redeemer%
%user%
%userName%
Get the user name of who calls the command %redeemer% wants a cookie
%User% wants a cookie
Rondhi wants a cookie
%userId% Get the user’s ID %redeemer%, your YouTube User ID is %UserID% Rondhi, your YouTube UserId is UC9UkEI92qqrsZP4We5Bci9B
%target%
%targetUser%
%targetUserName%
%ToUser%
Get the first argument after the command. The target must be a valid user %redeemer% has hugged %target%
%User% has hugged %ToUser%
Rondhi has hugged KermitThePOGGIES
%targetCount% When targetting a user with %target%/%targetUser%/%ToUser%, you can increment the amount of times this command has been used on the target %redeemer% has hugged %target% %targetCount% times! Rondhi has hugged KermitThePOGGIES 69 times
%points% If using TerrierDart’s Points System, get the redeemer’s current points total %redeemer% has %points% points Rondhi has 5186 points
%targetPoints%
%pointsTarget%
If using TerrierDart’s Points System, get the target’s current points total %target% has %targetPoints% points RondhiBot has 12006 points

Caveat with targeting users on YouTube

YouTube allows users to have matching display names. So the current way I combat this is to keep a list of present users and if someone is targeted, it compares the display name against lastActive, then by previousActive.

Contributors

5 Likes

Tested basic functionalty. It works as expected.
Good job rondhi!

1 Like

I’m having some issues when I test it on YouTube. It keeps saying the users don’t exist.
image

Thanks for testing, I haven’t been able to test on YouTube. Found some bugs.

2024-04-06
Found some more bugs with help from Haunter doing some testing for me while streaming to YouTube.

  • Trying out a more robust method of matching target users on YouTube by ignoring case, whitespace, and non-alphanumeric characters
  • Removed all VStream related code and actions. RIP VStream :saluting_face:
1 Like