mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2025-04-29 09:32:04 +08:00
fix ExpiredEvent tagged wrongly
This commit is contained in:
parent
666607b430
commit
e4853239bd
@ -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.5.0-alpha.3
|
VERSION = 1.5.0-alpha.4
|
||||||
|
|
||||||
USE_DELTA = false
|
USE_DELTA = false
|
||||||
VERSION_DELTA =
|
VERSION_DELTA =
|
||||||
|
@ -51,8 +51,6 @@ class EventEnv (
|
|||||||
case None => ConsumeResult(false)
|
case None => ConsumeResult(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// fixme: defined() series is not tested yet
|
|
||||||
|
|
||||||
def defined [T: ClassTag]: Boolean = {
|
def defined [T: ClassTag]: Boolean = {
|
||||||
variables get classTag[T].runtimeClass match
|
variables get classTag[T].runtimeClass match
|
||||||
case Some(_) => true
|
case Some(_) => true
|
||||||
|
@ -7,9 +7,10 @@ import cc.sukazyo.cono.morny.bot.event.MornyOnUpdateTimestampOffsetLock.ExpiredE
|
|||||||
class MornyOnUpdateTimestampOffsetLock (using coeur: MornyCoeur) extends EventListener {
|
class MornyOnUpdateTimestampOffsetLock (using coeur: MornyCoeur) extends EventListener {
|
||||||
|
|
||||||
private def checkOutdated (timestamp: Int)(using event: EventEnv): Unit =
|
private def checkOutdated (timestamp: Int)(using event: EventEnv): Unit =
|
||||||
event.provide(ExpiredEvent)
|
if timestamp < (coeur.coeurStartTimestamp/1000) then
|
||||||
if coeur.config.eventIgnoreOutdated && (timestamp < (coeur.coeurStartTimestamp/1000)) then
|
event.provide(ExpiredEvent)
|
||||||
event.setEventCanceled
|
if coeur.config.eventIgnoreOutdated then
|
||||||
|
event.setEventCanceled
|
||||||
|
|
||||||
override def onMessage (using event: EventEnv): Unit = checkOutdated(event.update.message.date)
|
override def onMessage (using event: EventEnv): Unit = checkOutdated(event.update.message.date)
|
||||||
override def onEditedMessage (using event: EventEnv): Unit = checkOutdated(event.update.editedMessage.date)
|
override def onEditedMessage (using event: EventEnv): Unit = checkOutdated(event.update.editedMessage.date)
|
||||||
|
@ -15,7 +15,6 @@ class OnQuestionMarkReply (using coeur: MornyCoeur) extends EventListener {
|
|||||||
override def onMessage (using event: EventEnv): Unit = {
|
override def onMessage (using event: EventEnv): Unit = {
|
||||||
import event.update
|
import event.update
|
||||||
|
|
||||||
// FIXME: not tested yet, due to cannot connect to test bot
|
|
||||||
if event.defined[MornyOnUpdateTimestampOffsetLock.ExpiredEvent.type] then {
|
if event.defined[MornyOnUpdateTimestampOffsetLock.ExpiredEvent.type] then {
|
||||||
logger.debug("OnQuestionMarkReply: expired event, skipped")
|
logger.debug("OnQuestionMarkReply: expired event, skipped")
|
||||||
return
|
return
|
||||||
|
@ -29,7 +29,6 @@ class OnUserRandom (using coeur: MornyCoeur) {
|
|||||||
if rand_half then _con1 else _con2
|
if rand_half then _con1 else _con2
|
||||||
case USER_IF_QUERY(_con) =>
|
case USER_IF_QUERY(_con) =>
|
||||||
// for capability with [[OnQuestionMarkReply]]
|
// for capability with [[OnQuestionMarkReply]]
|
||||||
// fixme: not tested yet
|
|
||||||
if event.defined[OnQuestionMarkReply.Marked.type] then return;
|
if event.defined[OnQuestionMarkReply.Marked.type] then return;
|
||||||
(if rand_half then "不" else "") + _con
|
(if rand_half then "不" else "") + _con
|
||||||
case _ => null
|
case _ => null
|
||||||
|
Loading…
Reference in New Issue
Block a user