From 0869e12a7e6ec07489d0bf2a5a34a44cafa33a12 Mon Sep 17 00:00:00 2001 From: Tereshchenko Aleksandr Date: Mon, 22 Jul 2024 14:36:23 +0300 Subject: [PATCH] Fix lint --- src/discordBot/services/logger.js | 8 ++++---- src/server/routes/webhookProxy.js | 29 +++++++++++++++-------------- src/telegramBot/bridge/service.js | 2 +- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/discordBot/services/logger.js b/src/discordBot/services/logger.js index fc8f18a..22ac7be 100644 --- a/src/discordBot/services/logger.js +++ b/src/discordBot/services/logger.js @@ -22,7 +22,7 @@ const setupLogger = () => { format.splat(), format.colorize(), errorStackTracerFormat(), - format.simple() + format.simple(), ), transports: [], }); @@ -30,7 +30,7 @@ const setupLogger = () => { logger.add( new transports.Console({ format: format.simple(), - }) + }), ); if (!process.env.PAPERTRAIL_URL) return; @@ -48,7 +48,7 @@ const setupLogger = () => { logger.exceptions.handle(paperTrailTransport); - winstonPapertrail.on("connect", function () { + winstonPapertrail.on("connect", function() { logger.info("Logger connected to Papertrail"); }); }; @@ -76,7 +76,7 @@ const logNoInteractionError = async ( member, channel, client, - error + error, ) => { const msg = `ERROR DETECTED!\nMember: ${member}\nChannel: ${channel}`; logger.error(msg); diff --git a/src/server/routes/webhookProxy.js b/src/server/routes/webhookProxy.js index ce44b6f..ca32281 100644 --- a/src/server/routes/webhookProxy.js +++ b/src/server/routes/webhookProxy.js @@ -1,22 +1,23 @@ -require("dotenv").config() -const axios = require("axios") -const router = require("express").Router() +require("dotenv").config(); +const axios = require("axios"); +const router = require("express").Router(); router.post("/:webhookId", async (req, res) => { - const webhookUrl = `${process.env.DISCORD_WEBHOOK_URL}/${req.params.webhookId}/${process.env.DISCORD_WEBHOOK_TOKEN}` - const webhookData = req.body + const webhookUrl = `${process.env.DISCORD_WEBHOOK_URL}/${req.params.webhookId}/${process.env.DISCORD_WEBHOOK_TOKEN}`; + const webhookData = req.body; try { await axios.post(webhookUrl, webhookData, { params: req.query, headers: req.headers, - }) - res.status(200).send("Webhook sent successfully") - return - } catch (error) { - console.error(error) - res.status(500).send("Internal server error") - return + }); + res.status(200).send("Webhook sent successfully"); + return; } -}) + catch (error) { + console.error(error); + res.status(500).send("Internal server error"); + return; + } +}); -module.exports = router +module.exports = router; diff --git a/src/telegramBot/bridge/service.js b/src/telegramBot/bridge/service.js index 31682fc..07e2258 100644 --- a/src/telegramBot/bridge/service.js +++ b/src/telegramBot/bridge/service.js @@ -61,7 +61,7 @@ const sendMessageToDiscord = async (ctx, message, channel) => { if (message.content.text && message.content.text[0] === "/") { return; } - if(!isMessageSafeToSend(message.content.text)) { + if (!isMessageSafeToSend(message.content.text)) { console.log("Message contains a telegram or discord link"); return; }