From 5360a7ad135e167b06965e68be7e21a137999c19 Mon Sep 17 00:00:00 2001 From: lunaticbum <> Date: Thu, 19 Sep 2024 18:08:45 +0900 Subject: [PATCH] ... --- .../launcher/workers/TelegramBotGetter.kt | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/app/src/main/kotlin/rasel/lunar/launcher/workers/TelegramBotGetter.kt b/app/src/main/kotlin/rasel/lunar/launcher/workers/TelegramBotGetter.kt index 01880069..17e5db51 100644 --- a/app/src/main/kotlin/rasel/lunar/launcher/workers/TelegramBotGetter.kt +++ b/app/src/main/kotlin/rasel/lunar/launcher/workers/TelegramBotGetter.kt @@ -35,38 +35,38 @@ class TelegramBotGetter : BaseGetter { try { try { - val url = "https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/getUpdates" - //"https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/sendMessage?chat_id=71476436&text=안녕하세요." - //7068729507 - // OkHttp 클라이언트 객체 생성 - val client = OkHttpClient.Builder().connectionPool(ConnectionPool(5,60,TimeUnit.SECONDS)).build() - - // GET 요청 객체 생성 - val builder: Request.Builder = Request.Builder().url(url).addHeader("Content-Type", "application/json").get() - - val request: Request = builder.build() - - BLog.LOGE("telegram before request ") - // OkHttp 클라이언트로 GET 요청 객체 전송 - val response: Response = client.newCall(request).execute() - if (response.isSuccessful()) { - // 응답 받아서 처리 - val body: ResponseBody? = response.body() - if (body != null) { - Gson().fromJson(body.string(),TelegramBotUpdate::class.java)?.let { telegramUpdates -> - telegramUpdates.fill() - telegramUpdates.list.forEach { - if (it.message?.text?.startsWith("/") == true) { - BLog.LOGE("telegram telegramUpdates >>>> ${Gson().toJson(it)}") - } - } -// BLog.LOGE("telegram telegramUpdates >>>> ${Gson().toJson(telegramUpdates)}") -// WorkersDb.getRealm().writeBlocking { -// copyToRealm(telegramUpdates) +// val url = "https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/getUpdates" +// //"https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/sendMessage?chat_id=71476436&text=안녕하세요." +// //7068729507 +// // OkHttp 클라이언트 객체 생성 +// val client = OkHttpClient.Builder().connectionPool(ConnectionPool(5,60,TimeUnit.SECONDS)).build() +// +// // GET 요청 객체 생성 +// val builder: Request.Builder = Request.Builder().url(url).addHeader("Content-Type", "application/json").get() +// +// val request: Request = builder.build() +// +// BLog.LOGE("telegram before request ") +// // OkHttp 클라이언트로 GET 요청 객체 전송 +// val response: Response = client.newCall(request).execute() +// if (response.isSuccessful()) { +// // 응답 받아서 처리 +// val body: ResponseBody? = response.body() +// if (body != null) { +// Gson().fromJson(body.string(),TelegramBotUpdate::class.java)?.let { telegramUpdates -> +// telegramUpdates.fill() +// telegramUpdates.list.forEach { +// if (it.message?.text?.startsWith("/") == true) { +// BLog.LOGE("telegram telegramUpdates >>>> ${Gson().toJson(it)}") +// } // } - } - } - } else BLog.LOGE("telegram Error Occurred") +//// BLog.LOGE("telegram telegramUpdates >>>> ${Gson().toJson(telegramUpdates)}") +//// WorkersDb.getRealm().writeBlocking { +//// copyToRealm(telegramUpdates) +//// } +// } +// } +// } else BLog.LOGE("telegram Error Occurred") } catch (e: java.lang.Exception) { e.printStackTrace()