aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2024-06-29 16:23:44 +0800
committer简律纯 <i@jyunko.cn>2024-06-29 16:23:44 +0800
commit23ab264ebe52bd050e02c5c6a009645a252a5ea0 (patch)
tree784ac7064edc68ddebdf2fafec5698ef3a45130e
parent6dfe2f4a87362a27fe2e97a154daac2f11883284 (diff)
downloadHydroRollCore-23ab264ebe52bd050e02c5c6a009645a252a5ea0.tar.gz
HydroRollCore-23ab264ebe52bd050e02c5c6a009645a252a5ea0.zip
refactor(rule): change self.state with self.core.rule_state logic
-rw-r--r--hrc/rule/__init__.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/hrc/rule/__init__.py b/hrc/rule/__init__.py
index f04dbba..a41c81d 100644
--- a/hrc/rule/__init__.py
+++ b/hrc/rule/__init__.py
@@ -105,7 +105,7 @@ class Rule(ABC, Generic[EventT, StateT, ConfigT]):
@property
def core(self) -> "Core":
"""core object."""
- return self.event.bot # pylint: disable=no-member
+ return self.event.core # pylint: disable=no-member
@final
@property
@@ -133,19 +133,19 @@ class Rule(ABC, Generic[EventT, StateT, ConfigT]):
@property
def state(self) -> StateT:
- """plugin status."""
- return self.bot.plugin_state[self.name]
+ """rule status."""
+ return self.core.rule_state[self.name]
@state.setter
@final
def state(self, value: StateT) -> None:
- self.bot.plugin_state[self.name] = value
+ self.core.rule_state[self.name] = value
@abstractmethod
async def handle(self) -> None:
"""Method to handle events. iamai will call this method when the ``rule()`` method returns ``True``. Each plugin must implement this method."""
raise NotImplementedError
-
+
@abstractmethod
async def rule(self) -> bool:
"""Method to match the event. When the event is processed, this method will be called in sequence according to the priority of the plugin. When this method returns ``True``, the event will be handed over to this plugin for processing. Each plugin must implement this method.