Hi again. Sorry it's been a while! I actually have one other post that's been baking in the oven for a while now. I should really finish it. But in the meantime, here's something you might like.
A few months ago, I released a Pastebin custom API - you can use it to serve content directly from pastes on Pastebin, which means you can make some pretty gnarly commands. There's an assortment of examples in the Paste Library; they each use various different parameters, which can all be combined in some way, so feel free to dig around and get inspired. This post mostly deals with how you can use what I call 'filters', so strap in!
In short, filters are a way to only return specific lines, depending on the 'tag'. Essentially, each possible line is marked with a tag. These take the format:
:[tag] - where
Multiple lines can be tagged, and the same tag can be used multiple times. If there are multiple lines with the same tag, then a random one of those lines will be returned (unless you use indexes, but that's something else). If no lines are matched, then an untagged line will be returned, and if there aren't any of those, nothing is returned at all.
But what does this mean? It means you can pass in some sort of selector, which determines which line should be returned. What if we passed in something constant, like... the command sender's username? Then, maybe we could return lines for specific people?!
Let's give our subs their own special greeting when they say hello.
First, we need something to trigger a greeting. A simple regex of different greeting keywords ought to do the trick.
First, head to your StreamElements custom commands dashboard, and add a new command. You can make the command name itself anything you like. For consistency, you could have something
In any case, I would probably recommend avoiding any greedy selectors that act as wildcards. For instance, you don't necessarily want it matching 'hey <other_username>', because someone might just be saying hello to someone else. (You might be able to use a super long cooldown to avoid this however).
Going deep into regex isn't the goal of this post, so I'll leave that to you to figure out. Here's a very basic regex that will match messages like "hi", "hey", "hello" as well as "
Of course, this won't match things like "hello there", but you can add that to the list if you like. Expand the regex as you see fit.
Now we need to make a paste with our possible responses. Head over to Pastebin and sign in or make a free account. It's not entirely necessary, but it does allow you to edit your pastes later, which is very useful as it allows you to add/remove people in the future.
Start a new paste and using the following format to create your sub-specific greeting message.
:[username] Hi there username, welcome on in!
Replace the username part with the sender's username obviously. It's not case-sensitive. Hit enter to make a new line and add someone else below that. Add as many different people as you like. You can even give some people multiple lines; a random line will be picked.
You'll end up with something like this:
Create the paste and keep it there for now. Head back to StreamElements.
Now that we have something which triggers the response, and our possible responses, we need to display the response itself- we'll use a
XXXXXXXX with your paste key - that's the alphanumeric string on the end of your paste's link (i.e.
Consider adding a lengthy user cooldown to the command so that it doesn't get spammed, then save it. It's done! Now, whenever a viewer says hello and matches the regex, a custom greeting will pop out.
Hopefully, this sheds some light on how you can use these filters to do cool stuff, and maybe you can make more user-specific commands for other neat things.
Until next time!