Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Improved random episode selection in AyaneJob #132

Merged
merged 1 commit into from
Sep 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/main/kotlin/fr/jais/scraper/jobs/AyaneJob.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,21 @@ class AyaneJob : Job {
val day = LocalDate.now().dayOfWeek.getDisplayName(TextStyle.FULL, Locale.FRANCE).lowercase()
val date = LocalDate.now().format(DateTimeFormatter.ofPattern("dd/MM"))

var string = "🎯 | Votre planning #anime pour ce $day $date :\n"
var string: String

episodes.forEach {
string += "\n#${
it.first.name.split(":", ",", "-").first().capitalizeWords().onlyLettersAndDigits()
} EP${it.second.split(" ")[1]}"
}
do {
string = "🎯 | Votre planning #anime pour ce $day $date :\n"

episodes.shuffled().take(7).forEach {
string += "\n#${
it.first.name.split(":", ",", "-").first().capitalizeWords().onlyLettersAndDigits()
} EP${it.second.split(" ")[1]}"
}

string += """
string += """

Bonne journée ! 😊"""
} while (string.length > 250)

Logger.info(string)

Expand Down