Skip to content

Commit

Permalink
added reason exclusion for special sites and added Ask Ubuntu
Browse files Browse the repository at this point in the history
Added an `unwantedReasons` to the specialrooms array/dictionary and added the AU General room (201). Updated if loop to check if `reason` is in `unwantedReasons`.
  • Loading branch information
Seth-Johnson committed Oct 2, 2014
1 parent 7685e24 commit b3ecda3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ws.py
Expand Up @@ -37,7 +37,8 @@
room = wrap.get_room(charcoal_room_id)
roomm = wrapm.get_room(meta_tavern_room_id)

specialrooms = [{ "sites": ["english.stackexchange.com"], "room": wrap.get_room("95") }]
#specialrooms = [{ "sites": ["english.stackexchange.com"], "room": wrap.get_room("95") }]
specialrooms = [{ "sites": ["english.stackexchange.com"], "room": wrap.get_room("95"), "unwantedReasons": [] }, { "sites": ["askubuntu.com"], "room": wrap.get_room("201"), "unwantedReasons": ["All-caps title"] }]

bayesian_testroom = wrap.get_room("17251")
print bayesian_testroom.send_message(s)
Expand Down Expand Up @@ -112,7 +113,7 @@ def handlespam(data):
roomm.send_message(s)
for specialroom in specialrooms:
sites = specialroom["sites"]
if d["siteBaseHostAddress"] in sites:
if d["siteBaseHostAddress"] in sites and reason not in specialroom["unwantedReasons"]:
specialroom["room"].send_message(s)
except UnboundLocalError:
print "NOP"
Expand Down

0 comments on commit b3ecda3

Please sign in to comment.