Skip to content

Commit

Permalink
⬆️ update satori-python
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Oct 28, 2024
1 parent bddc086 commit 650932a
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 109 deletions.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions arclet/entari/command/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def listener(event: MessageCreatedEvent):
await asyncio.gather(*(depend_handler(res.value, event, inner=True) for res in matches if res.value))
return
# shortcut
data = split(msg, (" ",))
data = split(msg, " ")
for value in self.trie.values():
try:
command_manager.find_shortcut(get_cmd(value), data)
Expand All @@ -72,7 +72,7 @@ async def _run(target: Subscriber, content: MessageChain):
try:
_res = aux.cmd.parse(content)
except Exception as e:
_res = Arparma(aux.cmd.path, message, False, error_info=e)
_res = Arparma(aux.cmd._hash, message, False, error_info=e)
may_help_text: Optional[str] = cap.get("output", None)
if _res.matched:
args = {}
Expand All @@ -87,7 +87,7 @@ async def _run(target: Subscriber, content: MessageChain):
if matches := list(self.trie.prefixes(msg)):
return await asyncio.gather(*(_run(res.value, message) for res in matches if res.value))
# shortcut
data = split(msg, (" ",))
data = split(msg, " ")
res = []
for value in self.trie.values():
try:
Expand Down
2 changes: 1 addition & 1 deletion arclet/entari/plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def load_plugin(path: str, config: dict | None = None, recursive_guard: set[str]
"""
if recursive_guard is None:
recursive_guard = set()
path = path.replace("::", "arclet.entari.plugins.")
path = path.replace("::", "arclet.entari.builtins.")
while path in plugin_service._subplugined:
path = plugin_service._subplugined[path]
if path in plugin_service.plugins:
Expand Down
10 changes: 5 additions & 5 deletions arclet/entari/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from satori.client.account import Account
from satori.client.protocol import ApiProtocol
from satori.element import Element
from satori.model import Channel, Guild, Member, MessageObject, PageResult, Role, User
from satori.model import Channel, Guild, Member, MessageObject, MessageReceipt, PageResult, Role, User

from .event import Event, FriendRequestEvent, GuildMemberRequestEvent, GuildRequestEvent, MessageEvent
from .message import MessageChain
Expand Down Expand Up @@ -113,15 +113,15 @@ async def send(
self,
message: str | Iterable[str | Element],
protocol_cls: type[ApiProtocol] | None = None,
) -> list[MessageObject]:
) -> list[MessageReceipt]:
if not protocol_cls:
return await self.account.protocol.send(self.context, message)
return await self.account.custom(self.account.config, protocol_cls).send(self.context._origin, message)

async def send_message(
self,
message: str | Iterable[str | Element],
) -> list[MessageObject]:
) -> list[MessageReceipt]:
"""发送消息
Args:
Expand All @@ -134,7 +134,7 @@ async def send_message(
async def send_private_message(
self,
message: str | Iterable[str | Element],
) -> list[MessageObject]:
) -> list[MessageReceipt]:
"""发送私聊消息
Args:
Expand Down Expand Up @@ -162,7 +162,7 @@ async def update_message(
async def message_create(
self,
content: str,
) -> list[MessageObject]:
) -> list[MessageReceipt]:
if not self.context.channel:
raise RuntimeError("Event cannot be replied to!")
return await self.account.protocol.message_create(self.context.channel.id, content)
Expand Down
Loading

0 comments on commit 650932a

Please sign in to comment.