-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"printWidth": 100, | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import TelegramBot from 'node-telegram-bot-api' | ||
|
||
const TOKEN = process.env.TELEGRAM_TOKEN || '' | ||
const port = parseInt(process.env.PORT || '443', 10) | ||
const options = { | ||
webHook: { | ||
// Port to which you should bind is assigned to $PORT variable | ||
// See: https://devcenter.heroku.com/articles/dynos#local-environment-variables | ||
port, | ||
// you do NOT need to set up certificates since Heroku provides | ||
// the SSL certs already (https://<app-name>.herokuapp.com) | ||
// Also no need to pass IP because on Heroku you need to bind to 0.0.0.0 | ||
}, | ||
} | ||
// Heroku routes from port :443 to $PORT | ||
// Add URL of your app to env variable or enable Dyno Metadata | ||
// to get this automatically | ||
// See: https://devcenter.heroku.com/articles/dyno-metadata | ||
const url = process.env.APP_URL || 'https://<app-name>.herokuapp.com:443' | ||
const bot = new TelegramBot(TOKEN, options) | ||
|
||
// This informs the Telegram servers of the new webhook. | ||
// Note: we do not need to pass in the cert, as it already provided | ||
bot.setWebHook(`${url}/bot${TOKEN}`) | ||
|
||
// Just to ping! | ||
bot.on('message', function onMessage(msg) { | ||
bot.sendMessage(msg.chat.id, 'I am alive on Heroku!') | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.