I love it when viewers clip my stream. They’re not all masterpieces, but I love the engagement, and I love not having to go back into VODS and generate clips myself even more. To better keep track of when other people clip my stream, I found some code on the streamer.bot extension Discord to automatically post clips to Discord that was mostly working to suit my needs and modified it to work the way I wanted. The result is a streamer.bot setup that will automatically detect new clips generated while you’re live, publish them in chat, and also post them to a discord channel.
Collect and Save the Discord Webhook URL
First, we want to grab a webhook URL from the channel we want to post to in Discord. To do this follow these instructions step by step (these instructions are for the Windows app version of Discord – steps may be similar in the browser or on mobile, but possibly not identical. We’ll then store this webhook URL in a file, so it’s obscured a bit from streamer bot, and won’t show up if you’re editing the action on stream or whatever.
- Navigate to the channel in Discord you wish to post to automatically
- click the little gear next to the channel name
- Choose Integrations in the menu and then click Webhooks on the Integrations page.
- If you already have a webhook for this channel you want to use, just open up the settings for your existing webhook and skip to step 6
- Click New Webhook to create a new webhook for this channel. Click the created webhook to expand and see a number of settings.
You can give it a name and a profile picture that shows up when it posts to your channel. - Now Click that “copy webhook URL” button to get the webhook URL into your clipboard.
- Navigate to your main streamer bot directory, and into the top-level folder called
data
- Under data, create a new folder called
keys
(you may already have this folder based on one of my other tutorials) - create a new text file in this keys folder called
wh-clip-to-discord.txt
and paste your copied webhook URL into this file and then save.
Import Streamer Bot Code
Copy the following block of text in its entirety to your clipboard. This import contains 4 actions, a queue, and one command. (triple-click to easily select)
U0JBRR+LCAAAAAAABADtWutz4jgS/35V9z9wqdpPN8rIL2xv1X4AEggkwywQnpf9IEuy8SDbnB88sjX/+7VsSACTbGZ29m629lKVSqxutbp//VBL9q9//1ulcrHiceJH4cWPFe1dPuAHyyhOR0/DajEc+KEfZMHz+AW+VC+Vix2VpwTGfpUP8BiSgEuWWpZG6OcoSSsN4S+TShpVrvyERjEr5gErydJ5FEvm5VyQmD8RnhW7UC7xJX4iMJ7Q2F+mO+I8TZfJj+/fJ/NoHfBtlMVOlF7SKHgPoqOApD4lQmzREtRAVKqBQClWqPH+Qgr9XBjByJERhMolEhj5VzFS2ZNyss/k6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nPw8OCb+F4tp7nnwEdfAV0mW7Kb0+WJE74PjGTl/L3ANtXXqsSzXbVKuQtxZwhnSkcWUT+xx3GCTM1yyy/zH/bRySlN/2/F90/+L1q8c+ev7iR+o1vrL74rakjIrrwQ+/MfdbR1yGcVRJZyLNlZX8t8pKeu7eQL2paFLHSFQZ+Ab8ljwM/TTkbJuc+fHoiv4Cw/1UvQ5+M/0f+6rB8Q/ccIKVrND/M7wHPIBoUVxL4OAJytF5bC1xEdpdGR1N9L4xiXo/SGi3eapZXLFjaYcrjkIgzDEv56WCSNuR8Hp+/M9yT8JmJ0imvTM6eydI1v34+kkwSPuBh4qfn77wuPBE5RDSiSLBoXTK/kH2e9pTZ2KwghCoOn0PSVtI5rySUhzyRo+jkzpWE6a4+KS/Fdn71+ZymQP78H3QBKDYcKgAA
- In streamer bot, click import at the top
- Paste this code into the box. It should show the four actions, 1 queue, and 1 command in the dialog.
- Click Import. Now we need to enable the imported command by going to the commands tab.
Enable the !resetclips Command
- Go to the Commands tab and find the imported “!resetclips” command. Double-click the command to edit.
- Check the enabled checkbox, and set the Permission Grant Type to Deny. This makes it so that only the streamer can use the command.
- Use this command to clear the current count of clips in the backend. You shouldn’t need it often, as we’ll also be setting this up to run automatically in the next section.
Verify Trigger for Automatically Resetting Clips
If you go to the actions tab and click on the new “delaythenreset” action, you SHOULD see that it has a trigger of type “Streamer.bot started”. This will fire whenever you first start streamer bot. It will wait one minute, and then run the “reset clip count” action automatically.
The reset clips count action essentially pulls the recent clips from Twitch, counts them, and then uses that number as a baseline for when we check to see if new clips have been created. Nothing too crazy, but it has to be done in C#, and you won’t have to edit this action at all.
Setting Up a Timed Action to Detect Clips
Now set up your timer to run the “detect new clips” action once a minute and wire up a trigger between that action and the new timer.
- In the actions tab, select the “detect new clips” action.
- In the triggers panel to the top right, you should see an unfinished “Timed Actions” trigger for this action. Double-click it to edit.
- In the dialog that pops up, click “Create Timer.” This will load the Timed Actions creation dialog, which can also be accessed through the Settings -> Timed Actions tab, but since Streamer bot 0.2.1 we can just do it this way and it’s so nice.
- In the dialog that pops up, check both checkboxes for “Enabled” and “Repeat”. Set the name to “Check Clips”, set the interval to 60 seconds, leave lines at 0, and click OK
- This new timer should now show up as the one selected by your trigger. Verify this and click OK. We’re done!
So What happens now?
Well, if everything works as intended, the following flow should occur:
When you launch streamer bot, a minute should pass and then you’ll see a chat message saying that the clip count has been reset.
Then, every 60 seconds, the “detect new clips” action will run, looking to see if the count of clips returned from the Twitch API is any bigger than the saved count.
If it does find a new clip, it compares the title of the clip to the title of the stream. If they are the same, it does nothing. Once it finds a new renamed clip, it posts a link to chat and mentions who clipped it. Streamer.bot will also post these clips to your Discord with the webhook that we set up at the beginning.
As always, let me know if you have any questions. Check out the Streamer Bot category for more Streamer Bot tutorials