How to Automate Tweets/Discord from Twitch Live Streams
Tags: tutorial, wayscript
Published: 2020-07-31 10:12:27

Introduction
------------

Live Streaming is one of the most entertaining media on Earth. With more than 90,000 channels live daily, Twitch is the number one platform for Streamers.  
Today, with Wayscript we are going to build a script to post on Twitter and Discord about current live Streams.

Prerequisites
-------------

No prerequisites for this post, but here is some documentation you might find useful.

*   [Working with Time Trigger](https://docs.wayscript.com/library/triggers/time-trigger)
*   [Working with Twich](https://docs.wayscript.com/library/modules/twitch)
*   [Working with Loops](https://docs.wayscript.com/library/logic/loop)
*   [Working with Discord](https://docs.wayscript.com/library/modules/discord)
*   [Workign with Twitter](https://docs.wayscript.com/library/modules/twitter)

Trigger
-------

For this tutorial, we’ll use Time Trigger and choose an appropriate time. Then, the script will automatically run at this precise time.  
Add Time Trigger as a trigger.

![Adding Time Trigger](https://wayscript.com/blog_img/121/1.png)

Then set the script to run every dat at 8:00 pm.

![Configuring the Trigger](https://wayscript.com/blog_img/121/2.png)

Get Current Live Streams
------------------------

Wayscript provides a Twitch module that you can use to get data about channels, users, or streams. Add the module as a new step.

![Addint Twich Module](https://wayscript.com/blog_img/121/3.png)

Once it’s done, you’ll have to choose a model. For this post, we’ll get a list of the current top streams. This list will contain the top 10.

![Configuring Twitch module](https://wayscript.com/blog_img/121/4.png)

The next step is to choose the output we are going to work with.

![Choosing outputs](https://wayscript.com/blog_img/121/5.png)

Posting on Twitter and Discord
------------------------------

If you noticed, the output containing the current live streams is a list. It means that to properly post on Twitter and Discord, we have a loop through it and work with each item.  
Add a loop as a new step.

![Adding loop](https://wayscript.com/blog_img/121/6.png)

As I said earlier, we must loop through the list.

![Adding the variable](https://wayscript.com/blog_img/121/7.png)

Great. Once it’s done we can now add Discord and Twitter modules to the party.

![Adding Discord and Twich modules](https://wayscript.com/blog_img/121/8.png)

If you have an account on Twitter, add it and set the mode to Post a Twitter status. The message will simply be List\_Of\_Top\_Streamers\_Item.

![Twitter configuration](https://wayscript.com/blog_img/121/9.png)

Once you’ve finished with it, we can configure the Discord module. You’ll also need to add an account and choose the channel into which you want to write the message.

![Discord configuration](https://wayscript.com/blog_img/121/10.png)

Wayscript lets you provide a lot of useful inputs such as the name of the bot posting the message in the channel and an image URL.

![Message in Discord channel](https://wayscript.com/blog_img/121/11.png)

Great! The script is now ready to run automatically, so be sure you have the Time Trigger switched on. :)

Conclusion
----------

Questions about this script or anything else? Join our [Discord](https://discord.gg/VWbXSbj). We're always around to help. If you want to work with the full script template, just find it [here](https://wayscript.com/user/mangabo_kolawole/RGezhF82
        )

[](https://wayscript.com/user/mangabo_kolawole/RGezhF82
        )