From 0cb5c30b6d5d20b340df7de77f16652787a9b10c Mon Sep 17 00:00:00 2001 From: Nico Reinartz Date: Fri, 17 Nov 2023 23:48:36 +0100 Subject: [PATCH] refactor: remove unused telegram webhook --- .../SocialBotManagerService.java | 41 ------------------- 1 file changed, 41 deletions(-) diff --git a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java index e47ce8e4..c2a9cef8 100644 --- a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java +++ b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java @@ -1265,47 +1265,6 @@ public Response deactivateBotAll(@PathParam("botAgentId") String bot, JSONObject return Response.status(Status.NOT_FOUND).entity(bot + " not found.").build(); } - - @POST - @Path("/events/telegram/{token}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.TEXT_PLAIN) - @ApiOperation(value = "Receive an Telegram event") - @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "") }) - public Response telegramEvent(String body, @PathParam("token") String token) { - - new Thread(new Runnable() { - @Override - public void run() { - - // Identify bot - Bot bot = null; - - for (Bot b : getConfig().getBots().values()) { - if (b.getMessenger(ChatService.TELEGRAM) != null) { - bot = b; - } - } - if (bot == null) - System.out.println("cannot relate telegram event to a bot with token: " + token); - System.out.println("telegram event: bot identified: " + bot.getName()); - - // Handle event - Messenger messenger = bot.getMessenger(ChatService.TELEGRAM); - EventChatMediator mediator = (EventChatMediator) messenger.getChatMediator(); - JSONParser jsonParser = new JSONParser(JSONParser.MODE_PERMISSIVE); - JSONObject parsedBody; - try { - parsedBody = (JSONObject) jsonParser.parse(body); - mediator.handleEvent(parsedBody); - } catch (ParseException e) { - e.printStackTrace(); - } - } - }).start(); - - return Response.status(200).build(); - } } public void checkRoutineTrigger(BotConfiguration botConfig, JSONObject j, BotAgent botAgent, String botFunctionId,