forked from windkh/node-red-contrib-telegrambot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
keyboard.json
1 lines (1 loc) · 1.83 KB
/
keyboard.json
1
[{"id":"ff78bc5a.00874","type":"telegram bot","z":"70c3f45a.8f3c0c","botname":"HeinzBot"},{"id":"d94485f4.26bb78","type":"catch","z":"70c3f45a.8f3c0c","name":"","x":134,"y":243,"wires":[["2ae5947d.d51a6c"]]},{"id":"2ae5947d.d51a6c","type":"debug","z":"70c3f45a.8f3c0c","name":"Debug","active":true,"console":"false","complete":"payload","x":606,"y":239,"wires":[]},{"id":"65b4107a.9a4bf","type":"telegram sender","z":"70c3f45a.8f3c0c","name":"show keyboard","bot":"ff78bc5a.00874","x":620,"y":68,"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":[["65b4107a.9a4bf"]]},{"id":"7da02f32.825fd","type":"telegram command","z":"70c3f45a.8f3c0c","name":"/foo","command":"/foo","bot":"ff78bc5a.00874","x":134,"y":95,"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"],["2ae5947d.d51a6c"]]},{"id":"fa470b3b.05b8f8","type":"telegram sender","z":"70c3f45a.8f3c0c","name":"send response","bot":"ff78bc5a.00874","x":624,"y":121,"wires":[]}]