-3
I’m developing a Chatbot called "Joker" for use in a Telegram group. The Bot must respond only if its name (Joker) is quoted in a sentence, otherwise it must remain "silent" without interfering with the group’s conversation. However, he "wakes up" and responds with a null value, "None" to any message sent to the group. With the word Joker contained in the phrase, the Bot is not understanding the predefined questions, registered in your training and answers with one of the standard answers to questions not yet learned.
- User: Good morning, you guys!
- Bot: None
- User: Good morning, Joker
- Bot: I’m sorry, I didn’t get your message.
def respond(self, message):
"""
Receive message from user and returns corresponding answer.
"""
if re.search("joker", message, re.IGNORECASE):
joker_na_mensagem = True
else:
joker_na_mensagem = False
if joker_na_mensagem and len(message) > 50 and self.watson_usage:
top_answer = get_analysis(message)
return f"Hmm, você está falando sobre {top_answer}"
elif joker_na_mensagem and len(message.strip()) == len("joker"):
return "Algo de errado não está certo.
Digite /info para saber mais."
elif joker_na_mensagem:
return self.comm.get_response(self.clean(message))
Does this Answer your Question? Chatbot respond only when a specific word is contained in the sentence
– Guilherme França de Oliveira
The question cited, is mine and has a different context, not fitting the answer I seek. I elaborated better the question for a better understanding.
– Jacob
You should edit the previous reset by correcting the question and not duplicating
– Guilherme França de Oliveira
This is not a duplicate. The current question departs from the purpose of the original question. I was advised by a user who was helping me to elaborate a new question. For this reason, I did not edit the previous one and asked this question.
– Jacob
The user steered you right, but if the original question ran away from what you were looking for, it was only necessary to elaborate a new question and edit the previous one and not create duplicate questions just because you didn’t get the answer you expected.
– Guilherme França de Oliveira