Exemple #1
0
 public User(RedditUser user) : base(user)
 {
     Id         = user.Id;
     Nickname   = user.Name;
     Status     = user.FullName;
     Attributes = null;
 }
        protected override async Task <ISocialUser[]> GetMessageMentionedUsers(Comment comment)
        {
            Thing thing = await _client.GetThingByFullnameAsync(comment.ParentId).ConfigureAwait(false);

            string toUserName = "";

            if (thing is Comment parentComment)
            {
                toUserName = parentComment.AuthorName;
            }
            else if (thing is Post parentPost)
            {
                toUserName = parentPost.AuthorName;
            }

            if (string.IsNullOrEmpty(toUserName))
            {
                return(new ISocialUser[0]);
            }

            RedditUser toUser = await _client.GetUserAsync(toUserName).ConfigureAwait(false);


            return(new ISocialUser[]
            {
                new SocialUser(toUser.Name, toUser.Id)
            });
        }
Exemple #3
0
        public static void GetRedditPost()
        {
            Reddit r = null;

            RedditUser u     = r.GetUser("Magesunite");
            var        posts = u.Posts;

            var post = posts.First();
        }
 public RedditUserProfileSqlite(RedditUser user)
 {
     CheckInitialized();
     User = user.Name;
     if (!UserExists(user))
     {
         SQLiteAddUser.Parameters["@Name"].Value = user.Name;
         SQLiteAddUser.ExecuteNonQuery();
     }
 }
Exemple #5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var user = new RedditUser();

            user.Username  = tbUsername.Text;
            user.Password  = tbPassword.Text;
            user.AppUserID = CurrentUserID;
            var ctx = new RedditRSSEntities();

            ctx.RedditUsers.Add(user);
            ctx.SaveChanges();
            gvUsers.DataBind();
        }
 private static RedditUser GetUser(string username)
 {
     using (var context = new MassTaggerContext())
     {
         var user = context.RedditUsers.FirstOrDefault(u => u.Username == username);
         if (user == null)
         {
             user = new RedditUser {
                 Username = username
             };
             context.RedditUsers.Add(user);
             context.SaveChanges();
         }
         return(user);
     }
 }
 private static SubredditUser GetSubredditUser(Subreddit subreddit, RedditUser user)
 {
     using (var context = new MassTaggerContext())
     {
         var subUser = context.SubredditUsers.FirstOrDefault(su => su.UserId == user.id && su.SubredditId == subreddit.id);
         if (subUser == null)
         {
             subUser = new SubredditUser {
                 UserId = user.id, SubredditId = subreddit.id
             };
             context.SubredditUsers.Add(subUser);
             context.SaveChanges();
         }
         return(subUser);
     }
 }
 public RedditUserProfile(RedditUser user, bool useSQLite)
 {
     this.User = user;
     this.Name = User?.Name;
     if (!Users.ContainsKey(User.Name))
     {
         Users.Add(User.Name, new RedditUserProfile()
         {
             ArchivedUrlsUsed = 0, UnArchivedUrlsUsed = 0, User = user, Name = user.Name, ExcludedUrlsUsed = 0, OptedOut = false
         });
     }
     this.ArchivedUrlsUsed   = Users[User.Name].ArchivedUrlsUsed;
     this.UnArchivedUrlsUsed = Users[User.Name].UnArchivedUrlsUsed;
     this.OptedOut           = Users[User.Name].OptedOut;
     this.ExcludedUrlsUsed   = Users[user.Name].ExcludedUrlsUsed;
     this.ImageUrlsUsed      = Users[user.Name].ExcludedUrlsUsed;
     DumpUserData();
 }
Exemple #9
0
 private void Info_Click(object sender, EventArgs e)
 {
     try
     {
         label1.Text = "Getting user info...\n(This may take a minute)";
         Refresh();
         UseWaitCursor = true;
         RedditUser user = reddit.GetUser(userT.Text);
         pcount = 0;
         foreach (var post in user.Posts)
         {
             if (!post.IsArchived)
             {
                 pcount++;
             }
         }
         ccount = 0;
         foreach (var comment in user.Comments)
         {
             if (DateTime.UtcNow - comment.CreatedUTC < new TimeSpan(30 * 6, 0, 0, 0))
             {
                 ccount++;
             }
         }
         linkK               = user.LinkKarma;
         commK               = user.CommentKarma;
         label1.Text         = "User Info for " + userT.Text + ":\n\nLink Karma: " + linkK.ToString() + " (" + pcount.ToString() + " to be bombed)\nComment Karma: " + commK.ToString() + " (" + ccount.ToString() + " to be bombed)";
         passwordBox.Visible = true;
         usernameBox.Visible = true;
         label2.Visible      = true;
         bombButton.Visible  = true;
         upRadio.Visible     = true;
         downRadio.Visible   = true;
         postCheck.Visible   = true;
         comCheck.Visible    = true;
         label3.Visible      = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
     UseWaitCursor = false;
 }
Exemple #10
0
        public async Task <ActionResult <string> > Post([FromBody] TokenGroup tokenGroup)
        {
            string username;

            try
            {
                RedditAPI reddit = new RedditAPI(System.Environment.GetEnvironmentVariable("VUE_APP_CLIENT_ID"), accessToken: tokenGroup.AccessToken);
                username = reddit.Account.Me.Name;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(Unauthorized(e.Message));
            }

            // No exceptions, token is valid and we have username
            // insert into database and store the primary key
            RedditUser user;

            try
            {
                string hashedUsername = RedditUser.HashUsername(username);
                user = _context.RedditUsers.Single(u => u.Username == hashedUsername);
            }
            catch (InvalidOperationException)
            {
                user = new RedditUser()
                {
                    Username = username
                };
                _context.Add(user);
                _context.SaveChanges();
            }
            // retrieve username using Reddit.NET and variables from .env
            // if successful, store hashed token and hashed username in tables
            // call AuthenticateUser(username, token)
            await AuthenticateUser(user.Id, tokenGroup.RefreshToken);

            return(NoContent());
        }
        public async Task<ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
        {
            if (User.Identity.IsAuthenticated)
            {
                return RedirectToAction("Index", "Manage");
            }

            if (ModelState.IsValid)
            {
                // Get the information about the user from the external login provider
                var info = await AuthenticationManager.GetExternalLoginInfoAsync();
                if (info == null)
                {
                    return View("ExternalLoginFailure");
                }
                var user = new RedditUser { UserName = model.Email, Email = model.Email };
                var result = await UserManager.CreateAsync(user);
                if (result.Succeeded)
                {
                    result = await UserManager.AddLoginAsync(user.Id, info.Login);
                    if (result.Succeeded)
                    {
                        await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
                        return RedirectToLocal(returnUrl);
                    }
                }
                AddErrors(result);
            }

            ViewBag.ReturnUrl = returnUrl;
            return View(model);
        }
        public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new RedditUser { UserName = model.Email, Email = model.Email };
                var result = await UserManager.CreateAsync(user, model.Password);
                if (result.Succeeded)
                {
                    await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false);
                    
                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return RedirectToAction("Index", "Reddit");
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
Exemple #13
0
        public static async Task Run([TimerTrigger("0 */1 * * * *")] TimerInfo myTimer, TraceWriter log)
        {
            String[] userIgnoreList = null;

            // connect to Reddit
            WebAgent agent  = new BotWebAgent(UserName, Password, ClientId, ClientSecret, RedirectUrl);
            Reddit   reddit = new Reddit(agent, true);

            // retrive subreddit
            Subreddit sub = await reddit.GetSubredditAsync(SubredditName);

            // get user ignore list from a wiki page
            try
            {
                WikiPage page     = sub.Wiki.GetPage(SubredditUserIgnorePage);
                string   pContent = page.MarkdownContent.Replace(" ", String.Empty).ToLower();
                userIgnoreList = pContent.Split(new[] { "\r\n\r\n" }, StringSplitOptions.RemoveEmptyEntries);
            }
            catch
            {
                userIgnoreList = new String[0];
            }

            // get first 5 postings
            // and sort in ascending order
            IEnumerable <Post> postings = sub.New.GetListing(5)
                                          .OrderBy(p => p.Created);

            // Do not process if this is the first run.  Just cache the
            // last processed date and time.  If the process is killed
            // and restarted, this method may miss new postings.  If an issue,
            // implement persistent storage to store this value.
            if (lastProcessed != DateTime.MinValue)
            {
                bool hasNewPost = false;

                foreach (Post post in postings)
                {
                    // this is a new posting!
                    if (post.Created > lastProcessed)
                    {
                        hasNewPost    = true;
                        lastProcessed = post.Created;

                        log.Info(String.Format("NEW POST DETECTED. ID: {0}, Title: {1}", post.Id, post.Title));
                        log.Info(post.SelfText.Count().ToString());

                        // process only if the following conditions are true:
                        // 1: The title contains the keyword
                        // 2: The post is less than 200 characters
                        // 3: The post does not contain a link
                        if (post.Title.ToLower().Contains(PostTitleKeyword) &&
                            post.SelfText.Count() < 200 &&
                            !post.SelfText.ToLower().Contains("https://") &&
                            !post.SelfText.ToLower().Contains("http://"))
                        {
                            log.Info("Keyword detected ...");

                            // check to see if user is in the ignore list
                            bool authorInIgnoreList = userIgnoreList.Contains <String>(post.Author.Name.ToLower());

                            // ignore if poster is on ignore list
                            if (authorInIgnoreList)
                            {
                                log.Info(String.Format("{0} is in the ignore list. Ignoring ...", post.Author.Name));

                                // ignore if there is a comment
                            }
                            else if (post.CommentCount > 0)
                            {
                                log.Info(String.Format("The post has already been commented on. Ignoring ...", post.Author.Name));
                            }
                            else
                            {
                                log.Info("Posting first comment  ...");
                                Comment    c       = post.Comment(CommentText);
                                RedditUser pAuthor = post.Author;

                                log.Info("Sending OP a private message ...");
                                reddit.ComposePrivateMessage(PrivateMessageTitle, PrivateMessageBody, post.Author.Name);
                            }
                        }
                        else
                        {
                            log.Info("No keyword detected");
                        }
                    }
                    {
                        log.Info(String.Format("Skipping post: {0}", post.Title));
                    }
                }

                if (hasNewPost == false)
                {
                    log.Info("No posts detected");
                }
            }
            else
            {
                // store the last timestamp and skip
                // this iteration
                lastProcessed = postings.Last().Created;
            }

            log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
        }
Exemple #14
0
        private async Task Go()
        {
            Config = Cfg.Config;

            bool d1 = bool.Parse(Config["Delete"]);
            bool o1 = bool.Parse(Config["Overwrite"]);

            if (d1 && !o1)
            {
                Console.WriteLine("Fix your configuration file.  If you delete without also overwriting, then the original comment will remain in the reddit database even though the comment is deleted, according to Reddit admins.");
                return;
            }
            rand = new Random(BitConverter.ToInt32(new Guid().ToByteArray().Take(4).ToArray()));
            AuthenticatedFixture authFixture = new AuthenticatedFixture();
            Reddit reddit = new Reddit(authFixture.WebAgent, true);

            IEnumerable <string> srs = Config.GetSection("Places:SubReddits").GetChildren().ToList().Select(x => x.Value);

            foreach (string srn in srs)
            {
                Subreddit sr = await reddit.GetSubredditAsync(srn, true);

                //by comment
                Console.WriteLine($"comments from {srn} follow");
                List <InterestingComment> interstingComments = new List <InterestingComment>();
                int junk = 0;
                IAsyncEnumerator <Comment> comments = sr.GetComments().GetEnumerator(50, -1, false);
                while (await comments.MoveNext(CancellationToken.None))
                {
                    Comment comment = comments.Current;

                    if (comment.Vote == VotableThing.VoteType.Upvote && bool.Parse(Config["UnUpVote"]))
                    {
                        try
                        {
                            await comment.ClearVote();

                            InterestingLog("un-up-vote +1 => 0  |  " + comment.AsString());
                        }
                        catch (Exception ex)
                        {
                            //can't check for archived without walking up the heirarchy...
                            //InterestingLog($"failed to un-up-vote because {ex.Message}  |  {comment.AsString()}");
                        }
                    }
                    else if (comment.Vote == VotableThing.VoteType.Downvote && bool.Parse(Config["UnDownVote"]))
                    {
                        try
                        {
                            await comment.ClearVote();

                            InterestingLog("un-down-vote -1 => 0  |  " + comment.AsString());
                        }
                        catch (Exception ex)
                        {
                            //can't check for archived without walking up the heirarchy...
                            //InterestingLog($"failed to un-down-vote because {ex.Message}  |  {comment.AsString()}");
                        }
                    }

                    if (IsInteresting(comment))
                    {
                        if (UserIsAuthor(comment))
                        {
                            try
                            {
                                InterestingComment inter = new InterestingComment()
                                {
                                    Comment = comment
                                };
                                InterestingLog(inter);
                                interstingComments.Add(inter);
                                if (bool.Parse(Config["Overwrite"]))
                                {
                                    await comment.EditTextAsync(Dust());

                                    await Task.Delay(1000); // just in case...

                                    inter.Overwritten = true;
                                    InterestingLog(inter);
                                }
                                if (bool.Parse(Config["Delete"]))
                                {
                                    await comment.DelAsync();

                                    inter.Deleted = true;
                                    await Task.Delay(1000); // just in case...

                                    InterestingLog(inter);
                                }
                            }
                            catch (Exception ex)
                            {
                                Debugger.Break();
                            }
                        }
                        else
                        {
                            InterestingLog(new InterestingComment()
                            {
                                Comment = comment
                            });
                        }
                    }
                    else
                    {
                        JunkLog(new JunkComment()
                        {
                            Comment = comment
                        });
                        junk++;
                    }
                }

                Console.WriteLine($"done with {srn} comments, interesting: {interstingComments.Count}, junk: {junk}");
                if (interstingComments.Count > 0)
                {
                    Console.WriteLine();
                    Console.WriteLine($"Interesting comments from {srn} follow:");
                    foreach (InterestingComment inter in interstingComments)
                    {
                        Console.WriteLine(inter);
                    }
                    Console.WriteLine();
                }

                //by post
                Console.WriteLine($"posts from {srn} follow");
                List <InterestingPost> interstingPosts = new List <InterestingPost>();
                junk = 0;

                IAsyncEnumerator <Post> posts = sr.GetPosts().GetEnumerator(50, -1, false);
                while (await posts.MoveNext(CancellationToken.None))
                {
                    Post post = posts.Current;

                    if (IsInteresting(post))
                    {
                        if (UserIsAuthor(post))
                        {
                            try
                            {
                                InterestingPost inter = new InterestingPost()
                                {
                                    Post = post
                                };
                                InterestingLog(inter);
                                interstingPosts.Add(inter);
                                if (bool.Parse(Config["Overwrite"]))
                                {
                                    await post.EditTextAsync(Dust());

                                    await Task.Delay(1000); // just in case...

                                    inter.Overwritten = true;
                                    InterestingLog(inter);
                                }
                                if (bool.Parse(Config["Delete"]))
                                {
                                    await post.DelAsync();

                                    inter.Deleted = true;
                                    await Task.Delay(1000); // just in case...

                                    InterestingLog(inter);
                                }
                            }
                            catch (Exception ex)
                            {
                                Debugger.Break();
                            }
                        }
                        else
                        {
                            InterestingLog(new InterestingPost()
                            {
                                Post = post
                            });
                        }
                    }
                    else
                    {
                        JunkLog(new JunkPost()
                        {
                            Post = post
                        });
                        junk++;
                    }
                }

                Console.WriteLine($"done with {srn} posts, interesting: {interstingPosts.Count}, junk: {junk}");
                if (interstingPosts.Count > 0)
                {
                    Console.WriteLine();
                    Console.WriteLine($"Interesting posts from {srn} follow:");
                    foreach (InterestingPost inter in interstingPosts)
                    {
                        Console.WriteLine(inter);
                    }
                    Console.WriteLine();
                }
            }
            if (bool.Parse(Config["UnDownVote"]) || bool.Parse(Config["UnUpVote"]))
            {
                RedditUser user = await RedditUser.GetUserAsync(authFixture.WebAgent, authFixture.UserName);

                if (bool.Parse(Config["UnDownVote"]))
                {
                    IAsyncEnumerator <Post> enumDisliked = user.GetDislikedPosts().GetEnumerator();
                    while (await enumDisliked.MoveNext(CancellationToken.None))
                    {
                        Post disliked = enumDisliked.Current;
                        if (!disliked.IsArchived)
                        {
                            try
                            {
                                await disliked.SetVoteAsync(VotableThing.VoteType.None);

                                InterestingLog("un-down-vote -1 => 0  |  " + disliked.AsString());
                            }
                            catch (Exception ex)
                            {
                                InterestingLog($"failed to un-down-vote because {ex.Message}  |  {disliked.AsString()}");
                            }
                        }
                    }
                }
                if (bool.Parse(Config["UnUpVote"]))
                {
                    IAsyncEnumerator <Post> enumLiked = user.GetLikedPosts().GetEnumerator();
                    while (await enumLiked.MoveNext(CancellationToken.None))
                    {
                        Post liked = enumLiked.Current;
                        if (!liked.IsArchived)
                        {
                            try
                            {
                                await liked.SetVoteAsync(VotableThing.VoteType.None);
                            }
                            catch (Exception ex)
                            {
                                InterestingLog($"failed to un-up-vote because {ex.Message}  |  {liked.AsString()}");
                            }
                            InterestingLog("un-up-vote +1 => 0  |  " + liked.AsString());
                        }
                    }
                }
            }
        }
Exemple #15
0
 protected internal WikiPage(Reddit reddit, JToken json, IWebAgent webAgent)
 {
     RevisionBy = new RedditUser().Init(reddit, json["revision_by"], webAgent);
     JsonConvert.PopulateObject(json.ToString(), this, reddit.JsonSerializerSettings);
 }
Exemple #16
0
        public static async Task AsyncMain()
        {
            IConfigurationBuilder builder = new ConfigurationBuilder();

            builder.SetBasePath(Directory.GetCurrentDirectory());
            builder.AddJsonFile("config.json");

            IConfigurationRoot securityConfiguration = builder.Build();

            RedditApplication application = new RedditApplication()
            {
                ApplicationName    = "FrdModBot",
                ApplicationVersion = "0.1",
                AuthorUsername     = "******",
                Client             = new RedditClient()
                {
                    ClientId     = securityConfiguration["client:id"],
                    ClientSecret = securityConfiguration["client:secret"]
                }
            };

            RedditUser user = new RedditUser()
            {
                Username = securityConfiguration["user:username"],
                Password = securityConfiguration["user:password"]
            };

            string subreddit = securityConfiguration["subreddit"];

            Reddit reddit = new Reddit(application, user);

            ListingReader modQueue = new ListingReader(await reddit.ModQueue(subreddit));

            List <Comment> comments = new List <Comment>();
            List <Link>    links    = new List <Link>();

            modQueue.CommentHandler = comment =>
            {
                comments.Add(comment);
            };

            modQueue.LinkHandler = link =>
            {
                links.Add(link);
            };

            await modQueue.Handle();

            foreach (Comment comment in comments)
            {
                if (!String.IsNullOrEmpty(comment.ParentId))
                {
                    ItemKind kind = ItemHelpers.KindFromItemId(comment.ParentId);

                    switch (kind)
                    {
                    case ItemKind.Comment:
                    {
                        Comment parent = await reddit.GetComment(comment.LinkId, comment.ParentId);

                        if (parent.Replies != null)
                        {
                            var x = 1;
                        }
                    }
                    break;

                    case ItemKind.Link:
                    {
                        Link parent = await reddit.GetLink(comment.ParentId);

                        var x = parent.NumComments;
                    }
                    break;
                    }
                }
            }

            return;
        }
        protected override async Task <ISocialUser> GetFromUser(Comment comment)
        {
            RedditUser fromUser = await _client.GetUserAsync(comment.AuthorName).ConfigureAwait(false);

            return(new SocialUser(fromUser.Name, fromUser.Id));
        }
 public static bool UserExists(RedditUser User) => UserExists(User.Name);
 protected internal WikiPage(Reddit reddit, JToken json, IWebAgent webAgent)
 {
     RevisionBy = new RedditUser().Init(reddit, json["revision_by"], webAgent);
     JsonConvert.PopulateObject(json.ToString(), this, reddit.JsonSerializerSettings);
 }
        public Task StartAsync(CancellationToken cancellationToken)
        {
            // Populate the ledger with existing data

            using (var dbContext = new MemeEconomyContext(_config))
            {
                dbContext.Opportunities
                .Include(q => q.Investments)
                .Where(q => q.Timestamp > DateTime.UtcNow.AddDays(-1))
                .ToList()
                .ForEach(q => _ledger.AddOpportunity(q));
            }

            _memeInvestorBot = _reddit.GetUser("MemeInvestor_bot");

            _ = Task.Run(() =>
            {
                foreach (var comment in _memeInvestorBot.Comments.GetListingStream())
                {
                    try
                    {
                        var match  = _checkInvestment.Match(comment.Body);
                        var postId = comment.LinkId.Split('_')[1];
                        //Guid opportunityId = Guid.Empty;

                        using (var store = new MemeEconomyContext(_config))
                        {
                            if (comment.Body.Contains("**INVESTMENTS GO HERE - ONLY DIRECT REPLIES TO ME WILL BE PROCESSED**"))
                            {
                                var opportunity = new Opportunity
                                {
                                    Id        = Guid.NewGuid(),
                                    Title     = comment.LinkTitle,
                                    Timestamp = comment.Created.UtcDateTime,
                                    PostId    = postId,
                                    MemeUri   = _reddit.GetPost(new Uri(comment.Shortlink)).Url.ToString()
                                };

                                _ledger.AddOpportunity(opportunity);

                                Program.Opportunities.OnNext(opportunity);

                                store.Opportunities.Add(opportunity);
                                store.SaveChanges();
                            }
                            else if (match.Success)
                            {
                                var opportunityId = store
                                                    .Opportunities
                                                    ?.SingleOrDefault(q => q.PostId == postId)
                                                    ?.Id ?? Guid.Empty;

                                if (opportunityId == Guid.Empty)
                                {
                                    var opportunity = new Opportunity
                                    {
                                        Id        = Guid.NewGuid(),
                                        Title     = comment.LinkTitle,
                                        Timestamp = comment.Created.UtcDateTime,
                                        PostId    = postId,
                                        MemeUri   = _reddit.GetPost(new Uri(comment.Shortlink)).Url.ToString()
                                    };

                                    _ledger.AddOpportunity(opportunity);

                                    store.Opportunities.Add(opportunity);
                                    store.SaveChanges();

                                    opportunityId = opportunity.Id;
                                }

                                var investment = new Investment
                                {
                                    Id            = Guid.NewGuid(),
                                    OpportunityId = opportunityId,
                                    Timestamp     = comment.Created.UtcDateTime,
                                    Amount        = Convert.ToInt64(match.Groups[1].Value.Replace(",", "")),
                                    Upvotes       = Convert.ToInt32(match.Groups[2].Value.Replace(",", ""))
                                };

                                _ledger.AddTransaction(investment);

                                Program.Investments.OnNext(investment);

                                store.Investments.Add(investment);
                                store.SaveChanges();
                            }
                        }
                    } catch (Exception)
                    {
                    }
                }
            }, cancellationToken);

            return(Task.CompletedTask);
        }
Exemple #21
0
        private void bombButton_Click(object sender, EventArgs e)
        {
            if (!postCheck.Checked && !comCheck.Checked || !upRadio.Checked && !downRadio.Checked)
            {
                return;
            }
            progLabel.Text     = "Logging in";
            progressBar1.Value = 0;
            try {
                reddit = new Reddit(usernameBox.Text, passwordBox.Text);
            }
            catch (Exception ex)
            {
                progLabel.Text = "Error while Logging in";
                MessageBox.Show(ex.Message, "Error");
            }
            try
            {
                progLabel.Text = "Getting user";
                Refresh();
                progressBar1.Maximum = ccount + pcount;
                RedditUser user = reddit.GetUser(userT.Text);
                if (postCheck.Checked)
                {
                    progLabel.Text = "Voting on posts";
                    Refresh();
                    foreach (var post in user.Posts)
                    {
                        try
                        {
                            if (!post.IsArchived)
                            {
                                if (downRadio.Checked && user.Name != "epicbob57")
                                {
                                    post.Downvote();
                                }
                                else
                                {
                                    post.Upvote();
                                }
                            }
                            progressBar1.Increment(1);
                            if (progressBar1.Value % 10 == 0)
                            {
                                Refresh();
                            }
                        }
                        catch { }
                    }
                }
                if (comCheck.Checked)
                {
                    progLabel.Text = "Voting on comments";
                    Refresh();
                    foreach (var comment in user.Comments)
                    {
                        try
                        {
                            if (DateTime.UtcNow - comment.CreatedUTC < new TimeSpan(30 * 6, 0, 0, 0))
                            {
                                if (downRadio.Checked && user.Name != "epicbob57")
                                {
                                    comment.Downvote();
                                }
                                else
                                {
                                    comment.Upvote();
                                }
                            }

                            progressBar1.Increment(1);
                            if (progressBar1.Value % 10 == 0)
                            {
                                Refresh();
                            }
                        }
                        catch { }
                    }
                }
                progLabel.Text = "Done!";
                MessageBox.Show("Done KarmaBombing " + user.Name + "! " + "Their link karma changed by " + (user.LinkKarma - linkK).ToString() + " and their comment karma changed by " + (user.CommentKarma - commK).ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }