Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bot.dialog('/', function (session) {
- /*if(session.message.text.toLowerCase.contains('input1') || session.message.text.toLower.Case.contains('input2') || session.message.text.toLower.Case.contains('input3'))
- {
- session.send('Answer');
- }*/
- const userText = session.message.text.toLowerCase();
- String.prototype.is = function() {
- const args = Array.prototype.slice.call(arguments);
- const text = userText;
- for(let i = 0; i < args.length; i++) if(text.includes(args[i])) return true;
- return false;
- };
- //Greeting
- if(userText.is('hello', 'hi', 'good morning', 'good afternoon', 'hey'))
- session.send(`Hello. How are you?`);
- //Help
- else if(userText.is('help'))
- session.send(`What can I help you with? Do you want to know something specific?`);
- //Unrecognized messages
- else
- session.send(`Sorry, I don't understand you. Try to formulate your question differently please.`);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement