scalafmt
parent
2c493f6133
commit
1fdf1f2ed1
|
@ -100,8 +100,9 @@ final class Env(
|
|||
assessApi.onGameReady(game, whiteUser, blackUser)
|
||||
}
|
||||
if (game.status == chess.Status.Cheat)
|
||||
game.loserUserId foreach { userId => logApi.cheatDetected(userId, game.id) >>
|
||||
reportApi.autoCheatDetectedReport(userId, logApi.countRecentCheatDetected(userId))
|
||||
game.loserUserId foreach { userId =>
|
||||
logApi.cheatDetected(userId, game.id) >>
|
||||
reportApi.autoCheatDetectedReport(userId, logApi.countRecentCheatDetected(userId))
|
||||
}
|
||||
case lila.hub.actorApi.mod.ChatTimeout(mod, user, reason, text) =>
|
||||
logApi.chatTimeout(mod, user, reason, text).unit
|
||||
|
|
|
@ -256,10 +256,11 @@ final class ModlogApi(repo: ModlogRepo, userRepo: UserRepo, slackApi: lila.slack
|
|||
|
||||
def countRecentCheatDetected(userId: User.ID): Fu[Int] =
|
||||
coll.countSel(
|
||||
$doc("user" -> userId,
|
||||
"action" -> Modlog.cheatDetected,
|
||||
"date" $gte DateTime.now.minusSeconds(3600 * 24 * 30 * 6)
|
||||
)
|
||||
$doc(
|
||||
"user" -> userId,
|
||||
"action" -> Modlog.cheatDetected,
|
||||
"date" $gte DateTime.now.minusSeconds(3600 * 24 * 30 * 6)
|
||||
)
|
||||
)
|
||||
|
||||
private def add(m: Modlog): Funit = {
|
||||
|
|
|
@ -163,18 +163,18 @@ final class ReportApi(
|
|||
|
||||
def autoCheatDetectedReport(userId: User.ID, nbRecentCheatDetected: Fu[Int]): Funit =
|
||||
userRepo.byId(userId) zip getLichessReporter zip nbRecentCheatDetected flatMap {
|
||||
case Some(user) ~ reporter ~ cheatedGames if (!user.lame && cheatedGames >= 3) =>
|
||||
lila.mon.cheat.autoReport.increment()
|
||||
create(
|
||||
Candidate(
|
||||
reporter = reporter,
|
||||
suspect = Suspect(user),
|
||||
reason = Reason.Cheat,
|
||||
text = s"$cheatedGames cheat detected in the last 6 months"
|
||||
)
|
||||
case Some(user) ~ reporter ~ cheatedGames if !user.lame && cheatedGames >= 3 =>
|
||||
lila.mon.cheat.autoReport.increment()
|
||||
create(
|
||||
Candidate(
|
||||
reporter = reporter,
|
||||
suspect = Suspect(user),
|
||||
reason = Reason.Cheat,
|
||||
text = s"$cheatedGames cheat detected in the last 6 months"
|
||||
)
|
||||
case _ => funit
|
||||
}
|
||||
)
|
||||
case _ => funit
|
||||
}
|
||||
|
||||
def autoBotReport(userId: String, referer: Option[String], name: String): Funit =
|
||||
getSuspect(userId) zip getLichessReporter flatMap {
|
||||
|
|
Loading…
Reference in New Issue