This might only be interesting to me And it may be common knowledge to models, but for discussion's sake I thought I would start a thread.
A while back someone noted that the MFC wiki had changed to include something along the lines of countdowns coming soon. @SexySteffMFC posted a tweet last night about a message appearing, "Updated tip countdown to 0 tokens." This spurred me to jump into the code and it does indeed look like MFC is finally implementing a countdown capability (I'll post the code currently in their client code below for the truly masochistic).
I just have a couple questions that maybe someone here can answer. First, this is code in the public facing website; is this intended for use by members? I expect there is some code sharing across the member side and MWB so it may just be included by default but I'm curious. Second, I know there was some beta testing on the MWB recently; do any models know if this is supposed to be live soon? If so, I can shutter MFCCountdown. MFC broke it this week changing the way they are sending messages to the client anyway and it will save me some time.
A while back someone noted that the MFC wiki had changed to include something along the lines of countdowns coming soon. @SexySteffMFC posted a tweet last night about a message appearing, "Updated tip countdown to 0 tokens." This spurred me to jump into the code and it does indeed look like MFC is finally implementing a countdown capability (I'll post the code currently in their client code below for the truly masochistic).
I just have a couple questions that maybe someone here can answer. First, this is code in the public facing website; is this intended for use by members? I expect there is some code sharing across the member side and MWB so it may just be included by default but I'm curious. Second, I know there was some beta testing on the MWB recently; do any models know if this is supposed to be live soon? If so, I can shutter MFCCountdown. MFC broke it this week changing the way they are sending messages to the client anyway and it will save me some time.
Code:
var Countdown = {
hPreviousCountdownData: {}
};
Countdown.Receive = function(hCountdown) {
if (hCountdown.model != g_nBroadcasterId) {
return;
}
var nChange = 0;
if (hCountdown.countdown != Countdown.hPreviousCountdownData.countdown) nChange = hCountdown.countdown ? 1 : -1;
Log('Countdown ' + JSON.stringify(hCountdown));
var sMsg;
var sChatStyle;
if (hCountdown.total) {
if (nChange != 0 || hCountdown.src != 'notify') {
sChatStyle = 'system';
if (typeof(hCountdown.total) == 'number' && typeof(hCountdown.sofar) == 'number') {
if (nChange == 0) {
if (hCountdown.sofar == 0) sMsg = "* Updated tip countdown to " + hCountdown.total + " tokens!";
else sMsg = "* Updated tip countdown to " + hCountdown.total + " tokens! (" + hCountdown.sofar + " of " + hCountdown.total + " total)";
} else if (nChange == -1) {
if (hCountdown.sofar < hCountdown.total) sMsg = "* Tip countdown ended with " + (hCountdown.total - hCountdown.sofar) + " tokens still remaining.";
else sMsg = "* Tip countdown completed, no remaining tokens!";
} else if (nChange == 1) {
if (hCountdown.sofar == 0) sMsg = "* Tip countdown started for " + hCountdown.total + " tokens!";
else sMsg = "* Tip countdown started for " + hCountdown.total + " tokens! (" + hCountdown.sofar + " of " + hCountdown.total + " total)";
}
}
} else if (nChange == 0 && hCountdown.src == 'notify') {
sChatStyle = 'countdown';
if (typeof(hCountdown.total) == 'number' && typeof(hCountdown.sofar) == 'number') sMsg = "* " + (hCountdown.total - hCountdown.sofar) + " tokens remain in the countdown!";
}
}
if (sMsg) ChatQueue.Format_Append(sMsg, 0, {
chat_style: sChatStyle
});
if (hCountdown.topic) {
t.g_hUsers[g_nBroadcasterId].topic = hCountdown.topic;
RoomTopic.set_topic(t.g_hUsers[g_nBroadcasterId].topic.replace(/<[^>]*>/g, ''));
}
Countdown.hPreviousCountdownData = hCountdown;
};