Skip to content

Commit

Permalink
added filter words option for willbeard
Browse files Browse the repository at this point in the history
  • Loading branch information
LanceMaverick committed Feb 3, 2017
1 parent a918eb7 commit ee97c2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion beards/willbeard/python/willbeard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from skybeard.predicates import regex_predicate
from skybeard.decorators import onerror
from skybeard.utils import partition_text
from .config import server_url, credentials
from .config import server_url, credentials, filter_words

logger = logging.getLogger(__name__)

Expand All @@ -25,6 +25,9 @@ class WillBeard(BeardChatHandler):
@onerror
async def query_will(self, msg):
query_text = msg['text'].split(', ', 1)[1]
if any(w in query_text.lower() for w in filter_words):
await self.sender.sendMessage("I'm not comfortable googling that...")
return
response = requests.post(
url="{0}/api/start_session".format(server_url),
data=credentials).json()
Expand Down
3 changes: 3 additions & 0 deletions beards/willbeard/python/willbeard/config.py.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
server_url = "https://willbeddow.com"
credentials = dict(username='', password = '')

#if the queries contain any words in here,
#the request will be blocked
filter_words = []

0 comments on commit ee97c2c

Please sign in to comment.