Sunday, 22 October 2023

Add a Twitch randomised fact command

 

I recently had a conversation with a friend on stream about creating a twitch chat command that would put a random fact in to the chat.
After some poking around with Streamer.bot I came up with this.
This may not be the most efficient method for doing this, but it was something I was able to set up in a few minutes.

You essentially have a number of actions which are your facts being entered into chat and another action, which is triggered by a twitch !command, that gets a random number between 1 and the amount of facts you have and selects the corresponding action.

I thought I'd leave it here in case anyone finds a use for it.
Do you have an idea for streamer.bot that you want to turn into a reality, drop a comment and let me know!
If you haven't already, I'd suggest you also check out their discord, there's some very friendly and clever people over there. https://discord.gg/VmdKdmVya2

Add a randomised Foxy Facts chat command


go to actions tab

right-click in action list

click add



Give it a name

and you might want to add them to a group for ease of viewing later

click ok



For that action go right-click on sub-actions on the right

hover over "Twitch" and "chat"

click send message to channel



enter the fact

click ok



do that for all the quotes you have


right-click and add another action

do the same as before (add a name like “Foxy Facts”, group, click ok)

right-click in sub-action, hover over "core", "logic", click "Get Random Number"




Enter from “1” and the number of facts you have



Click OK


right click in sub-action again, hover over "core", "logic", click "If/Else"



enter the variable as "randomNumber"

enter the value as 1

click "do action" (the button will say <No Action Selected>)



scroll and select the first fact action



we need to add a sub-action for each fact we have

so, we right-click "core", "logic", then "If/Else"

enter the variable the same "randomNumber"

enter the value of 2 and so on

click "do action" (the button will say <No Action Selected>)


Once we've done all that, we need to set a trigger

click on the “Commands” tab

right-click on the list and click “Add”



Give it a name

give it a command like “!foxyfact”



if you want to set a cool-down, you can do that on the bottom right


click OK


Go back to “Actions” and click on “Foxy Facts”


right-click in “Triggers”

Hover over “Core”, “Commands” and “Command Triggered”



scroll and select the second fact action and so on



Now, whenever someone puts “!foxyfacts” (Or whatever you called it)

It will put a random foxy fact in chat.