Hello everyone, I want to disable user unwanted inputs something like that /greet /start /restart. Is it possible in Rasa? How to handle this problem ?
Welcome to the forum
You can handle it in your frontend application. Basically, that’s the logic:
if (message.startsWith('/')) {
display('Your message cannot start with a slash')
} else {
send(message)
}
For this code, I create actions for each intents. But my intents are replied with utter_intentname messages. In this respect, Where must I add this code block ? Could you explain your solution comprehensively? @ChrisRahme
Inside your frontend application, as I mentioned above.
The code above is just logic, no need to copy & paste exactly as it is - It depends on your frontend language anyway.
The logic is to not send the message to Rasa if it starts with /
. Another logic would be to just remove that charcter and then send the message.
The logic above was written in JavaScript, I will write this second one in Python, just to emphasise that you can do whatever you want however you want:
if message[0] == '/':
message = message[1:]
send(message)
I use bot on telegram and messenger channel. where is handled message before action?
Ah I see, so not your custom frontend app.
No worries though, you can do so inside Rasa with a Custom Connector
Inside of it, you remove the /
.
I did not get Custom Connector. But I update UserMessage object’s text on channel.py file.But I do not know is it correct method or not? Because Button logic is working with /intent_name structure. In this time I have disabled button system or not ?
Sorry I don’t understand.
If it works the way you did it that’s great, just remove / if it is the first character:
if text[0] == '/':
text = text[1:]