|
|
@ -53,7 +53,8 @@ clear_vote = config.getboolean('main', 'clear_vote')
|
|
|
|
trial_run = config.getboolean('main', 'trial_run')
|
|
|
|
trial_run = config.getboolean('main', 'trial_run')
|
|
|
|
edit_only = config.getboolean('main', 'edit_only')
|
|
|
|
edit_only = config.getboolean('main', 'edit_only')
|
|
|
|
item = config.get('main', 'item')
|
|
|
|
item = config.get('main', 'item')
|
|
|
|
|
|
|
|
whitelist_distinguished = config.getboolean('main', 'whitelist_distinguished')
|
|
|
|
|
|
|
|
whitelist_gilded = config.getboolean('main', 'whitelist_gilded')
|
|
|
|
_user = config.get('main', 'username')
|
|
|
|
_user = config.get('main', 'username')
|
|
|
|
_pass = config.get('main', 'password')
|
|
|
|
_pass = config.get('main', 'password')
|
|
|
|
|
|
|
|
|
|
|
@ -73,7 +74,8 @@ def login(user=None, password=None):
|
|
|
|
except RateLimitExceeded as e:
|
|
|
|
except RateLimitExceeded as e:
|
|
|
|
raise RateLimitExceeded("You're doing that too much.", e)
|
|
|
|
raise RateLimitExceeded("You're doing that too much.", e)
|
|
|
|
|
|
|
|
|
|
|
|
login(user=_user, password=_pass)
|
|
|
|
if not r.is_logged_in():
|
|
|
|
|
|
|
|
login(user=_user, password=_pass)
|
|
|
|
|
|
|
|
|
|
|
|
if verbose:
|
|
|
|
if verbose:
|
|
|
|
print("Logged in as {user}".format(user=r.user))
|
|
|
|
print("Logged in as {user}".format(user=r.user))
|
|
|
@ -118,28 +120,35 @@ for thing in things:
|
|
|
|
thing.id in whitelist_ids:
|
|
|
|
thing.id in whitelist_ids:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
if not trial_run:
|
|
|
|
if trial_run:
|
|
|
|
if clear_vote:
|
|
|
|
# Don't actually perform any actions
|
|
|
|
thing.clear_vote()
|
|
|
|
next
|
|
|
|
if isinstance(thing, Submission):
|
|
|
|
if whitelist_distinguished and item.distinguished:
|
|
|
|
if verbose:
|
|
|
|
next
|
|
|
|
print(u'Deleting submission: #{id} {url}'.format(
|
|
|
|
if whitelist_gilded and thing.gilded:
|
|
|
|
id=thing.id,
|
|
|
|
next
|
|
|
|
url=thing.url)
|
|
|
|
|
|
|
|
)
|
|
|
|
if clear_vote:
|
|
|
|
elif isinstance(thing, Comment):
|
|
|
|
thing.clear_vote()
|
|
|
|
replacement_text = get_sentence()
|
|
|
|
if isinstance(thing, Submission):
|
|
|
|
if verbose:
|
|
|
|
if verbose:
|
|
|
|
msg = '/r/{3}/ #{0} with:\n\t"{1}" to\n\t"{2}"'.format(
|
|
|
|
print(u'Deleting submission: #{id} {url}'.format(
|
|
|
|
thing.id,
|
|
|
|
id=thing.id,
|
|
|
|
sub(b'\n\r\t', ' ', thing.body[:78].encode('utf-8')),
|
|
|
|
url=thing.url)
|
|
|
|
replacement_text[:78],
|
|
|
|
)
|
|
|
|
thing.subreddit
|
|
|
|
elif isinstance(thing, Comment):
|
|
|
|
)
|
|
|
|
replacement_text = get_sentence()
|
|
|
|
if edit_only:
|
|
|
|
if verbose:
|
|
|
|
print('Editing {msg}'.format(msg=msg))
|
|
|
|
msg = '/r/{3}/ #{0} with:\n\t"{1}" to\n\t"{2}"'.format(
|
|
|
|
else:
|
|
|
|
thing.id,
|
|
|
|
print('Editing and deleting {msg}'.format(msg=msg))
|
|
|
|
sub(b'\n\r\t', ' ', thing.body[:78].encode('utf-8')),
|
|
|
|
thing.edit(replacement_text)
|
|
|
|
replacement_text[:78],
|
|
|
|
if not edit_only:
|
|
|
|
thing.subreddit
|
|
|
|
thing.delete()
|
|
|
|
)
|
|
|
|
|
|
|
|
if edit_only:
|
|
|
|
|
|
|
|
print('Editing {msg}'.format(msg=msg))
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print('Editing and deleting {msg}'.format(msg=msg))
|
|
|
|
|
|
|
|
thing.edit(replacement_text)
|
|
|
|
|
|
|
|
if not edit_only:
|
|
|
|
|
|
|
|
thing.delete()
|
|
|
|