|
|
@ -114,8 +114,7 @@ def remove_things(r, config, log, things):
|
|
|
|
if thing_time < end_time:
|
|
|
|
if thing_time < end_time:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
if str(thing.subreddit).lower() in config.get("whitelist", []) \
|
|
|
|
if str(thing.subreddit).lower() in config.get("whitelist", []) or thing.id in config.get("whitelist_ids", []):
|
|
|
|
or thing.id in config.get("whitelist_ids", []):
|
|
|
|
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
if config.get("whitelist_distinguished") and thing.distinguished:
|
|
|
|
if config.get("whitelist_distinguished") and thing.distinguished:
|
|
|
@ -141,10 +140,7 @@ def remove_things(r, config, log, things):
|
|
|
|
thing.clear_vote()
|
|
|
|
thing.clear_vote()
|
|
|
|
|
|
|
|
|
|
|
|
if isinstance(thing, Submission):
|
|
|
|
if isinstance(thing, Submission):
|
|
|
|
log.info("Deleting submission: #{id} {url}".format(
|
|
|
|
log.info("Deleting submission: #{id} {url}".format(id=thing.id, url=thing.url.encode("utf-8")))
|
|
|
|
id=thing.id,
|
|
|
|
|
|
|
|
url=thing.url.encode("utf-8"))
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
elif isinstance(thing, Comment):
|
|
|
|
elif isinstance(thing, Comment):
|
|
|
|
rep_format = config.get("replacement_format")
|
|
|
|
rep_format = config.get("replacement_format")
|
|
|
|
if rep_format == "random":
|
|
|
|
if rep_format == "random":
|
|
|
@ -154,12 +150,9 @@ def remove_things(r, config, log, things):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
replacement_text = rep_format
|
|
|
|
replacement_text = rep_format
|
|
|
|
|
|
|
|
|
|
|
|
msg = '/r/{3}/ #{0} with:\n\t"{1}" to\n\t"{2}"'.format(
|
|
|
|
msg = '/r/{3}/ #{0} with:\n\t"{1}" to\n\t"{2}"'.format(thing.id, sub(b"\n\r\t", " ",
|
|
|
|
thing.id,
|
|
|
|
thing.body[:78].encode("utf-8")),
|
|
|
|
sub(b"\n\r\t", " ", thing.body[:78].encode("utf-8")),
|
|
|
|
replacement_text[:78], thing.subreddit)
|
|
|
|
replacement_text[:78],
|
|
|
|
|
|
|
|
thing.subreddit
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if config.get("edit_only"):
|
|
|
|
if config.get("edit_only"):
|
|
|
|
log.info("Editing (not removing) {msg}".format(msg=msg))
|
|
|
|
log.info("Editing (not removing) {msg}".format(msg=msg))
|
|
|
|