Let’s make a !dadjoke command for StreamElements! It’s super easy and if you follow these simple steps your bot will be spewing groan-worthy jokes in no time. Let’s get into it, here’s how to add a dad joke command to StreamElements.
Use the iCanHasDadJoke API
The simplest way to do this kind of command in a bot like StreamElements is to use an external API. 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 iCanHazDadJoke.com API, specifically with the /nightbot parameter at the end which forces it to return text only.
Ultimately, 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 the StreamElements chatbot set up and have added it to your channel. If you have not, check out this guide to setting up StreamElements Chatbot then come back.
Next, go to the dashboard, click Chatbot, then Select Chat commands from the menu. On the page that loads, click Custom Commands along the top (next to Default Commands)
Then click the Add New Command button.
In the dialogue that appears, you can leave the template stuff on the left alone. Enter !dadjoke as the command name (the ! should be there for you already). For Response type you can leave it on Say, or switch it to Reply if you want the bot to reply to the chat message.
Leave the User level set to Everyone, unless you have some particular reason to lock it down to VIPs or Moderators or something. If you want to set cooldowns, click the Advanced Settings tab at the top and find them there. For the Reponse type use the following
$(customapi.https://icanhazdadjoke.com/nightbot)
Go ahead and click “Activate Command” and you’re all set.
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 StreamElements.