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 } }