mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2024-11-22 19:24:53 +08:00
cha 尊嘟假嘟 from full-match to endswith match
This commit is contained in:
parent
0898d08fa7
commit
51d0f2a75b
@ -5,7 +5,7 @@ MORNY_ARCHIVE_NAME = morny-coeur
|
|||||||
MORNY_CODE_STORE = https://github.com/Eyre-S/Coeur-Morny-Cono
|
MORNY_CODE_STORE = https://github.com/Eyre-S/Coeur-Morny-Cono
|
||||||
MORNY_COMMIT_PATH = https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s
|
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
|
USE_DELTA = false
|
||||||
VERSION_DELTA =
|
VERSION_DELTA =
|
||||||
|
@ -4,7 +4,7 @@ import cc.sukazyo.cono.morny.MornyCoeur
|
|||||||
import cc.sukazyo.cono.morny.bot.api.EventListener
|
import cc.sukazyo.cono.morny.bot.api.EventListener
|
||||||
import cc.sukazyo.cono.morny.util.tgapi.TelegramExtensions.Bot.exec
|
import cc.sukazyo.cono.morny.util.tgapi.TelegramExtensions.Bot.exec
|
||||||
import com.pengrad.telegrambot.model.Update
|
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 com.pengrad.telegrambot.response.SendResponse
|
||||||
|
|
||||||
import scala.language.postfixOps
|
import scala.language.postfixOps
|
||||||
@ -47,13 +47,14 @@ class OnUserRandom (using coeur: MornyCoeur) {
|
|||||||
//noinspection NonAsciiCharacters
|
//noinspection NonAsciiCharacters
|
||||||
object 尊嘟假嘟 extends EventListener {
|
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 = {
|
override def onMessage (using event: Update): Boolean = {
|
||||||
|
|
||||||
if event.message.text == null then return false
|
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
|
import cc.sukazyo.cono.morny.util.UseRandom.rand_half
|
||||||
coeur.account exec SendMessage(
|
coeur.account exec SendMessage(
|
||||||
|
Loading…
Reference in New Issue
Block a user