Timers Not Working

My Nightbot timers have not been working recently. I added a sponsorship timer from streamelements and nightbot has recently picked it up and that is the only timer that works. All of the 10 different ones I have are not coming through. Anyone have any suggestions or could help with this? I even tried logging out and re adding nightbot to my channel but still nothing.

Hey @rubmuncher!

Given there’s at least one timer that’s working, it suggests that this is an issue caused by a human.

Note that if you have too many timers supposed to go at the same time, Nightbot will limit the amount of timers going out in order to prevent spam.
One solution could be to use staggered timers, though using the Quote API will introduce limitations, if it stops working you’ll likely have to clear your quotes list. The other solution, which I think is better because it doesn’t rely on the Quote API, is messages sent at specific stream uptimes, it requires a bit of work to adapt the code to fit your needs, but it’s doable; if you’re interested in this solution but can’t figure out how to adapt the code, let me know, I’ll work on it when I have a minute. Shifted timers might also interest you.
If none of those suggestions fit your needs, maybe what you’re looking for is the Multiple Messages API that allows you to send multiple messages in a short amount of time.

Next, a lot of people having issues with timers often haven’t read and taken the time to understand those two indications when they set up a timer, so I suggest paying attention to it:
202403 7110412

Ya I would love some help on the messages sent at specific uptimes. I space all my timers out roughly the same. So timer 1 is 10 lines 10 minutes, 2 is 15 lines 15 minutes 3 is 20 minutes 20 lines and so on. Not sure what intervals are best as I have maybe 10 or so timers but any help would be appreciated!

i feel like those number of lines r kinda high, is your chat super active?.. most of the streamers i mod for r relatively small streamers so we leave most timers at the minimum number of lines, which is 2

Not really even though I have decent average viewers. So you are saying set everything to 2 lines? What is a recommended time interval?

i make no recommendations on actual values… what i do recommend is try adjusting them and find what works best for your chat ^^ … and the first place i would start is lowering the number of lines

Ok thank you I will try that!

1 Like

Yeah, I think your biggest issue is your number of lines, it seems like you don’t completely understand how timers work, hence the parts I highlighted in my first response. Once again, pay attention to it.

But since I know it’s often not enough for people to understand, here’s a detailed description based on your settings:

This timer would send a message to chat every 10 minutes, at h:00, h:10, h:20, h:30, h:40, and h:50, given there were at least 10 messages sent in your chat within the 5 minutes preceding the timer trigger time, from h:05 to h:10, from h:15 to h:20, from h:25 to h:30, from h:35 to h:40, from h:45 to h:50, and from h:55 to h:00.

This timer would send a message to chat every 15 minutes, at h:00, h:15, h:30, and h:45, given there were at least 15 messages sent in your chat within the 5 minutes preceding the timer trigger time, from h:10 to h:15, from h:25 to h:30, from h:40 to h:45, and from h:55 to h:00.

This timer would send a message to chat every 20 minutes, at h:00, h:20, and h:40, given there were at least 20 messages sent in your chat within the 5 minutes preceding the timer trigger time, from h:15 to h:20, from h:35 to h:40, and from h:55 to h:00.

That means that you could have, if the chat lines requirement is met for each timer, the following timers trying to post at the following times:

  • h:00: TIMER_1 TIMER_2 TIMER_3
  • h:10: TIMER_1 _______ _______
  • h:15: _______ TIMER_2 _______
  • h:20: TIMER_1 _______ TIMER_3
  • h:30: TIMER_1 TIMER_2 _______
  • h:40: TIMER_1 _______ TIMER_3
  • h:45: _______ TIMER_2 _______
  • h:50: TIMER_1 _______ _______

Too many timers sending a message at the same time will result in some messages not being sent.

I hope that it’s clear for you now, because it takes a lot of time to explain those things. If you search for “timers don’t work” posts on the forum, you’ll find that explained how timers work so many times already, it’s always the same issue.


Now, given you have 10 timers, you’ll still encounter issues because too many will try to send a message at the same time, so you’ll have to use one of the solution I shared above, if you’re going with the second one and need help adapting the code I can look into it, but you’ll have to be patient because my time is limited, and I already spent a lot of time writing the explanation above.

Okay, so all the code that needs to be edited from the messages sent at specific stream uptimes code to adapt it so it sends messages depending on the uptime’s minutes, is the Pastebin code:

const messages = {
	'00': 'Message at 0 minute of stream uptime (ignoring hours value)',
	'10': 'Message at 10 minutes of stream time (ignoring hours value)',
	'25': 'Message at 25 minutes of stream time (ignoring hours value)',
	'30': 'Message at 30 minutes of stream time (ignoring hours value)',
	'55': 'Message at 55 minutes of stream time (ignoring hours value)'
};

const messagesTimestamps = Object.keys(messages);

const findData = (string, regex) => string.match(regex) || '0';
const keepAmount = string => string.split(' ').filter(e => isNaN(e) === false);
const normalizeAmount = string => string.padStart(2, '0');
const arrayToString = array => Array.isArray(array) ? array.join('') : array;

const minuteRegex = /\d+\s\bminute/;
const minuteData = arrayToString(findData(uptime, minuteRegex));
const minuteAmount = arrayToString(keepAmount(minuteData));
const normalizedMinuteAmount = normalizeAmount(minuteAmount);

let timestamp = [];
messagesTimestamps.forEach(e => {
	if (Math.abs(parseInt(e) - parseInt(normalizedMinuteAmount)) <= 5) {
		timestamp.push(e);
	}
});

messages[timestamp[0]] || ' ';

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.