I'm new to Nightbot (and streaming in general) so I'm sorry if this has been asked an answered already. I want to set up commands that will run automatically after a certain amount if streaming time has elapsed (specifically, I want a message that "fires" as soon as I go live and several others that display at certain times during the stream). I don't want the message to repeat until the same time during the next stream so using the Timer feature isn't quite what I'm looking for.
Thanks in advance for the guidance! 😊
4 replies
Quirky Fox
To do something like that specifically with nightbot would likely require you to use the api to send messages threw the bot when an event triggers. You could potentially do the send message at certain intervals throughout with use of a timer that check how long you’ve been streaming but wouldn’t be entirely exact. It would be a process similar to what’s detailed here. Just instead of followers when u start stream. /t/nightbot-alerts-in-chat/1534589171388125265
Polar Cat
Hey @Sunny Turkey!
Yes, of course you can use timers for that, but you have to get creative!
Simply set it up short enough, I recommend the minimum: 5 minutes, and then when the timer runs have it look at the amount of time you've been streaming, and only send a message if it's the right moment of the stream.
You'll need to use Pastebin, that way you'll only set up one timer, and you'll be able to fit all your messages in it.
if (Math.abs(parseInt(e) - parseInt(currentTime)) <= 5) {
timestamp.push(e);
}
});
messages[timestamp[0]] || ' ';
• Replace XXXXXXXX in the timer code with the paste ID. • Feel free to edit the messages in the Pastebin by following exactly the formatting here (of course you can have more than 5 messages); you can change the message times by editing the numbers. • Make sure the paste is public or unlisted (do not make it private) and that it's set to never expire.
Please note that it'll skip messages if your chat isn't active, messages can also be a bit delayed (by a maximum of 5 minutes).
I recommend setting up a Pastebin account so you can come back later to edit your messages.
Sunny Turkey
Thank you for that replay. I'll have to learn what all that coding means but it's a place to start. 😊