Aliases and PSAs allow you to make the bot say things so you don't have to.
In the case of aliases, you can create simple commands that make the bot give a canned response whenever a !command is said. PSAs are similar, but either respond automatically on a timer, or whenever a message contains a specific word/phrase.
If you're in your own twitch channel, or are whitelisted then you have permission to create/modify aliases & PSAs, as detailed here.
To create or update an alias, use \alias <key> <text>.
<key> is the word that will follow the exclamation mark for the new alias.
<text> is what the bot will respond with, don't add quotes unless you want them in the response.
<me> | \alias hello Hello there, %t
<insobot> | me: Alias hello set.
<me> | !hello
<insobot> | Hello, me
This alias uses %t, which is one of the printf-style format sequences available.
This is a full list:
%t - Replaced by the name of whoever invoked the !command.
%a - Replaced by any arguments to the !command (text after it).
%n - Equivalent to %a if %a isn't an empty string, %t otherwise.
%u - URL-Encoded version of %a
To remove an alias, use \unalias <key>
<me> | \unalias hello
<insobot> | me: Removed alias hello.
To view available aliases in a channel, use \lsa
<me> | \lsa
<insobot> | me: Aliases in #here: !hello !test !something !keyboard
To change the required permissions to use an alias, use \chamod <key> <permission>
<permission> is either NORMAL, WLIST, or ADMIN.
Note that ADMIN is not particularly secure, since it only requires WLIST permission to use this permission changing command...
Local vs Global Aliases
<me> | \chamod hello WLIST
<insobot> | me: Set permissions on hello to WLIST
All the commands mentioned previously are local to the channel that they are used from. So if you create an alias called hello in #place_a, it won't be available
However there are an equivalent set of commands to create "global" aliases, that will be available in all channels on the same server. These are the same, but with an added 'g' character.
Here's a table:
Command | Local | Global
Create | \alias | \galias
Update | \alias | \galias
Remove | \unalias | \gunalias (cue firearm jokes)
List | \lsa | \lsga
Use them wisely.
Multiple keys for local aliases
Sometimes you might want an alias to be available via multiple keys. Copy pasting is an option, but if you want to update the text, you'd have to redo them all.
Fortunately there is a special syntax added by ChronalDragon to simplify this case.
When any one of the linked keys is updated, all the keys will recall the new text.
<me> | \alias test This is a test
<insobot> | me: Alias test set.
<me> | \alias boop -> test
<insobot> | me: Alias boop set.
<me> | !boop
<insobot> | This is a test
<me> | \alias boop Something else entirely
<insobot> | me: Alias boop set.
<me> | !test
<insobot> | Something else entirely
To create/update a PSA, use \psa+ <key> [options] <time>m <text>
<key> is a name you make up to identify the PSA, much like aliases
<time> is the cooldown in minutes, note the m that follows this is currently needed, i'm not exactly sure why though, so maybe I'll remove it soon...
[options] can one or more of the following:
- causes the PSA to only fire when the channel is live (on twitch)
- +trigger '<regex>'
- makes the PSA fire when the given regex matches a message,
in this case <time> will be the minimum wait before it can fire again.
I hope you got all that, it'll be on the test. Here are some examples:
Send the message every 20 minutes, if the stream is live
Send the message when someone says "keyboard" or "kbd" with a 5min cooldown
<me> | \psa+ safety +live 20m Don't run with scissors.
<insobot> | PSA [safety] Added.
Recall the alias "!welcome" when someone says anything, with a 15min cooldown
<me> | \psa+ kbd +trigger 'keyboard|kbd' 5m The keyboard currently in use is the Yamaha PSRF51
<insobot> | PSA [kbd] Added.
Send the message when "alot" is said, and the stream is live, with a 10m cooldown
<me> | \psa+ greet +trigger '.' 15m !welcome
<insobot> | PSA [greet] Added.
<me> | \psa+ alot +live +trigger 'alot' 10m https://hyperboleandahalf.blogspot.co.uk/2010/04/alot-is-better-than-you-at-everything.html
<insobot> | PSA [alot] Added.
To remove a PSA, use \psa- <key>
<me> | \psa- safety
<insobot> | me: Deleted psa 'safety'
To view a list of PSAs in the channel, use \psa
<me> | \psa
<insobot> | Current PSAs: [alot: 10m trigger='alot' (when live)] [kbd: 5m trigger='keyboard']
That should about cover it. If i've missed something, or you have questions, ask away below.