-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor assignPlayerQuestUsecase and add test
- Loading branch information
Showing
18 changed files
with
276 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...tw/waterballsa/utopia/utopiagamification/quest/domain/exception/AssignedQuestException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package tw.waterballsa.utopia.utopiagamification.quest.domain.exception | ||
|
||
class AssignedQuestException(playerId: String, questId: Int) : | ||
RuntimeException("Player already owns this quest. {playerId:$playerId, questId:$questId}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ballsa/utopia/utopiagamification/quest/listeners/presenters/AssignPlayerQuestPresenter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package tw.waterballsa.utopia.utopiagamification.quest.listeners.presenters | ||
|
||
import net.dv8tion.jda.api.entities.User | ||
import net.dv8tion.jda.api.interactions.InteractionHook | ||
import tw.waterballsa.utopia.utopiagamification.quest.domain.Mission | ||
import tw.waterballsa.utopia.utopiagamification.quest.extensions.publishToUser | ||
import tw.waterballsa.utopia.utopiagamification.quest.usecase.AssignPlayerQuestUsecase | ||
|
||
class AssignPlayerQuestPresenter( | ||
private val user: User, | ||
private val hook: InteractionHook? = null | ||
) : AssignPlayerQuestUsecase.Presenter { | ||
override fun presentMission(mission: Mission) { | ||
hook?.editOriginal("你已接取第一個任務,到私訊查看內容吧!")?.queue() | ||
mission.publishToUser(user) | ||
} | ||
} |
Oops, something went wrong.