Skip to content

Commit

Permalink
Remove watched numbers when blacklisting, autopull
Browse files Browse the repository at this point in the history
  • Loading branch information
𝐢𝐁𝐮𝐠 ♦ committed Oct 20, 2018
1 parent 5d8a786 commit 59b5c6b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions gitmanager.py
Expand Up @@ -89,11 +89,12 @@ def add_to_blacklist(cls, blacklist='', item_to_blacklist='', username='', chat_
return (False, 'Already {}ed on line {} of {}'.format(op, line, blacklist_file_name))

watch_removed = False
if blacklist_type not in [Blacklist.WATCHED_KEYWORDS]:
watcher = Blacklist(Blacklist.WATCHED_KEYWORDS)
if watcher.exists(item_to_blacklist):
watch_removed = True
watcher.remove(item_to_blacklist)
if blacklist_type not in {Blacklist.WATCHED_KEYWORDS, Blacklist.WATCHED_NUMBERS}:
for watcher_type in {Blacklist.WATCHED_KEYWORDS, Blacklist.WATCHED_NUMBERS}:
watcher = Blacklist(watcher_type)
if watcher.exists(item_to_blacklist):
watch_removed = True
watcher.remove(item_to_blacklist)

blacklister.add(item_to_blacklist)

Expand All @@ -104,10 +105,10 @@ def add_to_blacklist(cls, blacklist='', item_to_blacklist='', username='', chat_

git.add(blacklist_file_name)
if watch_removed:
git.add('watched_keywords.txt')
git.add('watched_keywords.txt', 'watched_numbers.txt')

git.commit("--author='SmokeDetector <smokey@erwaysoftware.com>'",
"-m", u"Auto {0} of `{1}` by {2} --autopull".format(op, item, username))
"-m", "Auto {0} of `{1}` by {2} --autopull".format(op, item, username))

if code_permissions:
git.checkout("master")
Expand Down

0 comments on commit 59b5c6b

Please sign in to comment.