def remind(data,msg,r,mail): logging.debug("Remind Command") running_username = str(data["running_username"]).lower() reminder = True lines = separate_mail(mail.body) for line in lines: links = r.get_submission(line).comments for comment in links: if comment.replies: if comments.check_already_replied(data,msg["confirmation"],comment.replies,running_username): logging.info("Already Confirmed") reminder = False elif comments.check_already_replied(data,msg["error_length"],comment.replies,running_username): if comment.edited: comments.process_comments(data,msg,r,links) reminder = False elif comments.check_already_replied(data,msg["error_bad_recipient"],comment.replies,running_username): logging.info("Already Notified - Bad Recipient") reminder = False elif comments.check_already_replied(data,msg["error_submission_history"],comment.replies,running_username): logging.info("Already Notified - Submission History Error") reminder = False elif comments.check_already_replied(data,msg["remind"],comment.replies,running_username): logging.info("Already Reminded") reminder = False wait() if reminder: for comment in links: if comment.author: if str(comment.author.name).lower() != str(data["running_username"]).lower(): logging.info("User has been sent a reminder.") messages.remind(comment) #comment.reply(msg["remind"]).distinguish() else: logging.info("Silly person tried to remind me how to do my job.")
def remove(data,msg,r,mail,message): logging.warning("Remove Command") lines = separate_mail(mail.body) username = str(data["running_username"]).lower() for line in lines: links = r.get_submission(line).comments for comment in links: if comments.check_already_replied(data,msg["confirmation"],comment.replies,username): for reply in comment.replies: if reply.author: if str(reply.author.name).lower() == username: reply.delete() awardee_comment = r.get_info(thing_id=comment.parent_id) if awardee_comment.author: awardee = str(awardee_comment.author.name).lower() flair_count = token.start_decrement(data,msg,r,awardee) wiki.remove_wiki_line(data,msg,r,comment.permalink,awardee,flair_count) messages.remove(message) # comment.reply(message).distinguish() comment.unsave() comment.remove(spam=False) wiki.remove_queue_line(data,msg,r,line) print("Placeholder: Remove text from scoreboard") else: logging.warning("No token to remove.") wait() r.send_message("/r/" + data["running_subreddit"],"Remove Detected","Remove from %s detected on:\n\n%s" % (mail.author.name,mail.body))