// ======================================================================
// GROUDON
// Checks Geonet's twitter every minute for new updates.
// ======================================================================

// Cache the most recent tweet
var groudon_last = "";
var groudon_timer = 0;

// Returns the latest geonet tweet
function groudon_update() {
	return twitter_getLatest("geonet"); // geonet_above4
}

// Displays the most recent cached tweet in main chat
function groudon_postcurrent() {
	nmdc_say(groudon_last);
}

// Every few minutes, check for new updates to post.
function groudon_onTick() {
	groudon_timer++;
	if (groudon_timer == 60) {
		groudon_timer = 0;
		mudc_console("Checking for new twitter messages...");
		var latest = groudon_update();
		if ( latest != groudon_last && latest != undefined ) {
			groudon_last = latest;
			groudon_postcurrent();
		}
	}
}

// Perform initial update
groudon_last = groudon_update();
// Register the onTick handler
_onTick.push(groudon_onTick);