示例#1
0
        private void SendMakerPostSticky(Post post)
        {
            var replyMessage = new StringBuilder();

            replyMessage.AppendLine(
                "This post has been identified as a maker post! If you have not done so please review the [Maker FAQ](https://www.reddit.com/r/chefknives/wiki/makerfaq). \n\n " +
                "As a reminder to all readers, you may not discuss sales, pricing, for OP to make you something, or where to buy what OP is displaying or similar in this thread " +
                "or anywhere on r/chefknives. Use private messages for any such inquiries. \n\n");

            var postHistory = _service.RedditPostDatabase
                              .GetByFilter(nameof(RedditThing.Author), post.Author).Result
                              .Where(p => p.Flair != null && p.Flair.Equals(_makerPostName));

            if (postHistory != null && postHistory.Any())
            {
                replyMessage.AppendLine("---");
                replyMessage.AppendLine($"Here are some past Maker Posts from u/{post.Author}:");
                postHistory.Take(5).ToList()
                .ForEach(p => replyMessage.AppendLine($"* [{p.Title}]({_postUrlFirstPart}{p.Id})"));
            }

            _logger.Information($"Commented with SendTenToOneWarningMessage on post by {post.Author}. ");

            if (!DryRun)
            {
                var reply = post
                            .Reply(replyMessage.ToString())
                            .Distinguish("yes", true);

                _service.SelfCommentDatabase.Upsert(reply.ToSelfComment(post.Id, RedditThingType.Post, post.Listing.LinkFlairTemplateId));
            }

            _logger.Information($"Commented with maker warning on post by {post.Author}");
        }
示例#2
0
        private void SendNeverContributedWarningMessage(Post post)
        {
            if (!DryRun)
            {
                var reply = post
                            .Reply(
                    $"It looks like you haven't recently commented on any posts within this community. " +
                    $"Please sufficiently interact with r/{_service.Subreddit.Name} by constructively commenting on posts other than your own before submitting a Maker Post.\n\n" +
                    $"For more information review the [Maker FAQ](https://www.reddit.com/r/chefknives/wiki/makerfaq)")
                            .Distinguish("yes", false);

                _service.SelfCommentDatabase.Upsert(reply.ToSelfComment(post.Id, RedditThingType.Post, post.Listing.LinkFlairTemplateId));

                post.Remove();
            }

            _logger.Information($"Commented with SendNeverContributedWarningMessage on post by {post.Author}");
        }
示例#3
0
        private void SendTenToOneWarningMessage(Post post, int nonMakerComments, int makerPostCount)
        {
            if (!DryRun)
            {
                var reply = post
                            .Reply(
                    $"It looks like you've submitted {makerPostCount} Maker Posts but only authored {nonMakerComments} comments outside of your own Maker Posts. " +
                    $"Please sufficiently interact with r/{_service.Subreddit.Name} by constructively commenting on posts other than your own before submitting a new Maker Post.\n\n" +
                    $"For more information review the [Maker FAQ](https://www.reddit.com/r/chefknives/wiki/makerfaq)")
                            .Distinguish("yes", false);

                _service.SelfCommentDatabase.Upsert(reply.ToSelfComment(post.Id, RedditThingType.Post, post.Listing.LinkFlairTemplateId));

                post.Remove();
            }

            _logger.Information($"Commented with SendTenToOneWarningMessage on post by {post.Author}.");
        }