From 744806448fb3e0e606b8706b3bd7ee3f33fe433a Mon Sep 17 00:00:00 2001 From: sunwoong Date: Thu, 5 Sep 2024 16:27:04 +0900 Subject: [PATCH] =?UTF-8?q?DRAW-275=20feat:=20=EB=B9=A0=EB=A5=B8=20?= =?UTF-8?q?=EC=8B=9C=EC=9E=91=20=EB=8C=80=EA=B8=B0=EC=97=B4=20&=20?= =?UTF-8?q?=EA=B2=8C=EC=9E=84=20=EC=8B=9C=EC=9E=91=20=EC=9B=B9=ED=9B=85=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/build.gradle.kts | 1 + .../com/xorker/draw/mafia/MafiaGameRandomMatchingService.kt | 5 +++++ .../xorker/draw/mafia/phase/MafiaPhaseStartGameProcessor.kt | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index c305b6d6..19b3f6da 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -9,6 +9,7 @@ dependencies { implementation(project(":adapter:memory")) implementation(project(":adapter:oauth")) implementation(project(":adapter:rdb")) + implementation(project(":adapter:webhook:discord")) implementation(project(":support:jwt")) implementation(project(":support:time")) diff --git a/core/src/main/kotlin/com/xorker/draw/mafia/MafiaGameRandomMatchingService.kt b/core/src/main/kotlin/com/xorker/draw/mafia/MafiaGameRandomMatchingService.kt index 78afdf33..81586907 100644 --- a/core/src/main/kotlin/com/xorker/draw/mafia/MafiaGameRandomMatchingService.kt +++ b/core/src/main/kotlin/com/xorker/draw/mafia/MafiaGameRandomMatchingService.kt @@ -1,6 +1,8 @@ package com.xorker.draw.mafia import com.xorker.draw.exception.InvalidRequestOtherPlayingException +import com.xorker.draw.notify.NotifyRepository +import com.xorker.draw.notify.NotifyType import com.xorker.draw.websocket.WaitingQueueSession import com.xorker.draw.websocket.WaitingQueueSessionEventListener import org.springframework.stereotype.Service @@ -10,6 +12,7 @@ internal class MafiaGameRandomMatchingService( private val mafiaGameUseCase: MafiaGameUseCase, private val mafiaGameWaitingQueueRepository: MafiaGameWaitingQueueRepository, private val mafiaGameMessenger: MafiaGameMessenger, + private val notifyRepository: NotifyRepository, ) : WaitingQueueSessionEventListener { override fun connectSession(session: WaitingQueueSession) { @@ -22,6 +25,8 @@ internal class MafiaGameRandomMatchingService( mafiaGameWaitingQueueRepository.enqueue(4, session) mafiaGameMessenger.unicastRandomMatching(user.id) + + notifyRepository.notifyMessage(NotifyType.DiscordRandomMatchingNotifyType(user.name, session.locale)) } override fun exitSession(session: WaitingQueueSession) { diff --git a/core/src/main/kotlin/com/xorker/draw/mafia/phase/MafiaPhaseStartGameProcessor.kt b/core/src/main/kotlin/com/xorker/draw/mafia/phase/MafiaPhaseStartGameProcessor.kt index 1dcade8b..186ca1da 100644 --- a/core/src/main/kotlin/com/xorker/draw/mafia/phase/MafiaPhaseStartGameProcessor.kt +++ b/core/src/main/kotlin/com/xorker/draw/mafia/phase/MafiaPhaseStartGameProcessor.kt @@ -3,6 +3,8 @@ package com.xorker.draw.mafia.phase import com.xorker.draw.mafia.MafiaGameInfo import com.xorker.draw.mafia.MafiaKeywordRepository import com.xorker.draw.mafia.MafiaPhase +import com.xorker.draw.notify.NotifyRepository +import com.xorker.draw.notify.NotifyType import com.xorker.draw.timer.TimerRepository import org.springframework.stereotype.Component import kotlin.random.Random @@ -11,6 +13,7 @@ import kotlin.random.Random internal class MafiaPhaseStartGameProcessor( private val mafiaKeywordRepository: MafiaKeywordRepository, private val timerRepository: TimerRepository, + private val notifyRepository: NotifyRepository, ) { private val random: Random = Random(System.currentTimeMillis()) @@ -34,6 +37,8 @@ internal class MafiaPhaseStartGameProcessor( ) gameInfo.phase = phase + notifyRepository.notifyMessage(NotifyType.DiscordStartGameNotifyType(room.id, room.locale)) + return phase } }