Created
June 3, 2020 21:20
-
-
Save guidone/ddafe29046f69e757faa2388e20d11a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"4ae37f7c.a3b2d","type":"subflow","name":"Commands","info":"Show some predefined contents defined in **Mission Control** after some command-like messages from the user (for example `/privacy`, `/terms`, etc).\n\nEdit the content [here](/mc/configuration-commands).","category":"RedBot Flows","in":[{"x":60,"y":120,"wires":[{"id":"713c0557.e8f73c"}]}],"out":[{"x":1380,"y":100,"wires":[{"id":"73981e80.0fa4d","port":0}]},{"x":840,"y":300,"wires":[{"id":"713c0557.e8f73c","port":1},{"id":"f105aa1c.ddeba8","port":1},{"id":"23b96bda.f03d04","port":1}]}],"env":[],"color":"#ff6633","outputLabels":["Command Found","Pass Thru"],"icon":"font-awesome/fa-terminal"},{"id":"8e5ea84d.c2ba28","type":"mc-configuration","z":"4ae37f7c.a3b2d","namespace":"commands","debug":true,"x":170,"y":240,"wires":[[]]},{"id":"713c0557.e8f73c","type":"chatbot-rules","z":"4ae37f7c.a3b2d","name":"","rules":[{"type":"anyCommand"},{"type":"catchAll"}],"outputs":2,"x":230,"y":120,"wires":[["f105aa1c.ddeba8"],[]]},{"id":"f105aa1c.ddeba8","type":"function","z":"4ae37f7c.a3b2d","name":"Find slug by comment","func":"const commands = context.global.get('commands_commands');\nconst userMessage = msg.payload.content;\n\nconst found = commands.find(item => item.command === userMessage);\n\nif (found != null) {\n console.log('trovato', found)\n msg.query = found.slug;\n send([msg, null]);\n} else {\n send([null, msg]);\n}\n","outputs":2,"noerr":0,"x":490,"y":100,"wires":[["23b96bda.f03d04"],[]],"outputLabels":["Slug found","Slug not found"]},{"id":"23b96bda.f03d04","type":"mc-content","z":"4ae37f7c.a3b2d","query":"","language":"","failbackLanguage":"en","chain":false,"x":750,"y":100,"wires":[["6fe0cdee.bf17a4"],[]]},{"id":"6fe0cdee.bf17a4","type":"chatbot-message","z":"4ae37f7c.a3b2d","name":"Show content","message":[{"message":"{{payload.body}}"}],"language":"none","x":1000,"y":100,"wires":[["73981e80.0fa4d"]]},{"id":"73981e80.0fa4d","type":"chatbot-params","z":"4ae37f7c.a3b2d","name":"","params":[{"platform":"telegram","name":"parseMode","value":"Markdown"},{"platform":"all","name":"messageFlag","value":"answer"}],"outputs":1,"x":1200,"y":100,"wires":[[]]}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment