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

Commit

Permalink
Improved random episode selection in AyaneJob
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziedelth committed Sep 9, 2023
1 parent 34725a0 commit bd1585b
Showing 1 changed file with 11 additions and 7 deletions.
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

0 comments on commit bd1585b

Please sign in to comment.