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.1.sb (39.3 KB)
customCommands-0.4.0.sb (beta) - I’ve only done self-testing. If you use this, please leave a comment and let me know if it works! (44.1 KB)

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

Custom Commands v0.4.0 is designed for Streamer.bot v1.0.0+ and will not work with older versions.

Changelog

v0.4.0 (2026-03-13)

+ Exported from Streamer.bot v1.0.4
+ General code cleanup
+ Added support for Kick
+ Added %redeemCount% for user specific count of redeems (%count% is used for global count)
- Revamped the Command Regex and how the code handles input
- Fixed bug when replacing arguments with a null value
- Removed sending chat message that reads "command doesn't exist"

v0.3.1 (2025-07-24)

+ General code cleanup
+ Exported from Streamer.bot v0.2.8

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

Bot Response Fallback

If %customCommandsSendFallback% is true, that means that if the bot is not connected, then the broadcaster will send the response

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)

Give specific users Custom Commands Moderator Permissions

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

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

Command Moderation Usage/Syntax

The command uses regex ^!command(s)?\b.*|^!cmd\b.*

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 / managing cooldowns

!commands <function> <command> <response>
Functions Description
add
create
mk
create a new custom command
rename
mv
rename an existing custom command or alias
edit
modify
edit the response of an existing custom command
del
delete
rem
remove
rm
remove an existing custom command or alias
alias
nick
nickname
ln
add an alias to an existing custom command OR
see a list of aliases for a custom command
globalcooldown
cooldown
gcd
cd
set a global cooldown so commands can’t be used for a certain amount of time
usercooldown
usercool
ucd
set a cooldown specific per user

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, 30s

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
%commandName% The name of the command being run This command is called %commandName% This command is called !flea
%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!
%broadcaster%
%streamer%
Get the name of the broadcaster %broadcaster% likes to eat cookies
%streamer% likes to eat cookies
Rondhi likes to eat cookies
%redeemer%
%user%
%userName%
Get the user name of who calls the command %redeemer% wants a cookie
%User% wants a cookie
Pokimane 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. Increments only when this variable exists. %redeemer% has hugged %target% %targetCount% times! Rondhi has hugged KermitThePOGGIES 69 times
%redeemCount% Return the number of times this command has been used. This number increments whether or not this variable exists. %redeemer% has run this command %redeemCount% times! Rondhi has run this command 69 times!
or
KermitThePOGGIES has run this command 67 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

Streamer.bot doesn’t have the ability to Get User Info for Targets and YouTube allows users to have matching display names. So the current way I handle this is to keep a list of present users and if someone is targeted, it compares the display name against lastActive, then by previousActive. If the user has not been active in the past seven days, they will be cleared out of the userList.

Contributors

14 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:
2 Likes