add secrets.BOT_WEBHOOK_URL
Deploy app frontend / app frontend (push) Successful in 2m3s
Deploy service couchdb / service couchdb (push) Successful in 26s
Deploy db-migrations / db-migrations (push) Successful in 1m30s
Deploy service message-delivery-method-web-push / service message-delivery-method-web-push (push) Successful in 1m30s
Deploy service tg-bot / service tg-bot (push) Successful in 1m23s
Deploy app frontend / app frontend (push) Successful in 2m3s
Deploy service couchdb / service couchdb (push) Successful in 26s
Deploy db-migrations / db-migrations (push) Successful in 1m30s
Deploy service message-delivery-method-web-push / service message-delivery-method-web-push (push) Successful in 1m30s
Deploy service tg-bot / service tg-bot (push) Successful in 1m23s
This commit is contained in:
@@ -22,6 +22,7 @@ export const env = {
|
||||
BOT_TOKEN: process.env.BOT_TOKEN,
|
||||
BOT_USE_CHANGES_DB_UPDATES:
|
||||
`${process.env.BOT_USE_CHANGES_DB_UPDATES}` === "true",
|
||||
BOT_WEBHOOK_URL: process.env.BOT_WEBHOOK_URL,
|
||||
READ_BASE_URL: process.env.READ_BASE_URL,
|
||||
APP_BASE_URL: process.env.APP_BASE_URL,
|
||||
API_URL: process.env.API_URL,
|
||||
|
||||
@@ -7,7 +7,9 @@ import { MyContext } from "../types/myContext";
|
||||
export const setupWebHook = async (bot: Bot<MyContext>) => {
|
||||
const designDocument = await setupWebhookDesignDocument();
|
||||
const update: keyof typeof designDocument.updates = "saveUpdate";
|
||||
const webhookUrl = `${env.PUBLIC_API_URL}/${TG_BOT_UPDATES_DB_NAME}/${designDocument._id}/_update/${update}`;
|
||||
const webhookUrl =
|
||||
env.BOT_WEBHOOK_URL ||
|
||||
`${env.PUBLIC_API_URL}/${TG_BOT_UPDATES_DB_NAME}/${designDocument._id}/_update/${update}`;
|
||||
if (designDocument.constants.telegram_webhook_url !== webhookUrl) {
|
||||
await bot.api.setWebhook(webhookUrl, {
|
||||
secret_token: designDocument.constants.telegram_secret_token,
|
||||
|
||||
Reference in New Issue
Block a user