Skip to content

Commit

Permalink
fix: allow using configure commands in DMs (for admins)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkAtra committed Aug 14, 2024
1 parent 160a6f7 commit adda4ec
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ConfigurePlayerActivityFeedCommand(
description = description
) {

dmPermission = false
dmPermission = true
disableCommandInGuilds()

addServerIdParameter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ConfigurePvpKillFeedCommand(
description = description
) {

dmPermission = false
dmPermission = true
disableCommandInGuilds()

addServerIdParameter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ConfigureStatusMonitorCommand(
description = description
) {

dmPermission = false
dmPermission = true
disableCommandInGuilds()

addServerIdParameter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,29 @@ class BotCompanionClientTest {
}
)

@Test
fun `should handle timeouts correctly`(wireMockRuntimeInfo: WireMockRuntimeInfo) {

wireMockRuntimeInfo.wireMock.register(
WireMock.get("/v-rising-discord-bot/characters")
.withHeader(HttpHeaders.ACCEPT, equalTo(MediaType.APPLICATION_JSON_VALUE))
.withHeader(HttpHeaders.USER_AGENT, equalTo("test"))
.willReturn(
WireMock.aResponse()
.withFixedDelay(10_000)
.withStatus(HttpStatus.OK.value())
)
)

val charactersResult = runBlocking {
botCompanionClient.getCharacters("localhost", wireMockRuntimeInfo.httpPort)
}
assertThat(charactersResult.isFailure).isTrue()

val exception = charactersResult.exceptionOrNull()
assertThat(exception).hasMessageContaining("Unexpected exception performing")
}

@Test
fun `should get characters`(wireMockRuntimeInfo: WireMockRuntimeInfo) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ class ServerRepositoryTest {

serverRepository.updateServer(update1)

assertThat(serverRepository.getServer(server.id, server.discordServerId)!!.hostname).isEqualTo("test-1")

val e = assertThrows<OutdatedServerException> {
serverRepository.updateServer(update2)
}
Expand Down

0 comments on commit adda4ec

Please sign in to comment.