Skip to content

Commit

Permalink
regex matches bot's display name using utils.getMe()
Browse files Browse the repository at this point in the history
  • Loading branch information
LanceMaverick committed Feb 4, 2017
1 parent 58a69ea commit 088ad01
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions beards/willbeard/python/willbeard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from skybeard.beards import BeardChatHandler
from skybeard.predicates import regex_predicate
from skybeard.decorators import onerror
from skybeard.utils import partition_text
from skybeard.utils import partition_text, getMe
from .config import server_url, credentials, filter_words

logger = logging.getLogger(__name__)
Expand All @@ -14,10 +14,11 @@ class WillBeard(BeardChatHandler):
any message that starts with 'skybeard, ' will be sent to the W.I.L.L
personal assistant as a query"""

bot_name = await getMe()['first_name']
__commands__ = [
(
#match any message that starts with "skybeard, "
regex_predicate('(?i)^skybeard\,\s'),
regex_predicate('(?i)^{}\,\s'.format(bot_name),
'query_will',
'queries the W.I.L.L assistant')
]
Expand Down

0 comments on commit 088ad01

Please sign in to comment.