Streamlabs Chatbot — Creating an (almost) autonomous user-created custom welcome message program

Out with the old, in with the new…

Resonant Drifter
5 min readApr 15, 2018

In a previous article before Ankhbot decided to join forces with Streamlabs I had written about how to use Ahnkbot to create an (almost) autonomous user-created custom welcome message program, which worked having the user enter a command followed by their desired welcome message. Ankhbot would then take the necessary amount of loyalty points from that user and save their message in a text document. When that person entered chat from that point on, the bot would automatically display their custom welcome message in chat. Brilliant!

However, some things have changed since the big merger with Streamlabs so, upon receiving a few requests, I decided to update the article to reflect those changes. Here it is.

ALMOST AUTONOMOUS

Again, I have to note that much like the previous set up, this one is almost entirely autonomous. There is no way to have the bot automatically set the needed “On Join” event. You will have to do that manually. Otherwise, it’s all pretty cut and dry.

CREATE AN EVENT

First we are looking at creating an “On Join” event because, as the documentation states, “ The On Join Event System will perform its action when the person of your choice joins the channel. Then it will post its message and/or play its SFX.” Perfect.

In the EVENTS tab you’ll want to click the “+” button in the top right corner to add a new event. You’ll then see a screen like this.

The four main things we are focusing on here are the Username, Mode, Enabled and Message.

  • Username will be the exact username of the viewer as it appears in the bot.
  • The Mode defines if this Event happens when the viewer joins your chat or speaks for the first time. For the sake of this tutorial, set this to JOIN.
  • Set Enabled to TRUE because we want this to actually work.
  • In the Message box we aren’t typing the exact message that the user wants, but where to find it which will make sense in a little while. For now, you will use the $readline() parameter to tell the bot to display the text in a text document found at a certain location. So the bot knows which text document to read, we are going to have it look for $user.txt in whatever folder you have designated. For example, the completed parameter will look something like this: $readline(C:/folder/$user.txt)

An important note: Client Only is automatically set to FALSE which is what we want so make sure that it still is. Client Only: False means everybody will be able to see the message. Client Only: True means only the specific viewer will be able to see the message.

An alternate note: this is also where you would set any sound effect and that sound effects volume if you wanted a SFX to play when someone entered the chat.

That’s all we need here. Save and let’s move on to actually creating the command that will set what’s in the $user.txt.

CREATE A COMMAND

As I just stated, we are going to now create the command. The way this command works is the user will type in !command message and the bot save that message in a specific area you set activating whatever functions you set (cost, cooldown, etc.). For example, !buywelcome Float like a butterfly, sting like a bee! would save the message Float like a butterfly, sting like a bee! in a specific area for the On Join event to read when I enter chat later.

Click on the COMMAND tab and the “+” button in the top right corner to add a new command. You’ll see a screen like this:

I didn’t highlight anything in particular in this window because we’ll be potentially using all of these functions.

  • Set the Command to whatever you want people to type in order to activate the command. I think I used !buywelcome previously so that’s what I would type in here if I were to use it again.
  • The Cost is how many loyalty points the user will use when using the command. This is completely up to you.
  • The Usage is where you want this command to be used. Essentially comes down to Stream/Discord Chat or Whisper. This is up to you but I keep mine at STREAM CHAT since I want this to be used within my Twitch chat.
  • Enabled is set to TRUE, of course.
  • Group is whatever group you want to put it in as per your organizational efforts.
  • Permission is EVERYONE unless you want to restrict this to a specific user group or even a specific person (whom you would then set this to User_Specific and name them in the Info slot).
  • Cooldown and the User Cooldown is up to you. I don’t have one since they are paying to use the command, but you can set one of these if you like. It’s set in minutes.
  • Response is going to save their message to a specific area of your choosing using the full $overwritefile() parameter as seen in the documentation. We use this rather than the $savefile() parameter because we want the user to be able to overwrite their welcome message with whatever new message they set the next time they use the command. Make sure the area you save the file in is the same as where you have the “On Join” event reading it from or this won’t work. The full parameter is this $overwritefile(“FileLocation”,”Text”,”SucceedMsg”,”FailMsg”) and would look something like this $overwritefile(“C:/folder/$user.txt”,”$msg”,”You have set your user message to ‘$msg’”,”Something went wrong. You should try again.”) We use the $msg parameter because messages can get rather long ($target can only go to 9).

With that complete, you are actually done!

You could also create something like a !readwelcome command to read your message at any time and to make sure it was input correctly. To do this create a new command just like we did with the last (probably don’t want them to charge for this one though) and in the Response area put $readline(C:/folder/$user.txt). Essentially you are allowing them to do at any time what the bot can automatically when they join the chat. Simple as that!

SKYNET IS REAL

That’s all I got for you on this — I hope it helps! I also hope it helps inspire you to play around with Streamlabs Chatbot as well. It has gotten a tad bit more restrictive since they combined Ankhbot with Streamlabs, but it is still a very powerful system to have at your command.

If you have any questions, comments or concerns let me know in the comments below!

--

--