Skip to content

Commit

Permalink
俺が払うよ
Browse files Browse the repository at this point in the history
  • Loading branch information
H1rono committed Feb 25, 2024
1 parent 0553a02 commit c2f400b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/scala/h1rono/BotHandler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ object BotHandler {
private def handleMessage(username: String, channelId: String, plainText: String): F[Unit] = {
val joinRegex = raw"""join""".r
val leaveRegex = raw"""leave""".r
val theRegex = raw"""モラがない""".r
val matchPair = (
joinRegex.findFirstMatchIn(plainText).isDefined,
leaveRegex.findFirstMatchIn(plainText).isDefined
Expand All @@ -145,6 +146,13 @@ object BotHandler {
case (false, true) => conf.client.leaveChannel(channelId)
case _ => noneF[F, Unit]
}
_ <- theRegex.findFirstMatchIn(plainText) match {
case None => noneF[F, Unit]
case Some(_) => {
val target = TraqClient.SendTarget.Channel(channelId)
conf.client.sendMessage(target, "俺が払うよ", false).map(_ => ())
}
}
} yield ()
}

Expand Down

0 comments on commit c2f400b

Please sign in to comment.