Skip to content
Permalink
Browse files

fix or-bot

  • Loading branch information...
lamantin@tuta.io
lamantin@tuta.io committed Feb 20, 2017
1 parent 3864c9c commit d8d3c4c60b1cd4cc1529a976b3bc221f7aaac668
Showing with 6 additions and 6 deletions.
  1. +6 −6 or-bot/main.py
@@ -54,14 +54,13 @@


def better_handler(text):
_text = text.strip()

_text = _text[11:].strip()
text = text[11:].strip()

if _text[-1] == "?":
_text = _text[:-1]
if text[-1] == "?":
text = text[:-1]

variation = _text.split(' или ')
variation = text.split(' или ')
r = random.randint(0, len(variation) - 1)

choice = variation[r].strip()
@@ -79,8 +78,9 @@ def event():
return silence()

message = data.get('text')
message = message.strip()

if (re.match(r"что лучше, ", _text) or re.match(r"кто лучше, ", _text)) and re.search(r" или ", _text):
if (re.match(r"что лучше, ", message) or re.match(r"кто лучше, ", message)) and re.search(r" или ", message):
return Response(
response=json.dumps({'text': better_handler(message), 'bot': 'or-bot'}),
status=201,

0 comments on commit d8d3c4c

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.