Skip to content Skip to sidebar Skip to footer

How to Get Streamlabs to Read Api Command

Creating a Twitch Command Script With Streamlabs Chatbot

Step-by-pace guide to creating Twitch commands

Nintendo Engineer

Photo by Caspar Camille Rubin on Unsplash

Necessities

You can ignore the API Fundamental field for this exercise.

What Are We Building?

Basic Setup

File naming

Mulder seems similar an appropriate name for this command.
              C:\Users\USERNAME\AppData\Roaming\Streamlabs\Streamlabs Chatbot\Services\Scripts.            

Basic structure

Yous don't take to include the comments (gray sections).

Your IDE might complain almost the uppercase "I", but SC wants it this way.

Yeah, yeah, capital "E", we know.

We won't utilize this in our example, but information technology can be useful when creating more advanced commands.

Based on PEP 8, PyCharm suggests ii new lines between methods, so I just follow suit.

Loading the script

Look at Mulder shining there!

Implementing the Logic

Python works with zippo-based alphabetize, so the starting time thing in the bulletin is at alphabetize 0.

Looking adept and then far!

random_chance ≤ alien_probability already equals True or Fake, then we utilize that as return value.

Doesn't await like much, just it volition keep our code more legible in the long run. Can you imagine reddish squiggly lines everywhere?

We'll reference the username variable instead of getting it from data every time.

Look at yous become! You lot're a pro-Twitch-command creator.

Trying It Out

Skillful stuff!

Simply considering I don't need oxygen to survive… Mulder likes to overreact.

Appendix A: Debugging

Logging

You tin place information technology all the way at the lesser, underneath the send_message method.

The circular "info" push.

Looks good to me!

Appendix B: Nice to Have

Adding a cooldown menstruum

That should put a paring in the number of triggers.

At present the trolls have been thwarted!

I guess he must be speechless after his faulty conclusion last fourth dimension.

Adding UI

It'due south kinda empty in here…

Mind the brackets and the quotes.

value: the initial value, label: what appears in a higher place the box, tooltip: when you hover over it with your mouse.

What'due south this!? Your Mulder is evolving!

Then far, so good.

This is automatically generated by SC. Nice, huh?

Nosotros'll get to using these next.

Empty at beginning, we'll load the values next.

Now Python knows that we mean our global settings object when nosotros employ it in the method.

Only a little longer, you lot can do information technology!

We accept loaded the settings!

Same, but not the same?

Brand sure the spelling is right!

The End

starnercareekeres.blogspot.com

Source: https://betterprogramming.pub/creating-a-twitch-command-script-with-streamlabs-chatbot-step-by-step-a9f8cccd680d

Post a Comment for "How to Get Streamlabs to Read Api Command"