From 6757fd808c8161ee9c0f4e5e0e6dd4037de9524d Mon Sep 17 00:00:00 2001 From: Leonardo Cabeza Date: Thu, 23 Jul 2020 13:22:28 -0500 Subject: [PATCH] fix(typo): remove typo in telegram set (#263) --- api/telegram/set.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/api/telegram/set.js b/api/telegram/set.js index 2543de1..7ccd16c 100644 --- a/api/telegram/set.js +++ b/api/telegram/set.js @@ -1,29 +1,32 @@ -import fetch from 'node-fetch'; -import * as Sentry from '@sentry/node'; +import fetch from "node-fetch"; +import * as Sentry from "@sentry/node"; const { TELEGRAM_BOT_TOKEN, APP_URL, SENTRY_DSN } = process.env; Sentry.init({ dsn: SENTRY_DSN }); /* used to activate webhook whenever we change the APP_URL */ -export default async(request, response) => { +export default async (request, response) => { try { if (request.query.token === TELEGRAM_BOT_TOKEN) { - const fetchResponse = await fetch(`https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/setWebhook?url=${APP_URL}/api/telegram/update?token=${TELEGRAM_BOT_TOKEN}}`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - }); + const fetchResponse = await fetch( + `https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/setWebhook?url=${APP_URL}/api/telegram/update?token=${TELEGRAM_BOT_TOKEN}`, + { + method: "POST", + headers: { + "Content-Type": "application/json" + } + } + ); const jsonResponse = await fetchResponse.json(); response.status(200).json(jsonResponse); } else { - response.status(401).send('Unauthorized'); + response.status(401).send("Unauthorized"); } } catch (error) { Sentry.captureException(error); - response.status(400).send('not ok'); + response.status(400).send("not ok"); } };