dockerized_openAger/nodered/rootfs/data/node_modules/node-red-contrib-telegrambot/examples/simplebot.json

1 line
3.4 KiB
JSON
Raw Permalink Normal View History

2020-10-17 16:42:50 +00:00
[{"id":"3b4f84c3.c4b07c","type":"telegram bot","z":"70c3f45a.8f3c0c","botname":"HeinzBot"},{"id":"d94485f4.26bb78","type":"catch","z":"70c3f45a.8f3c0c","name":"","x":123,"y":757,"wires":[["2ae5947d.d51a6c"]]},{"id":"2ae5947d.d51a6c","type":"debug","z":"70c3f45a.8f3c0c","name":"Debug","active":true,"console":"false","complete":"payload","x":559,"y":755,"wires":[]},{"id":"a1dabe3a.5e254","type":"function","z":"70c3f45a.8f3c0c","name":"confirmation message","func":"context.global.keyboard = { pending : true };\n\nvar opts = {\n reply_to_message_id: msg.payload.messageId,\n reply_markup: JSON.stringify({\n keyboard: [\n ['Yes'],\n ['No']],\n 'resize_keyboard' : true, \n 'one_time_keyboard' : true\n })\n};\n\nmsg.payload.content = 'Really?';\nmsg.payload.options = opts;\n\nreturn [ msg ];\n","outputs":"1","noerr":0,"x":354,"y":68,"wires":[["fa470b3b.05b8f8"]]},{"id":"7da02f32.825fd","type":"telegram command","z":"70c3f45a.8f3c0c","name":"/foo","command":"/foo","bot":"3b4f84c3.c4b07c","x":137,"y":121,"wires":[["a1dabe3a.5e254"],["71b35090.8e4cb"]]},{"id":"71b35090.8e4cb","type":"function","z":"70c3f45a.8f3c0c","name":"create response","func":"if(context.global.keyboard.pending)\n{\n context.global.keyboard.pending = false;\n \n if(msg.payload.content === 'Yes')\n {\n msg.payload.content = 'Yes';\n return [msg, null]; \n }\n else\n {\n msg.payload.content = 'No';\n return [null, msg]; \n }\n}\n","outputs":"2","noerr":0,"x":338,"y":127,"wires":[["fa470b3b.05b8f8"],[]]},{"id":"fa470b3b.05b8f8","type":"telegram sender","z":"70c3f45a.8f3c0c","name":"send response","bot":"3b4f84c3.c4b07c","x":578,"y":121,"wires":[]},{"id":"9a4d31ae.65b2d","type":"telegram command","z":"70c3f45a.8f3c0c","name":"/help","command":"/help","bot":"3b4f84c3.c4b07c","x":133,"y":233,"wires":[["871bb4c3.78e448"],[]]},{"id":"871bb4c3.78e448","type":"function","z":"70c3f45a.8f3c0c","name":"create help text","func":"\nvar helpMessage = \"/help - shows help\\r\\n\";\nhelpMessage += \"/foo - opens a dialog\\r\\n\";\nhelpMessage += \"Your chat id is \" + msg.payload.chatId;\n\nhelpMessage += \"\\r\\n\";\nhelpMessage += \"You are welcome: \"+msg.originalMessage.from.username;\nhelpMessage += \"\\r\\n\";\n\n\n\nmsg.payload.content = helpMessage;\nreturn msg;","outputs":1,"noerr":0,"x":334,"y":227,"wires":[["fa470b3b.05b8f8"]]},{"id":"54e15dbb.ab1ea4","type":"telegram receiver","z":"70c3f45a.8f3c0c","name":"location","bot":"3b4f84c3.c4b07c","x":136,"y":319,"wires":[["effec97.f100138"]]},{"id":"effec97.f100138","type":"function","z":"70c3f45a.8f3c0c","name":"create location message","func":"if(msg.payload.type == 'location')\n{\n var lat = msg.payload.content.latitude;\n var lng = msg.payload.content.longitude;\n \n msg.payload.type = 'message';\n msg.payload.content = 'lat=' + lat + ' lon=' + lng;\n return msg;\n}\nelse\n{\n return null;\n}\n","outputs":1,"noerr":0,"x":359,"y":319,"wires":[["fa470b3b.05b8f8"]]},{"id":"6f1941f0.90e6c","type":"inject","z":"70c3f45a.8f3c0c","name":"ping","topic":"","payload":"ping","payloadType":"string","repeat":"","crontab":"","once":false,"x":133,"y":421,"wires":[["c61b4d93.39e4b"]]},{"id":"c61b4d93.39e4b","type":"function","z":"70c3f45a.8f3c0c","name":"send to specific chat","func":"\nmsg.payload = {chatId : 138708568, type : 'message', content : 'ping'}\nreturn msg;","outputs":1,"noerr":0,"x":341,"y":421,"wires":[["fa470b3b.05b8f8"]]}]