def _remove_comment(self, comment):
        if self._replacement_format == "random":
            replacement_text = get_sentence()
        elif self._replacement_format == "dot":
            replacement_text = "."
        else:
            replacement_text = self._replacement_format

        if self._verbose:
            self._logger.debug(
                ("Editing and deleting  /r/{subreddit}/ #{comment_id} "
                 "({short_text}) with: {replacement_text}").format(
                     subreddit=comment.subreddit,
                     comment_id=comment.id,
                     short_text=sub(b"\n\r\t", " ",
                                    comment.body[:35].encode("utf-8")),
                     replacement_text=replacement_text))
        else:
            self._logger.info(
                ("Editing and deleting  /r/{subreddit}/ #{comment_id}").format(
                    subreddit=comment.subreddit,
                    comment_id=comment.id,
                ))

        if not self._trial_run:
            comment.edit(replacement_text)
Exemple #2
0
    def _remove_comment(self, comment):
        if self._replacement_format == "random":
            replacement_text = get_sentence()
        elif self._replacement_format == "dot":
            replacement_text = "."
        else:
            replacement_text = self._replacement_format

        short_text = sub(b"\n\r\t", " ", comment.body[:35].encode("utf-8"))
        msg = "/r/{}/ #{} ({}) with: {}".format(comment.subreddit, comment.id, short_text, replacement_text)

        self._logger.debug("Editing and deleting {msg}".format(msg=msg))
        if not self._trial_run:
            comment.edit(replacement_text)
Exemple #3
0
    def _remove_comment(self, comment):
        if self._replacement_format == "random":
            replacement_text = get_sentence()
        elif self._replacement_format == "dot":
            replacement_text = "."
        else:
            replacement_text = self._replacement_format

        short_text = sub(b"\n\r\t", " ", comment.body[:35].encode("utf-8"))
        msg = "/r/{}/ #{} ({}) with: {}".format(comment.subreddit, comment.id, short_text, replacement_text)

        self._logger.debug("Editing and deleting {msg}".format(msg=msg))
        if not self._trial_run:
            comment.edit(replacement_text)
Exemple #4
0
    def _remove_comment(self, comment):
        if self._replacement_format == "random":
            replacement_text = get_sentence()
        elif self._replacement_format == "dot":
            replacement_text = "."
        else:
            replacement_text = self._replacement_format

        short_text = sub(b"\n\r\t", " ", comment.body[:35].encode("utf-8"))
        msg = "/r/{}/ #{} ({}) with: {}".format(comment.subreddit, comment.id,
                                                short_text, replacement_text)

        self._logger.debug("Editing and deleting {msg}".format(msg=msg))
        # self._logger.info("Waiting {} seconds and continuing...".format(self._batch_cooldown))
        if not self._trial_run:
            # time.sleep(self._batch_cooldown)
            comment.edit(replacement_text)
Exemple #5
0
    def _remove_comment(self, comment):
        if self._replacement_format == "random":
            replacement_text = get_sentence()
        elif self._replacement_format == "dot":
            replacement_text = "."
        else:
            replacement_text = self._replacement_format

        short_text = sub(b"\n\r\t", " ", comment.body[:35].encode("utf-8"))
        msg = "/r/{}/ #{} ({}) with: {}".format(comment.subreddit, comment.id, short_text, replacement_text)

        self._logger.debug("Editing and deleting {msg}".format(msg=msg))
        if not self._trial_run:
            looper = True
            counter = 0
            while looper and counter <5:
                try:
                    comment.edit(replacement_text)
                    looper=False
                except:
                    time.sleep(30)
                    counter = counter +1