Want a quick and easy command to let your users generate a silly dad joke? Easy. Here’s how to set up a command in cloudbot that will allow your users to type !dadjoke and your bot will make a dad joke.
Use the iCanHasDadJoke API
the easiest way to do this kind of command in a bot like StreamLabs is to use an external API that provides the random result. If you can find or make an API endpoint that returns a simple text result, you can easily use it in most chatbots.
In this case we’re using the https://icanhazdadjoke.com/ API, specifically with the /nightbot parameter at the end which forces it to return text only.
Utimately the URL that you should copy and paste is: https://icanhazdadjoke.com/nightbot (it’s not a typo… you use the /nightbot parameter even with other bots)
Setting Up the Command
I’ll assume you already have cloudbot set up and have added it to your channel. If you have not, go see this guide about setting up Cloudbot and then come back.
Next, go the the dashboard, click “cloudbot” on the left side, and then choose commands along the top and choose Custom.1
Then click the add command button.
In the dialogue that appears, you can leave the Template dropdown empty or unselectd. Enter !dadjoke as the command. In the response column type or copy/paste the following string (you can triple-click to copy easily):
{readapi.https://icanhazdadjoke.com/nightbot}
Keep the Reply In set to chat, set permissions how you like them (defaults to Everyone, where anyone can use the command), and then click confirm and you’re done!
Now when your viewers type !dadjoke in chat, the bot will make a dad joke by calling that API endpoint and sending the result to chat. I hope you don’t have too many groaners.
Enjoy, and feel free to send this along to anyone else who might like to make a dad joke command for cloudbot.