From 6e61e682c4e331020fafb89341020e66ec75f963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas?= Date: Thu, 18 May 2017 10:20:26 +0200 Subject: [PATCH] Ahora se referira a los humanos correctamente --- main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index c9e6cf7..56f4940 100644 --- a/main.py +++ b/main.py @@ -44,10 +44,19 @@ def randomchat(bot, update): global chatbot msg = update.message.text.lower() user_name = update.message.from_user.username.lower() + if not user_name or user_name == '': + user_name = 'humano' + reply = chatbot.get_response(msg) if "te rieh" in msg or random.randint(0, 100) < 5: - reply = user_name + ": " + reply.text + if "te rieh" in reply.text: + reply = reply.text + reply = reply.replace("te rieh", user_name) + + else: + reply = user_name + ": " + reply.text + bot.sendMessage(update.message.chat_id, text=reply)