1 line
4.6 KiB
JSON
1 line
4.6 KiB
JSON
[{"id":"7d12e083.5939d","type":"debug","z":"8bdf0264.94609","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":370,"y":100,"wires":[]},{"id":"1ee38d5f.5d1373","type":"catch","z":"8bdf0264.94609","name":"","scope":null,"x":120,"y":100,"wires":[["7d12e083.5939d"]]},{"id":"3c4cb8c0.3f7c78","type":"telegram event","z":"8bdf0264.94609","name":"","bot":"19f02f8b.fa0c5","event":"callback_query","autoanswer":true,"x":140,"y":220,"wires":[["cf25334b.055e3","97f67e8e.cd17b"]]},{"id":"49cc02d7.7c80cc","type":"telegram sender","z":"8bdf0264.94609","name":"show inline keyboard","bot":"19f02f8b.fa0c5","x":582.7594223022461,"y":153.3033103942871,"wires":[["84367d6d.d0a5e"]]},{"id":"d336cf2.5aa523","type":"function","z":"8bdf0264.94609","name":"initial inline keyboard message","func":"context.global.keyboard = { pending : true, messageId : msg.payload.messageId };\n\nvar opts = {\n reply_to_message_id: msg.payload.messageId,\n reply_markup: JSON.stringify({\n \"inline_keyboard\": [[\n {\n \"text\": \"Yes\",\n \"callback_data\": \"FOO YES\" \n }, \n {\n \"text\": \"No\",\n \"callback_data\": \"FOO NO\" \n }]\n ]\n })\n};\n\nmsg.payload.content = 'Do you want to hide the inline keyboard?';\nmsg.payload.options = opts;\n\nreturn [ msg ];\n","outputs":"1","noerr":0,"x":321.7592468261719,"y":154.3032283782959,"wires":[["49cc02d7.7c80cc"]]},{"id":"ddf7fd32.336ad","type":"telegram command","z":"8bdf0264.94609","name":"/foo","command":"/foo","bot":"19f02f8b.fa0c5","strict":false,"x":102.75931549072266,"y":160.3032102584839,"wires":[["d336cf2.5aa523"],[]]},{"id":"97f67e8e.cd17b","type":"function","z":"8bdf0264.94609","name":"evaluate callback query","func":"// This is a sample switch to demonstrate the handling of the user input.\nif(msg.payload.content === \"FOO YES REALLY\")\n{\n // Hide the keyboard and forget the messageId\n msg.payload.type = 'deleteMessage';\n msg.payload.content = context.global.keyboard.messageId\n context.global.keyboard.messageId = null;\n \n // You could also send a editMessageReplyMarkup with an empty reply_markup here\n return [ null, msg ];\n}\nelse\n{\n var show_alert = false; // you can set this to true to open a dialog with the answer in the client.\n \n // msg.payload.content contains the callback data from the keyboard.\n // You may change this value here.\n msg.payload.options = show_alert;\n \n return [ msg, null ];\n}","outputs":"2","noerr":0,"x":468.75933837890625,"y":288.3309726715088,"wires":[["fdb9396f.7386a8"],["fdb9396f.7386a8"]]},{"id":"fdb9396f.7386a8","type":"telegram sender","z":"8bdf0264.94609","name":"answer callback query","bot":"19f02f8b.fa0c5","x":812.7593231201172,"y":219.33101081848145,"wires":[[]]},{"id":"cf25334b.055e3","type":"function","z":"8bdf0264.94609","name":"edit inline keyboard message","func":"// This is the message id of the initial keyboard that is simply exchanged by a new one.\nvar messageId = context.global.keyboard.messageId;\n\n// This is a sample of how to send a second inline keyboard with modified buttons\nvar reply_markup = JSON.stringify({\n \"inline_keyboard\": [[\n {\n \"text\": \"Are you really sure?\",\n \"callback_data\": \"FOO YES REALLY\" \n }, \n {\n \"text\": \"No\",\n \"callback_data\": \"FOO NO\" \n }]\n ]\n });\n\n\nvar options = {\n chat_id : msg.payload.chatId,\n reply_markup : reply_markup,\n message_id : messageId\n};\n\nmsg.payload.type = 'editMessageReplyMarkup';\nmsg.payload.content = reply_markup;\nmsg.payload.options = options;\n\nreturn [ msg ];\n","outputs":"1","noerr":0,"x":475.00010681152344,"y":221.00000762939453,"wires":[["fdb9396f.7386a8"]]},{"id":"84367d6d.d0a5e","type":"function","z":"8bdf0264.94609","name":"save messageId","func":"// We store the messageId to be able to edit this reply in the callback query. \ncontext.global.keyboard.messageId = msg.payload.sentMessageId;\nreturn [ msg ];\n","outputs":"1","noerr":0,"x":800.6667861938477,"y":153.6667127609253,"wires":[[]]},{"id":"19f02f8b.fa0c5","type":"telegram bot","z":"","botname":"HeinzBot","usernames":"","chatids":"","baseapiurl":"","updatemode":"webhook","pollinterval":"300","bothost":"ihive.spdns.de","localbotport":"8443","publicbotport":"8443","privatekey":"C:\\\\Temp\\\\SSL\\\\PRIVATE.key","certificate":"C:\\\\Temp\\\\SSL\\\\PUBLIC.pem","verboselogging":true}] |