package Ġspace . yar os lav . family bot . services . rout ers Ċ Ċ import Ġorg . springframework . stereotype . Component Ċ import Ġorg . telegram . telegram bots . meta . api . objects . Update Ċ import Ġspace . yar os lav . family bot . common . extensions . to User Ċ import Ġspace . yar os lav . family bot . getLogger Ċ import Ġspace . yar os lav . family bot . services . scenario . Scenario Game play Service Ċ import Ġspace . yar os lav . family bot . services . scenario . Scenario Poll Man aging Service Ċ import Ġspace . yar os lav . family bot . telegram . Family Bot Ċ import Ġjava . time . Instant Ċ import Ġjava . time . temporal . Ch rono Unit Ċ Ċ @ Component Ċ class ĠPoll Router ( ĊĠĠĠ Ġprivate Ġval Ġscenario Poll Man aging Service : ĠScenario Poll Man aging Service , ĊĠĠĠ Ġprivate Ġval Ġscenario Game play Service : ĠScenario Game play Service Ċ ) Ġ{ ĊĠĠĠ Ġprivate Ġval Ġlog Ġ= Ġget Logger () ĊĊĠĠĠ Ġfun Ġproceed ( update : ĠUpdate ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġanswer Ġ= Ġupdate . poll Answer ĊĠĠĠĠĠĠĠ Ġval Ġpoll Ġ= Ġscenario Poll Man aging Service . find Scenario Poll ( answer . poll Id ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġreturn ĊĠĠĠĠĠĠĠ Ġif Ġ( poll . create Date . is Before ( Instant . now (). minus ( 1 , ĠCh rono Unit . DAYS ))) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġlog . info (" Trying Ġto Ġproceed Ġpoll Ġ$ poll , Ġanswer Ġis Ġ$ answer ") ĊĠĠĠĠĠĠĠ Ġval Ġscenario Move Ġ= Ġpoll . scenario Move ĊĠĠĠĠĠĠĠ Ġval Ġchat Ġ= Ġpoll . chat ĊĠĠĠĠĠĠĠ Ġval Ġuser Ġ= Ġanswer . user . to User ( chat Ġ= Ġchat ) ĊĠĠĠĠĠĠĠ Ġif Ġ( answer . option Ids . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġscenario Way Ġ= Ġscenario Move . ways . find Ġ{ Ġit . answer Number Ġ== Ġanswer . option Ids . first () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġthrow ĠFamily Bot . Internal Exception (" Can 't Ġfind Ġproper Ġanswer ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġscenario Game play Service . add Choice ( chat , Ġuser , Ġscenario Move , Ġscenario Way ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġscenario Game play Service . remove Choice ( chat , Ġuser , Ġscenario Move ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ