Last active
November 6, 2017 12:45
-
-
Save yi-jiayu/62aa874f4368912963f6bed9605a8748 to your computer and use it in GitHub Desktop.
Source code for a simple Telegram bot on Google Cloud Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.haha = function (req, res) { | |
const update = req.body; | |
console.log(JSON.stringify(update)); | |
// update contains a message | |
if (update.hasOwnProperty('message')) { | |
// call the sendMessage method | |
const reply = { | |
method: 'sendMessage', | |
chat_id: update.message.chat.id, | |
text: 'haha', | |
}; | |
return res.json(reply); | |
} | |
return res.sendStatus(200); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment