...
This commit is contained in:
parent
3fae93db8e
commit
5360a7ad13
@ -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<TelegramBotUpdate>(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<TelegramBotUpdate>(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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user