Created
May 17, 2018 07:47
-
-
Save yangwao/a1ac30d1bdce2046019216fc5fb21ebc to your computer and use it in GitHub Desktop.
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
const r2 = require('r2') | |
const telegramUrl = 'https://api.telegram.org/bot' | |
const token = '180473239:VHqX8dOnuhGlJXyurVHqX8dO8yhqX8' | |
/** | |
* A basic reply bot | |
* @returns {object} | |
*/ | |
module.exports = async (context) => { | |
const m = context.params.message | |
const data = { | |
chat_id: m.chat.id, | |
text: 'you\'ve just sent me: ' + m.text | |
} | |
const res = await r2.post(telegramUrl + token + '/sendMessage', | |
{json: data}).json | |
return {"statusCode": 200} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment