diff --git a/src/main/kotlin/the/weekend/bot/services/DiscordEventService.kt b/src/main/kotlin/the/weekend/bot/services/DiscordEventService.kt index 3b2d652..ed5a7ef 100644 --- a/src/main/kotlin/the/weekend/bot/services/DiscordEventService.kt +++ b/src/main/kotlin/the/weekend/bot/services/DiscordEventService.kt @@ -49,10 +49,14 @@ class DiscordEventService( .filter { it.enabled } .forEach { logger.info("Sending to ${it.name} : Message: \'$message\'") - client.rest().getChannelById(it.id).createMessage(message.trimStart()).block() + sendMessage(message.trim(), it.id) } } + fun sendMessage(message: String, channelId: Snowflake) { + client.rest().getChannelById(channelId).createMessage(message).block() + } + fun sendEmbedMessage(message: String, embedData: EmbedData, channelId: Long) { val messageCreateRequest = MessageCreateRequest.builder().content(message).embed(embedData).build() val channelSnowflake = Snowflake.of(channelId) @@ -76,7 +80,7 @@ class DiscordEventService( return@runBlocking with(movieWatchingRepository.getCountOfWatchedMovies()) { - sendMessage("$this movies finished") + sendMessage("$this movies finished", event.message.channelId) } }