public static async Task ReplyOnBirthDay(Comment comment) { if (!Core.ListOfNames.Contains(comment.AuthorName) && !Redditor.ImBot(comment.AuthorName)) { NonApiTasks.CreateLog($"Comments count: {comment.Comments.Count}. Current comment: {comment.Shortlink}"); await Task.Run(() => { if (Redditor.HasBirthtDayToday(comment.AuthorName) && Redditor.NameIsLegal(comment.AuthorName)) { Core.ListOfNames.Add(comment.AuthorName); try { comment.Reply(NonApiTasks.InsertNameInto_ASCII_Art(comment.AuthorName + "!")); } catch (Exception e) { NonApiTasks.CreateExceptionLog(e); throw; } NonApiTasks.CreateLog($"SENT TO: {comment.Shortlink}" + Environment.NewLine); } else { NonApiTasks.CreateLog($"I DID NOT SEND: {comment.Shortlink}" + Environment.NewLine); } }); } }
public static async Task GoingIntoChainOfComments(Comment comment) { if (comment.Comments.Count > 0) { foreach (Comment commentChain in comment.Comments) { if (!string.IsNullOrEmpty(commentChain.AuthorName)) { NonApiTasks.CreateLog($"Going into chain: {commentChain.Shortlink}" + Environment.NewLine); await CommentManagement(commentChain); } } } }