Skip to content

Commit

Permalink
Merge pull request #12 from tmapes/respond-in-sending-channel
Browse files Browse the repository at this point in the history
Send the watched movies count to the channel who asked for it
  • Loading branch information
tmapes authored Apr 30, 2022
2 parents 5668357 + ab87d9e commit fe71d5d
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -76,7 +80,7 @@ class DiscordEventService(
return@runBlocking

with(movieWatchingRepository.getCountOfWatchedMovies()) {
sendMessage("$this movies finished")
sendMessage("$this movies finished", event.message.channelId)
}
}

Expand Down

0 comments on commit fe71d5d

Please sign in to comment.