NodeRED Lesson: Telegram Bot

TelegramBot perlu didaftarkan terlebih dahulu mengikut langkah-langkah di Raspberry Pi Lesson: Telegram Bot.

Berikut adalah video demo nya.

Node-RED Flow

[{"id":"6b5f421951d2bc9c","type":"telegram receiver","z":"379d0ea756cd42bd","name":"","bot":"f75b426efec48ba0","saveDataDir":"","filterCommands":false,"x":310,"y":200,"wires":[["1705bf035c5f727f"],[]]},{"id":"1705bf035c5f727f","type":"debug","z":"379d0ea756cd42bd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":670,"y":200,"wires":[]},{"id":"920fd5db34a6c07f","type":"telegram command","z":"379d0ea756cd42bd","name":"","command":"/about","description":"","registercommand":false,"language":"","scope":"default","bot":"f75b426efec48ba0","strict":false,"hasresponse":true,"useregex":false,"removeregexcommand":false,"outputs":2,"x":270,"y":260,"wires":[["5e36dbe44d8f4a26"],[]]},{"id":"5e36dbe44d8f4a26","type":"function","z":"379d0ea756cd42bd","name":"","func":"msg.payload.content = \"Hi, I\\'m shahrulnizam.com\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":260,"wires":[["0314ae9047f6b05a"]]},{"id":"0314ae9047f6b05a","type":"telegram sender","z":"379d0ea756cd42bd","name":"","bot":"f75b426efec48ba0","haserroroutput":false,"outputs":1,"x":690,"y":320,"wires":[[]]},{"id":"95deec87ebed7efc","type":"telegram command","z":"379d0ea756cd42bd","name":"","command":"/random","description":"","registercommand":false,"language":"","scope":"default","bot":"f75b426efec48ba0","strict":false,"hasresponse":true,"useregex":false,"removeregexcommand":false,"outputs":2,"x":280,"y":320,"wires":[["565935d3861cdaab"],[]]},{"id":"565935d3861cdaab","type":"function","z":"379d0ea756cd42bd","name":"","func":"number = Math.round(10*Math.random());\nmsg.payload.content = number.toString();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":320,"wires":[["0314ae9047f6b05a"]]},{"id":"b75e77fb1719598e","type":"telegram command","z":"379d0ea756cd42bd","name":"","command":"/time","description":"","registercommand":false,"language":"","scope":"default","bot":"f75b426efec48ba0","strict":false,"hasresponse":true,"useregex":false,"removeregexcommand":false,"outputs":2,"x":270,"y":380,"wires":[["1d91c0b11f1c3b0b"],[]]},{"id":"1d91c0b11f1c3b0b","type":"function","z":"379d0ea756cd42bd","name":"","func":"var date = new Date(Date.now());\nmsg.payload.content = date.toString();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":380,"wires":[["0314ae9047f6b05a"]]},{"id":"f75b426efec48ba0","type":"telegram bot","botname":"shahrulnizam.com","usernames":"","chatids":"","baseapiurl":"","updatemode":"polling","pollinterval":"300","usesocks":false,"sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","botpath":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":false}]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.