Skip to content

Commit 4d74dd1

Browse files
committed
⬆️ use letoderea 0.21.0rc2
1 parent 5b81898 commit 4d74dd1

9 files changed

Lines changed: 1059 additions & 924 deletions

File tree

arclet/entari/command/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
from arclet.alconna import Alconna, Arg, Args, Arparma, CommandMeta, command_manager
1010
from arclet.alconna.tools.construct import AlconnaString, alconna_from_format
1111
from arclet.alconna.typing import TAValue
12-
from arclet.letoderea import EVENT, RESULT, ExitState, Scope, Subscriber, make_event
12+
from arclet.letoderea import Contexts, EVENT, RESULT, ExitState, Scope, Subscriber, make_event
1313
from arclet.letoderea.provider import TProviders, get_providers
14-
from arclet.letoderea.typing import Contexts, Result
14+
from arclet.letoderea.typing import Result
1515
from nepattern import DirectPattern
1616
from tarina import LRU
1717
from tarina.trie import CharTrie

arclet/entari/command/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from .provider import AlconnaProviderFactory, AlconnaSuppiler, Assign, MessageJudges, _seminal
1616

1717
exec_pub = define(CommandExecute)
18-
exec_pub.bind(AlconnaProviderFactory())
18+
exec_pub.providers.append(AlconnaProviderFactory())
1919
out_pub = define(CommandOutput)
2020
# fmt: off
2121

arclet/entari/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import TYPE_CHECKING
44

5-
from arclet.letoderea.typing import CtxItem
5+
from arclet.letoderea.context import CtxItem
66

77
if TYPE_CHECKING:
88
import satori

arclet/entari/core.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from arclet.alconna import Alconna
1313
from arclet.alconna import config as alconna_config
1414
from arclet.letoderea import EVENT, Contexts, Param, Provider, ProviderFactory, global_providers
15+
from arclet.letoderea.context import shared_suppliers
1516
from arclet.letoderea.scope import configure
1617
from creart import it
1718
from graia.amnesia.builtins.aiohttp import AiohttpClientService
@@ -77,16 +78,6 @@ async def __call__(self, context: Contexts):
7778
if self.target_type and not generic_isinstance(sess.event, self.target_type):
7879
return
7980
return sess
80-
if ITEM_ORIGIN_EVENT in context and ITEM_ACCOUNT in context:
81-
if self.target_type and not generic_isinstance(context[EVENT], self.target_type):
82-
return
83-
session = Session(context[ITEM_ACCOUNT], context[EVENT])
84-
if ITEM_MESSAGE_CONTENT in context:
85-
session.elements = context[ITEM_MESSAGE_CONTENT]
86-
if ITEM_MESSAGE_REPLY in context:
87-
session.reply = context[ITEM_MESSAGE_REPLY]
88-
context[ITEM_SESSION] = session
89-
return session
9081

9182
def validate(self, param: Param):
9283
if get_origin(param.annotation) is Session:
@@ -222,6 +213,17 @@ async def __call__(self, context: Contexts):
222213
)
223214

224215

216+
@shared_suppliers.append
217+
async def session_supplier(context: Contexts):
218+
if ITEM_ORIGIN_EVENT in context and ITEM_ACCOUNT in context:
219+
session = Session(context[ITEM_ACCOUNT], context[EVENT])
220+
if ITEM_MESSAGE_CONTENT in context:
221+
session.elements = context[ITEM_MESSAGE_CONTENT]
222+
if ITEM_MESSAGE_REPLY in context:
223+
session.reply = context[ITEM_MESSAGE_REPLY]
224+
context[ITEM_SESSION] = session
225+
226+
225227
class RecordConfig(BasicConfModel):
226228
to_me_only: bool = False
227229
"""是否仅记录提及 Bot 自己的消息"""

arclet/entari/event/send.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class SendResponse:
5555

5656

5757
send_pub = define(SendResponse, name="entari.event/after_send")
58-
send_pub.bind(provide(list[MessageObject], call="$resp_result"))
58+
send_pub.providers.append(provide(list[MessageObject], call="$resp_result"))
5959

6060

6161
@send_pub.gather

arclet/entari/plugin/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def get_plugin_subscribers(plug: Plugin | str | None = None) -> list[Subscriber]
9999
plg = plugin_service.plugins[plug]
100100
else:
101101
plg = get_plugin(1)
102-
return [s[0] for s in plg._scope.subscribers.values()]
102+
return [s.subscriber for s in plg._scope.subscribers]
103103

104104

105105
def get_all_subscribers():

arclet/entari/scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typing import Literal
77

88
from arclet.letoderea import Scope, Subscriber, make_event
9-
from arclet.letoderea.typing import Contexts
9+
from arclet.letoderea.context import Contexts
1010
from launart import Launart, Service, any_completed
1111
from launart.status import Phase
1212

pdm.lock

Lines changed: 1032 additions & 898 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ authors = [
66
{name = "RF-Tar-Railt",email = "rf_tar_railt@qq.com"},
77
]
88
dependencies = [
9-
"arclet-letoderea<0.21.0,>=0.20.7",
10-
"arclet-alconna<2.0.0,>=1.8.42",
11-
"satori-python-core<1.4.0,>=1.3.0",
12-
"satori-python-client<1.4.0,>=1.3.0",
9+
"arclet-letoderea<0.22.0,>=0.21.0rc2",
10+
"arclet-alconna<2.0.0,>=1.8.44",
11+
"satori-python-core<1.4.0,>=1.3.2",
12+
"satori-python-client<1.4.0,>=1.3.2",
1313
"arclet-alconna-tools>=0.7.3",
1414
"nonestorage>=0.1.0",
1515
"simpleeval>=1.0.3",
@@ -117,14 +117,13 @@ format = { composite = ["ruff check --select I --fix ./arclet/","black ./arclet/
117117

118118
[dependency-groups]
119119
dev = [
120-
"black>=24.4.2",
121-
"ruff>=0.15.4",
122-
"fix-future-annotations>=0.5.0",
120+
"black>=26.3.1",
121+
"ruff>=0.15.10",
123122
"watchfiles>=0.24.0",
124123
"python-dotenv>=1.0.1",
125124
"ruamel-yaml>=0.18.10",
126-
"msgspec>=0.19.0",
127-
"pydantic>=2.10.6",
125+
"msgspec>=0.21.0",
126+
"pydantic>=2.12.5",
128127
"tomlkit>=0.13.3",
129128
"richuru>=0.1.1",
130129
]

0 commit comments

Comments
 (0)