From bac7c27e8a3d50ba8b2c12118a3b1535618d02be Mon Sep 17 00:00:00 2001 From: Ilias Ouchman Date: Thu, 3 Dec 2026 12:30:45 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20le=20r=C3=A9cap=20de=20session=20ne=20ci?= =?UTF-8?q?te=20le=20pseudo=20qu'une=20fois,=20dans=20le=20titre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- embeds/session.py | 1 - i18n.py | 200 ++++++++++++++++++++--------------------- tests/test_sessions.py | 11 +++ 3 files changed, 111 insertions(+), 101 deletions(-) diff --git a/embeds/session.py b/embeds/session.py index cc66795..96a39d5 100644 --- a/embeds/session.py +++ b/embeds/session.py @@ -24,7 +24,6 @@ def verdict_text(player: TrackedPlayer, session: Session, lang: str, picker: Var player.guild_id, lang, verdict.key, - player=player.ref.display, games=plural(lang, session.count, "game"), wins=session.wins, losses=session.losses, diff --git a/i18n.py b/i18n.py index 5429f6e..c52b88a 100644 --- a/i18n.py +++ b/i18n.py @@ -764,156 +764,156 @@ # ── Récap de session : verdict (voir sessions.verdict) ── "session_one_win": { "fr": ( - "🎯 **{player}** : une game, une victoire, au lit. La discipline des champions.", - "🎯 **{player}** a gagné sa seule partie et s'est arrêté là. Personne ne fait ça. Respect.", - "🎯 Une victoire et on éteint : **{player}** a compris quelque chose que le serveur ignore.", - "🎯 **{player}** : 1 game, 1 win. Le ratio parfait, à encadrer.", - "🎯 **{player}** a pris ses LP et s'est enfui. Le braquage parfait.", + "🎯 Une game, une victoire, au lit. La discipline des champions.", + "🎯 Une seule partie, gagnée, et rideau. Personne ne fait ça. Respect.", + "🎯 Une victoire et on éteint : quelqu'un a compris ce que le serveur ignore.", + "🎯 1 game, 1 win. Le ratio parfait, à encadrer.", + "🎯 Les LP pris, la fuite assurée. Le braquage parfait.", ), "en": ( - "🎯 **{player}**: one game, one win, bedtime. Champion discipline.", - "🎯 **{player}** won their only game and stopped there. Nobody does that. Respect.", - "🎯 One win and log off: **{player}** understood something the rest of the server didn't.", - "🎯 **{player}**: 1 game, 1 win. The perfect ratio, frame it.", - "🎯 **{player}** grabbed the LP and ran. The perfect heist.", + "🎯 One game, one win, bedtime. Champion discipline.", + "🎯 One game, won, and done. Nobody does that. Respect.", + "🎯 One win and log off: someone understood what the rest of the server didn't.", + "🎯 1 game, 1 win. The perfect ratio, frame it.", + "🎯 Grabbed the LP and ran. The perfect heist.", ), }, "session_one_loss": { "fr": ( - "🚪 **{player}** a lancé une game, l'a perdue, et a fermé le jeu. Rage quit maîtrisé.", - "🚪 Une défaite et ciao : **{player}** a choisi la santé mentale.", - "🚪 **{player}** : 1 game, 1 défaite. Le jeu a parlé, il n'y avait rien à ajouter.", - "🚪 **{player}** : venu, battu, reparti. Court, mais intense.", - "🚪 Une seule partie pour **{player}**, et ce n'était pas la bonne. Revanche demain ?", + "🚪 Une game lancée, une game perdue, le jeu fermé. Rage quit maîtrisé.", + "🚪 Une défaite et ciao : la santé mentale d'abord.", + "🚪 1 game, 1 défaite. Le jeu a parlé, il n'y avait rien à ajouter.", + "🚪 Venu, battu, reparti. Court, mais intense.", + "🚪 Une seule partie, et ce n'était pas la bonne. Revanche demain ?", ), "en": ( - "🚪 **{player}** queued one game, lost it, and closed the client. Controlled rage quit.", - "🚪 One loss and gone: **{player}** chose mental health.", - "🚪 **{player}**: 1 game, 1 loss. The game has spoken, nothing to add.", - "🚪 **{player}** came, lost, and left. Short but intense.", - "🚪 Just one game for **{player}**, and it wasn't the right one. Rematch tomorrow?", + "🚪 Queued one game, lost it, closed the client. Controlled rage quit.", + "🚪 One loss and gone: mental health comes first.", + "🚪 1 game, 1 loss. The game has spoken, nothing to add.", + "🚪 Came, lost, left. Short but intense.", + "🚪 Just one game, and it wasn't the right one. Rematch tomorrow?", ), }, "session_flawless": { "fr": ( - "🏆 **{player}** : {games}, zéro défaite. Session parfaite, on ne touche plus à rien.", - "🏆 Sans-faute pour **{player}** : {games}, toutes gagnées. Le smurf est démasqué ?", - "🏆 **{player}** a tout gagné. Profite, ça n'arrivera plus jamais.", - "🏆 **{player}** : {games}, toutes gagnées (oui, toutes). Va te coucher sur cette note.", - "🏆 Session immaculée pour **{player}**. Les mates ont dû être échangés à la naissance.", - "🏆 **{player}** sort de {games} sans une défaite. Screenshot, encadre, accroche au mur.", + "🏆 {games}, zéro défaite. Session parfaite, on ne touche plus à rien.", + "🏆 Sans-faute : {games}, toutes gagnées. Le smurf est démasqué ?", + "🏆 Tout gagné. Profite, ça n'arrivera plus jamais.", + "🏆 {games}, toutes gagnées (oui, toutes). Va te coucher sur cette note.", + "🏆 Session immaculée. Les mates ont dû être échangés à la naissance.", + "🏆 {games} sans une défaite. Screenshot, encadre, accroche au mur.", ), "en": ( - "🏆 **{player}**: {games}, zero losses. Perfect session, don't touch anything.", - "🏆 Flawless run for **{player}**: {games}, all won. Smurf confirmed?", - "🏆 **{player}** won everything. Enjoy it, it will never happen again.", - "🏆 **{player}**: {games}, every single one won. Go to bed on that note.", - "🏆 Spotless session for **{player}**. Someone swapped their teammates at birth.", - "🏆 **{player}** walks out of {games} unbeaten. Screenshot it, frame it, hang it up.", + "🏆 {games}, zero losses. Perfect session, don't touch anything.", + "🏆 Flawless run: {games}, all won. Smurf confirmed?", + "🏆 Won everything. Enjoy it, it will never happen again.", + "🏆 {games}, every single one won. Go to bed on that note.", + "🏆 Spotless session. Someone swapped the teammates at birth.", + "🏆 {games} unbeaten. Screenshot it, frame it, hang it up.", ), }, "session_disaster": { "fr": ( - "💀 **{player}** : {games}, toutes perdues. On appelle ça une soirée blanche.", - "💀 **{player}** a perdu tout ce qu'il y avait à perdre ({games}). Et a quand même relancé.", - "💀 Zéro victoire pour **{player}**. Le bouton « Jouer » n'était pas obligatoire.", - "💀 **{player}** : {games}, aucune victoire. Le client LoL demande s'il peut se désinstaller lui-même.", - "💀 Session à effacer pour **{player}**. Personne n'en parlera. Sauf nous.", - "💀 **{player}** a enchaîné les défaites comme d'autres enchaînent les épisodes. Que des défaites.", + "💀 {games}, toutes perdues. On appelle ça une soirée blanche.", + "💀 Tout ce qu'il y avait à perdre a été perdu ({games}). Et la file a quand même été relancée.", + "💀 Zéro victoire. Le bouton « Jouer » n'était pas obligatoire.", + "💀 {games}, aucune victoire. Le client LoL demande s'il peut se désinstaller lui-même.", + "💀 Session à effacer. Personne n'en parlera. Sauf nous.", + "💀 Les défaites enchaînées comme d'autres enchaînent les épisodes. Que des défaites.", ), "en": ( - "💀 **{player}**: {games}, all lost. A clean sweep, just the wrong way.", - "💀 **{player}** lost everything there was to lose ({games}). And still queued again.", - "💀 Zero wins for **{player}**. The Play button was not mandatory.", - "💀 **{player}**: {games}, not a single win. The client is asking if it can uninstall itself.", - "💀 Session to forget for **{player}**. Nobody will talk about it. Except us.", - "💀 **{player}** binged losses like other people binge episodes.", + "💀 {games}, all lost. A clean sweep, just the wrong way.", + "💀 Everything there was to lose, lost ({games}). And still queued again.", + "💀 Zero wins. The Play button was not mandatory.", + "💀 {games}, not a single win. The client is asking if it can uninstall itself.", + "💀 Session to forget. Nobody will talk about it. Except us.", + "💀 Losses binged like other people binge episodes.", ), }, "session_should_have_stopped": { "fr": ( - "🛑 Après {stop}, **{player}** était à {wins_then}V-{losses_then}D. Il fallait s'arrêter là. Bilan final : {wins}V-{losses}D.", - "🛑 **{player}** à {wins_then}V-{losses_then}D après {stop} : la soirée parfaite pour aller dormir. Choix retenu : finir à {wins}V-{losses}D.", - "🛑 « Allez, une dernière. » — **{player}**, à {wins_then}V-{losses_then}D, juste avant de finir à {wins}V-{losses}D.", - "🛑 **{player}** avait tout : {wins_then}V-{losses_then}D après {stop}. Puis la gourmandise. {wins}V-{losses}D.", - "🛑 Le meilleur moment de la soirée de **{player}**, c'était après {stop}. Tout ce qui a suivi est à jeter.", - "🛑 **{player}** a transformé un {wins_then}V-{losses_then}D en {wins}V-{losses}D. Savoir s'arrêter, c'est un skill aussi.", + "🛑 Après {stop}, c'était {wins_then}V-{losses_then}D. Il fallait s'arrêter là. Bilan final : {wins}V-{losses}D.", + "🛑 {wins_then}V-{losses_then}D après {stop} : la soirée parfaite pour aller dormir. Choix retenu : finir à {wins}V-{losses}D.", + "🛑 « Allez, une dernière. » À {wins_then}V-{losses_then}D, juste avant de finir à {wins}V-{losses}D.", + "🛑 Tout était là : {wins_then}V-{losses_then}D après {stop}. Puis la gourmandise. {wins}V-{losses}D.", + "🛑 Le meilleur moment de la soirée, c'était après {stop}. Tout ce qui a suivi est à jeter.", + "🛑 Un {wins_then}V-{losses_then}D transformé en {wins}V-{losses}D. Savoir s'arrêter, c'est un skill aussi.", ), "en": ( - "🛑 After {stop}, **{player}** was {wins_then}W-{losses_then}L. That was the time to stop. Final score: {wins}W-{losses}L.", - "🛑 **{player}** at {wins_then}W-{losses_then}L after {stop}: the perfect night to go to bed. They chose {wins}W-{losses}L instead.", - '🛑 "One last game." — **{player}**, at {wins_then}W-{losses_then}L, right before ending at {wins}W-{losses}L.', - "🛑 **{player}** had it all: {wins_then}W-{losses_then}L after {stop}. Then greed kicked in. {wins}W-{losses}L.", - "🛑 The best moment of **{player}**'s night was after {stop}. Everything after that goes in the bin.", - "🛑 **{player}** turned {wins_then}W-{losses_then}L into {wins}W-{losses}L. Knowing when to stop is a skill too.", + "🛑 After {stop}, it was {wins_then}W-{losses_then}L. That was the time to stop. Final score: {wins}W-{losses}L.", + "🛑 {wins_then}W-{losses_then}L after {stop}: the perfect night to go to bed. Chose {wins}W-{losses}L instead.", + '🛑 "One last game." At {wins_then}W-{losses_then}L, right before ending at {wins}W-{losses}L.', + "🛑 It was all there: {wins_then}W-{losses_then}L after {stop}. Then greed kicked in. {wins}W-{losses}L.", + "🛑 The best moment of the night was after {stop}. Everything after that goes in the bin.", + "🛑 {wins_then}W-{losses_then}L turned into {wins}W-{losses}L. Knowing when to stop is a skill too.", ), }, "session_comeback": { "fr": ( - "🔄 **{player}** était à {wins_then}V-{losses_then}D après {stop}… et finit à {wins}V-{losses}D. Remontada !", - "🔄 Mené {wins_then}V-{losses_then}D, **{player}** n'a rien lâché : {wins}V-{losses}D au final. Respect.", - "🔄 **{player}** a frôlé la soirée catastrophe ({wins_then}V-{losses_then}D) avant de tout retourner. {wins}V-{losses}D.", - "🔄 À {wins_then}V-{losses_then}D, la tombe était creusée. **{player}** finit à {wins}V-{losses}D.", - "🔄 **{player}** : départ en enfer, arrivée au paradis. {wins}V-{losses}D, rien que ça.", - "🔄 À {wins_then}V-{losses_then}D, n'importe qui aurait éteint le PC. Pas **{player}**.", + "🔄 {wins_then}V-{losses_then}D après {stop}… et {wins}V-{losses}D à l'arrivée. Remontada !", + "🔄 Mené {wins_then}V-{losses_then}D, rien lâché : {wins}V-{losses}D au final. Respect.", + "🔄 La soirée catastrophe a été frôlée ({wins_then}V-{losses_then}D) avant de tout retourner. {wins}V-{losses}D.", + "🔄 À {wins_then}V-{losses_then}D, la tombe était creusée. Arrivée à {wins}V-{losses}D.", + "🔄 Départ en enfer, arrivée au paradis. {wins}V-{losses}D, rien que ça.", + "🔄 À {wins_then}V-{losses_then}D, n'importe qui aurait éteint le PC. Pas ici.", ), "en": ( - "🔄 **{player}** was {wins_then}W-{losses_then}L after {stop}… and ends at {wins}W-{losses}L. What a comeback!", - "🔄 Down {wins_then}W-{losses_then}L, **{player}** never gave up: {wins}W-{losses}L in the end. Respect.", - "🔄 **{player}** nearly had a disaster night ({wins_then}W-{losses_then}L) before turning it around. {wins}W-{losses}L.", - "🔄 Everyone had buried them at {wins_then}W-{losses_then}L. **{player}** ends at {wins}W-{losses}L.", - "🔄 **{player}**: started in hell, finished in heaven. {wins}W-{losses}L, no less.", - "🔄 At {wins_then}W-{losses_then}L, anyone would have turned the PC off. Not **{player}**.", + "🔄 {wins_then}W-{losses_then}L after {stop}… and {wins}W-{losses}L at the finish. What a comeback!", + "🔄 Down {wins_then}W-{losses_then}L, never gave up: {wins}W-{losses}L in the end. Respect.", + "🔄 A disaster night was close ({wins_then}W-{losses_then}L) before it all turned around. {wins}W-{losses}L.", + "🔄 Everyone had dug the grave at {wins_then}W-{losses_then}L. Final score: {wins}W-{losses}L.", + "🔄 Started in hell, finished in heaven. {wins}W-{losses}L, no less.", + "🔄 At {wins_then}W-{losses_then}L, anyone would have turned the PC off. Not this time.", ), }, "session_good": { "fr": ( - "😎 Bonne soirée pour **{player}** : {wins}V-{losses}D. On valide.", - "😎 **{player}** termine dans le vert, {wins}V-{losses}D. Pas parfait, mais propre.", - "😎 {wins}V-{losses}D pour **{player}**. Le ladder a reçu plus qu'il n'a donné.", - "😎 **{player}** s'arrête au bon moment, sur un {wins}V-{losses}D. Rare, donc on le note.", - "😎 Session rentable pour **{player}** ({wins}V-{losses}D). Les mates étaient de bonne humeur.", + "😎 Bonne soirée : {wins}V-{losses}D. On valide.", + "😎 Fin dans le vert, {wins}V-{losses}D. Pas parfait, mais propre.", + "😎 {wins}V-{losses}D. Le ladder a reçu plus qu'il n'a donné.", + "😎 Arrêt au bon moment, sur un {wins}V-{losses}D. Rare, donc on le note.", + "😎 Session rentable ({wins}V-{losses}D). Les mates étaient de bonne humeur.", ), "en": ( - "😎 Good night for **{player}**: {wins}W-{losses}L. Approved.", - "😎 **{player}** finishes in the green, {wins}W-{losses}L. Not perfect, but clean.", - "😎 {wins}W-{losses}L for **{player}**. The ladder gave more than it took.", - "😎 **{player}** stops at the right time, on {wins}W-{losses}L. Rare, so we're writing it down.", - "😎 Profitable session for **{player}** ({wins}W-{losses}L). The teammates were in a good mood.", + "😎 Good night: {wins}W-{losses}L. Approved.", + "😎 Finished in the green, {wins}W-{losses}L. Not perfect, but clean.", + "😎 {wins}W-{losses}L. The ladder gave more than it took.", + "😎 Stopped at the right time, on {wins}W-{losses}L. Rare, so we're writing it down.", + "😎 Profitable session ({wins}W-{losses}L). The teammates were in a good mood.", ), }, "session_even": { "fr": ( - "😐 **{player}** : {games} pour finir à égalité. Tout ça pour ça.", - "😐 Autant de victoires que de défaites pour **{player}**. Une soirée pour rien, mais une belle soirée pour rien.", - "😐 **{player}** a joué {games} pour revenir exactement au point de départ. Efficace.", - "😐 Bilan nul pour **{player}**. Le ladder n'a même pas remarqué son passage.", - "😐 **{player}** : {games}, zéro progrès. Mais zéro dégât non plus, on prend.", + "😐 {games} pour finir à égalité. Tout ça pour ça.", + "😐 Autant de victoires que de défaites. Une soirée pour rien, mais une belle soirée pour rien.", + "😐 {games} jouées pour revenir exactement au point de départ. Efficace.", + "😐 Bilan nul. Le ladder n'a même pas remarqué le passage.", + "😐 {games}, zéro progrès. Mais zéro dégât non plus, on prend.", ), "en": ( - "😐 **{player}**: {games} to end up even. All that for nothing.", - "😐 As many wins as losses for **{player}**. A night for nothing, but a nice night for nothing.", - "😐 **{player}** played {games} to end up exactly where they started. Efficient.", - "😐 Even session for **{player}**. The ladder didn't even notice.", - "😐 **{player}**: {games}, zero progress. Zero damage either, we'll take it.", + "😐 {games} to end up even. All that for nothing.", + "😐 As many wins as losses. A night for nothing, but a nice night for nothing.", + "😐 {games} played to end up exactly where it started. Efficient.", + "😐 Even session. The ladder didn't even notice.", + "😐 {games}, zero progress. Zero damage either, we'll take it.", ), }, "session_bad": { "fr": ( - "📉 **{player}** finit à {wins}V-{losses}D. Demain sera un autre jour (pire, sûrement).", - "📉 Session dans le rouge pour **{player}** : {wins}V-{losses}D. La faute au jungler, évidemment.", - "📉 {wins}V-{losses}D pour **{player}**. Les LP sont partis financer les vacances des adversaires.", - "📉 **{player}** : {wins}V-{losses}D. Ce n'était pas la soirée, ni la semaine, ni peut-être le jeu.", - "📉 **{player}** a donné plus de LP que reçu ({wins}V-{losses}D). Très généreux.", - "📉 Soirée compliquée pour **{player}** : {wins}V-{losses}D. On fera semblant de ne pas avoir vu.", + "📉 Fin à {wins}V-{losses}D. Demain sera un autre jour (pire, sûrement).", + "📉 Session dans le rouge : {wins}V-{losses}D. La faute au jungler, évidemment.", + "📉 {wins}V-{losses}D. Les LP sont partis financer les vacances des adversaires.", + "📉 {wins}V-{losses}D. Ce n'était pas la soirée, ni la semaine, ni peut-être le jeu.", + "📉 Plus de LP donnés que reçus ({wins}V-{losses}D). Très généreux.", + "📉 Soirée compliquée : {wins}V-{losses}D. On fera semblant de ne pas avoir vu.", ), "en": ( - "📉 **{player}** ends at {wins}W-{losses}L. Tomorrow is another day (probably worse).", - "📉 Session in the red for **{player}**: {wins}W-{losses}L. The jungler's fault, obviously.", - "📉 {wins}W-{losses}L for **{player}**. Those LP went to fund the enemy team's holidays.", - "📉 **{player}**: {wins}W-{losses}L. Wrong night, wrong week, maybe wrong game.", - "📉 **{player}** gave away more LP than they took ({wins}W-{losses}L). Very generous.", - "📉 Rough night for **{player}**: {wins}W-{losses}L. We'll pretend we didn't see it.", + "📉 Ended at {wins}W-{losses}L. Tomorrow is another day (probably worse).", + "📉 Session in the red: {wins}W-{losses}L. The jungler's fault, obviously.", + "📉 {wins}W-{losses}L. Those LP went to fund the enemy team's holidays.", + "📉 {wins}W-{losses}L. Wrong night, wrong week, maybe wrong game.", + "📉 Gave away more LP than taken ({wins}W-{losses}L). Very generous.", + "📉 Rough night: {wins}W-{losses}L. We'll pretend we didn't see it.", ), }, "session_marathon": { diff --git a/tests/test_sessions.py b/tests/test_sessions.py index 6f40cf3..62d529d 100644 --- a/tests/test_sessions.py +++ b/tests/test_sessions.py @@ -206,3 +206,14 @@ async def test_duree_enregistree_avec_le_resultat(tracked_bot, tracking, riot, d await tracking.run_cycle() (game,) = db.games_after(PA, GUILD_ID, 0) assert (game.match_id, game.duration, game.champion) == ("EUW1_200", 1800, "Ahri") + + +def test_les_verdicts_ne_repetent_pas_le_pseudo() -> None: + """Le pseudo est déjà dans le titre du récap (« Fin de session pour … »).""" + from i18n import MESSAGE_VARIANTS + + for key, texts in MESSAGE_VARIANTS.items(): + if key.startswith("session_"): + for lang, variants in texts.items(): + for text in variants: + assert "{player}" not in text, (key, lang, text)