diff --git a/gradle.properties b/gradle.properties index 3321ea6..ff2c645 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ MORNY_ARCHIVE_NAME = morny-coeur MORNY_CODE_STORE = https://github.com/Eyre-S/Coeur-Morny-Cono MORNY_COMMIT_PATH = https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s -VERSION = 1.1.1-alpha2 +VERSION = 1.1.1-alpha3 USE_DELTA = false VERSION_DELTA = diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnUserRandom.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnUserRandom.scala index 6232323..02eba33 100644 --- a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnUserRandom.scala +++ b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnUserRandom.scala @@ -4,7 +4,7 @@ import cc.sukazyo.cono.morny.MornyCoeur import cc.sukazyo.cono.morny.bot.api.EventListener import cc.sukazyo.cono.morny.util.tgapi.TelegramExtensions.Bot.exec import com.pengrad.telegrambot.model.Update -import com.pengrad.telegrambot.request.{AbstractSendRequest, SendMessage} +import com.pengrad.telegrambot.request.SendMessage import com.pengrad.telegrambot.response.SendResponse import scala.language.postfixOps @@ -47,13 +47,14 @@ class OnUserRandom (using coeur: MornyCoeur) { //noinspection NonAsciiCharacters object 尊嘟假嘟 extends EventListener { - private val keywords = Array("尊嘟假嘟", "O.o", "o.O") + private val word_pattern = "^([\\w\\W]*)?(?:尊嘟假嘟|(?:O\\.o|o\\.O))$"r override def onMessage (using event: Update): Boolean = { if event.message.text == null then return false - if !(keywords contains event.message.text) then return false + if word_pattern matches event.message.text then {} + else return false import cc.sukazyo.cono.morny.util.UseRandom.rand_half coeur.account exec SendMessage(