.
This commit is contained in:
parent
2ae91ebd66
commit
b945a0d677
@ -16,6 +16,14 @@ import java.util.*
|
|||||||
@EnableScheduling // 추가
|
@EnableScheduling // 추가
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
class LunApplication {
|
class LunApplication {
|
||||||
|
init {
|
||||||
|
val client = WebClient.create()
|
||||||
|
client.get()
|
||||||
|
.uri("https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/sendMessage?chat_id=71476436&text=SERVER_START")
|
||||||
|
.retrieve()
|
||||||
|
.bodyToMono(String::class.java).block() ?: "FAIL"
|
||||||
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 0/4 * * *") //
|
@Scheduled(cron = "0 0 0/4 * * *") //
|
||||||
fun runJob() {
|
fun runJob() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -13,16 +13,37 @@ class Telegram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping("webhook")
|
@PostMapping("webhook")
|
||||||
fun test(@PathVariable path : String) {
|
fun test(httpServletRequest: HttpServletRequest, @RequestBody update : TelegramUpdate?) {
|
||||||
println("path >>> $path")
|
try {
|
||||||
val client = WebClient.create()
|
logger.log("test strat ${update}")
|
||||||
client.get()
|
logger.log("test strat ${httpServletRequest.requestURI}")
|
||||||
.uri("https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/getUpdates")
|
// val client0 = WebClient.create()
|
||||||
.retrieve()
|
// client0.get()
|
||||||
.bodyToMono(String::class.java).block() ?: "FAIL"
|
// .uri("https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/getUpdates")
|
||||||
|
// .retrieve()
|
||||||
|
// .bodyToMono(String::class.java).subscribe { result ->
|
||||||
|
logger.log("test $httpServletRequest.requestURI")
|
||||||
|
// var sss = Gson().fromJson<TelegramUpdate>(jsonString, TelegramUpdate::class.java)
|
||||||
|
// if (sss.ok) {
|
||||||
|
// var doSend = false
|
||||||
|
// sss.result?.forEach {
|
||||||
|
// if (!doSend) doSend = it.message?.text?.contains("어디") ?: false
|
||||||
|
// }
|
||||||
|
// if (doSend) {
|
||||||
|
// val client = WebClient.create()
|
||||||
|
// client.get()
|
||||||
|
// .uri("https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/sendMessage?chat_id=71476436&text=OK")
|
||||||
|
// .retrieve()
|
||||||
|
// .bodyToMono(String::class.java).block() ?: "FAIL"
|
||||||
|
// }
|
||||||
|
// logger.log("test OK")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
} catch (e : Exception) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// @ResponseBody
|
// @ResponseBody
|
||||||
// @GetMapping("webhook")
|
// @GetMapping("webhook")
|
||||||
|
|||||||
@ -8,6 +8,11 @@ spring.data.mongodb.host=nas.lunaticbum.kr
|
|||||||
#spring.data.mongodb.host=localhost
|
#spring.data.mongodb.host=localhost
|
||||||
spring.data.mongodb.port=27017
|
spring.data.mongodb.port=27017
|
||||||
spring.data.mongodb.database=lun_db
|
spring.data.mongodb.database=lun_db
|
||||||
|
#SSL
|
||||||
|
server.ssl.key-store=classpath:prv.p12
|
||||||
|
server.ssl.key-store-type=PKCS12
|
||||||
|
server.ssl.key-store-password=VioPup*383
|
||||||
|
server.http2.enabled=true
|
||||||
#spring.main.web-application-type=SERVLET
|
#spring.main.web-application-type=SERVLET
|
||||||
#logging.level.org.springframework.boot.autoconfigure=ERROR
|
#logging.level.org.springframework.boot.autoconfigure=ERROR
|
||||||
#spring.mvc.view.prefix=/templates
|
#spring.mvc.view.prefix=/templates
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user