Skip to content

Commit

Permalink
revert temp fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mmvpm committed May 13, 2024
1 parent 9328ac5 commit 0a21d21
Showing 1 changed file with 6 additions and 24 deletions.
30 changes: 6 additions & 24 deletions bot/src/main/scala/com/github/mmvpm/bot/OfferServiceBot.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,12 @@ class OfferServiceBot[F[_]: Concurrent](
}

private def replyResolved(tag: String)(implicit message: Message): F[Unit] =
Concurrent[F].ifM(isUserBanned)(
reply(
"""
|Вы были забанены за неоднократное нарушение правил сервиса
|
|Связаться с поддержкой: @mmvpm
|""".stripMargin
).void,
for {
nextState <- stateManager.getNextState(tag, stateStorage.get)
_ = stateStorage.set(withoutError(nextState))
replies = renderer.render(nextState, lastMessageStorage.get, lastPhotosStorage.get)
_ <- requestLogged(replies)
} yield ()
)
for {
nextState <- stateManager.getNextState(tag, stateStorage.get)
_ = stateStorage.set(withoutError(nextState))
replies = renderer.render(nextState, lastMessageStorage.get, lastPhotosStorage.get)
_ <- requestLogged(replies)
} yield ()

private def fail(implicit message: Message): F[Unit] =
reply("Не понял вас :(").void
Expand Down Expand Up @@ -160,13 +151,4 @@ class OfferServiceBot[F[_]: Concurrent](
logger.error("Bot failed", error)
default
}.get

private def isUserBanned(implicit message: Message): F[Boolean] =
ofsManager.getMyOffers.value.map {
case Left(error) =>
println(s"isUserBanned failed with $error")
false
case Right(offers) =>
offers.count(_.status == OfferStatus.Banned) >= 5
}
}

0 comments on commit 0a21d21

Please sign in to comment.