-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathTelegramToDbCountMorritti.json
1 lines (1 loc) · 5.55 KB
/
TelegramToDbCountMorritti.json
1
[{"id":"378ab4ac.59118c","type":"tab","label":"DBMorrittiBot","disabled":false,"info":""},{"id":"5ba395a4.ac3afc","type":"chatbot-rules","z":"378ab4ac.59118c","name":"","rules":[{"type":"command","command":"/search"},{"type":"isTopic","topic":"search_track"},{"type":"command","command":"/album"},{"type":"isTopic","topic":"search_album"},{"type":"catchAll"}],"outputs":5,"x":110,"y":420,"wires":[["ff1d7445.165ba8"],["61d2c1d3.231a1"],["1c0ba02d.26797"],["783a3d5b.09ddd4"],["5e1a3633.91d0e8"]]},{"id":"838d903a.18e67","type":"chatbot-telegram-send","z":"378ab4ac.59118c","bot":"589aa7d.3053b58","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":790,"y":340,"wires":[]},{"id":"5e1a3633.91d0e8","type":"chatbot-inline-buttons","z":"378ab4ac.59118c","name":"","buttons":[{"type":"postback","label":"Ricerca Tracce","value":"/search","answer":"","alert":false,"style":"default"},{"type":"postback","label":"Conta Album ID","value":"/album","answer":"","alert":false,"style":""}],"message":"Cosa vuoi fare?","x":320,"y":380,"wires":[["838d903a.18e67"]]},{"id":"ff1d7445.165ba8","type":"function","z":"378ab4ac.59118c","name":"topic set","func":"var chat = msg.chat();\nchat.set(\"topic\",\"search_track\");\nreturn msg;","outputs":1,"noerr":0,"x":320,"y":340,"wires":[["778d87ad.9d9d38"]]},{"id":"778d87ad.9d9d38","type":"chatbot-message","z":"378ab4ac.59118c","name":"","message":[{"message":"Digita il nome delle tracce da cercare"}],"language":"","x":490,"y":340,"wires":[["838d903a.18e67"]]},{"id":"61d2c1d3.231a1","type":"function","z":"378ab4ac.59118c","name":"topic unset","func":"var chat = msg.chat();\nchat.set(\"topic\",\"\");\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":420,"wires":[["23e2646c.566fdc"]]},{"id":"23e2646c.566fdc","type":"function","z":"378ab4ac.59118c","name":"make query","func":"var name = msg.payload.content\nmsg.topic = \"SELECT trackid,name FROM tracks WHERE name LIKE '%\"+ name + \"%'\";\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":420,"wires":[["dea9bd39.53c96"]]},{"id":"dea9bd39.53c96","type":"sqlite","z":"378ab4ac.59118c","mydb":"f5da2f5c.3ef4f","sqlquery":"msg.topic","sql":"","name":"SQLite","x":630,"y":400,"wires":[["418995be.4452ec"]]},{"id":"e194484.b7442b8","type":"chatbot-message","z":"378ab4ac.59118c","name":"","message":[{"message":"{{payload}}\n\n⬇️PREMI QUI⬇️\n /start"}],"language":"","x":870,"y":420,"wires":[["838d903a.18e67"]]},{"id":"418995be.4452ec","type":"function","z":"378ab4ac.59118c","name":"array send","func":"var list = \"Ecco le tracce registrate:\\n\\n\"\nfor(var i = 0; i < msg.payload.length; i++){\n list += parseInt(msg.payload[i].TrackId)+\": \"+msg.payload[i].Name+\"\\n\";\n}\nmsg.payload = list;\nreturn msg;","outputs":1,"noerr":0,"x":730,"y":460,"wires":[["e194484.b7442b8"]]},{"id":"1f5a3e15.dd2c12","type":"chatbot-telegram-receive","z":"378ab4ac.59118c","bot":"589aa7d.3053b58","botProduction":"","x":170,"y":260,"wires":[["5ba395a4.ac3afc"]]},{"id":"1c0ba02d.26797","type":"function","z":"378ab4ac.59118c","name":"set2","func":"var chatC = msg.chat();\nchatC.set(\"topic\",\"search_album\");\nreturn msg;\n\n","outputs":1,"noerr":0,"x":270,"y":480,"wires":[["bd85c9c5.deb8d8"]]},{"id":"bd85c9c5.deb8d8","type":"chatbot-message","z":"378ab4ac.59118c","name":"","message":[{"message":"Inserisci ID da cui partire"}],"language":"","x":390,"y":480,"wires":[["48a99806.403a78"]]},{"id":"48a99806.403a78","type":"chatbot-telegram-send","z":"378ab4ac.59118c","bot":"589aa7d.3053b58","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":830,"y":520,"wires":[]},{"id":"783a3d5b.09ddd4","type":"function","z":"378ab4ac.59118c","name":"unset2","func":"var chatC = msg.chat();\nchatC.set(\"topic\",\"\");\nreturn msg;","outputs":1,"noerr":0,"x":130,"y":560,"wires":[["74afffff.6c547"]]},{"id":"74afffff.6c547","type":"function","z":"378ab4ac.59118c","name":"query2","func":"var id = msg.payload.content;\nmsg.topic = \"SELECT albumid, COUNT (*) FROM tracks GROUP BY albumid HAVING COUNT(*) > \"+id+ \" ORDER BY COUNT(*) DESC;\"\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":540,"wires":[["a44ba1b.5fc9f6"]]},{"id":"d72868ac.b16d28","type":"function","z":"378ab4ac.59118c","name":"arraysend2","func":"var listL = \"Ecco gli albumID in ordine decrescente: \\n\\n\";\nfor(var i = 0; i < msg.payload.length; i++){\n listL += parseInt(msg.payload[i].AlbumId) + \"\\n\";\n}\nmsg.payload = listL;\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":620,"wires":[["c1f72a9b.392d08","f6eb9a9d.cad988"]]},{"id":"a44ba1b.5fc9f6","type":"sqlite","z":"378ab4ac.59118c","mydb":"f5da2f5c.3ef4f","sqlquery":"msg.topic","sql":"","name":"SQLite2","x":440,"y":560,"wires":[["d72868ac.b16d28","fbe6b6cd.057378"]]},{"id":"c1f72a9b.392d08","type":"chatbot-message","z":"378ab4ac.59118c","name":"","message":[{"message":"{{payload}}\n\n⬇️PREMI QUI⬇️\n /start"}],"language":"","x":630,"y":560,"wires":[["48a99806.403a78"]]},{"id":"fbe6b6cd.057378","type":"debug","z":"378ab4ac.59118c","name":"test","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":410,"y":640,"wires":[]},{"id":"f6eb9a9d.cad988","type":"debug","z":"378ab4ac.59118c","name":"test","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":790,"y":640,"wires":[]},{"id":"589aa7d.3053b58","type":"chatbot-telegram-node","z":"","botname":"DBMorrittiBot","usernames":"","providerToken":"","polling":"1000","store":"","log":"","debug":false,"webHook":"","connectMode":"polling"},{"id":"f5da2f5c.3ef4f","type":"sqlitedb","z":"","db":"C:\\Users\\MMorr\\Desktop\\iot\\chinook.db","mode":"RWC"}]