// isLiveNotification determines if the notification was actually a stream live update
// versus title update, or game update.
isLiveNotification determines if the notification was actually a stream live update
versus title update, or game update.
// isLiveNotification determines if the notification was actually a stream live update // versus title update or game update .
func isLiveNotification(notification *twitch.TwitchNotification) bool {
	userId := notification.UserId
	if !liveStartTimes.Exists(userId) {
		err := liveStartTimes.Set(userId, notification.StartedAt)
		if nil != err {
			log.Println("Failed to Cache Stream Started: " + err.Error())
		}
		return true
	}
	lastStart, err := liveStartTimes.Get(userId)
	if nil != err {
		log.Println("Failed to Retrieve Last Start Time: " + err.Error())
		liveStartTimes.Set(userId, notification.StartedAt)
		return true
	}
	err = liveStartTimes.Set(userId, notification.StartedAt)
	if nil != err {
		log.Println("Failed to Cache Stream Started: " + err.Error())
		return true
	}
	startedAt, _ := liveStartTimes.Get(userId)
	return !lastStart.Equal(startedAt)
}
func isLiveNotification ( notification * twitch . TwitchNotification ) bool { userId := notification . UserId if ! liveStartTimes . Exists ( userId ) { err := liveStartTimes . Set ( userId , notification . StartedAt ) if nil != err { log . Println ( " " + err . Error ( ) ) } return true } lastStart , err := liveStartTimes . Get ( userId ) if nil != err { log . Println ( " " + err . Error ( ) ) liveStartTimes . Set ( userId , notification . StartedAt ) return true } err = liveStartTimes . Set ( userId , notification . StartedAt ) if nil != err { log . Println ( " " + err . Error ( ) ) return true } startedAt , _ := liveStartTimes . Get ( userId ) return ! lastStart . Equal ( startedAt ) }
isLiveNotification determines if the notification was actually a stream live update
versus title update, or game update.
isLiveNotification determines if the notification was actually a stream live update versus title update or game update .
// The Notification Type will always be "live", so to determine whether the stream // notification is actually a "went live" event, we'll compare the time and date of // the Started parameter to the last event for a user // If we don't have a previous entry for the user, then this is the initial go live // Get Last Cached Time // Try and Set and Return True // Set new Time // We can assume that if the times are equal, this is a repeat notification, // a title update, or a game update