public static SqlTwitchUserInChannel[] GetNew(TwitchAlert twitchAlerts) { try { DateTime latestCreatedAt = twitchAlerts.lastFollowerNotification; List <object[]> results = _table.Select(null, null, "ChannelUserId=?a AND CreatedAt>?b", new object[] { twitchAlerts.connection.channel.user.id, twitchAlerts.lastFollowerNotification }, null, 3); if (results != null && results.Count > 0) { SqlTwitchUserInChannel[] followers = new SqlTwitchUserInChannel[results.Count]; for (int i = 0; i < followers.Length; i++) { followers[i] = FromSql(twitchAlerts.connection.channel, results[i]); if (latestCreatedAt < followers[i].createdAt) { latestCreatedAt = followers[i].createdAt; } } twitchAlerts.lastFollowerNotification = latestCreatedAt; twitchAlerts.Save(false); return(followers); } else { return(null); } } catch (Exception e) { Log.exception(e); return(null); } }
public TwitchUserInChannel[] GetNewFollowers(TwitchAlert alerts) { try { if (newFollowersThrottle.ExecuteIfReady(alerts.connection.channel.user.id)) { twitchApi.UpdateNewFollowers(alerts.connection, 25, 0); } return(factory.GetNewFollowers(alerts)); } catch (Exception e) { Log.error("Twitch get new followers", e); return(null); } }
public Notification(TwitchAlert.Containers.Notification notification) { InitializeComponent(); this.Opacity = 0.0d; this.NotifyInfo = notification; this.StartPosition = FormStartPosition.Manual; this.Location = MonitorHelper.GetNotificationPosition(this.Width, this.Height); this.MouseClick += NotificationControl_MouseClick; foreach (var c in this.Controls) { (c as Control).MouseClick += NotificationControl_MouseClick; } this.TopMost = true; }
public TwitchUserInChannel[] GetNewFollowers(TwitchAlert alerts) { return SqlTwitchUserInChannel.GetNew(alerts); }
public static SqlTwitchUserInChannel[] GetNew(TwitchAlert twitchAlerts) { try { DateTime latestCreatedAt = twitchAlerts.lastFollowerNotification; List<object[]> results = _table.Select(null, null, "ChannelUserId=?a AND CreatedAt>?b", new object[] { twitchAlerts.connection.channel.user.id, twitchAlerts.lastFollowerNotification }, null, 3); if(results != null && results.Count > 0) { SqlTwitchUserInChannel[] followers = new SqlTwitchUserInChannel[results.Count]; for(int i = 0; i < followers.Length; i++) { followers[i] = FromSql(twitchAlerts.connection.channel, results[i]); if(latestCreatedAt < followers[i].createdAt) { latestCreatedAt = followers[i].createdAt; } } twitchAlerts.lastFollowerNotification = latestCreatedAt; twitchAlerts.Save(false); return followers; } else { return null; } } catch(Exception e) { Log.exception(e); return null; } }
public TwitchUserInChannel[] GetNewFollowers(TwitchAlert alerts) { return(SqlTwitchUserInChannel.GetNew(alerts)); }