Skip to content

Commit

Permalink
🍻 version 0.10.4
Browse files Browse the repository at this point in the history
simplify self log
  • Loading branch information
RF-Tar-Railt committed Dec 17, 2024
1 parent a93df05 commit b165730
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
3 changes: 1 addition & 2 deletions arclet/entari/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
from satori.client import Account as Account
from satori.client.config import WebhookInfo as WebhookInfo
from satori.client.config import WebsocketsInfo as WebsocketsInfo
from satori.client.protocol import ApiProtocol as ApiProtocol

from . import command as command
from . import scheduler as scheduler
Expand All @@ -64,4 +63,4 @@
WH = WebhookInfo
filter_ = Filter

__version__ = "0.10.3"
__version__ = "0.10.4"
2 changes: 1 addition & 1 deletion arclet/entari/command/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async def __call__(self, context: Contexts):

class Assign(JudgeAuxiliary):
def __init__(self, path: str, value: Any = _seminal, or_not: bool = False):
super().__init__()
super().__init__(priority=60)
self.path = path
self.value = value
self.or_not = or_not
Expand Down
10 changes: 6 additions & 4 deletions arclet/entari/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,16 @@ async def log_msg(event: MessageCreatedEvent):
f"({event.user.id}) -> {event.message.content!r}"
)

if cfg.get("record_send", True):
if cfg.get("record_send", False):

@plg.use(SendResponse)
async def log_send(event: SendResponse):
if event.session:
log.message.info(f"[{event.session.channel.name or event.session.channel.id}] <- {event.message!r}")
log.message.info(
f"[{event.session.channel.name or event.session.channel.id}] <- {event.message.display()!r}"
)
else:
log.message.info(f"[{event.channel}] <- {event.message!r}")
log.message.info(f"[{event.channel}] <- {event.message.display()!r}")


class Entari(App):
Expand Down Expand Up @@ -132,7 +134,7 @@ def __init__(
for plug in EntariConfig.instance.prelude_plugin:
load_plugin(plug, prelude=True)
plugins = [
plug for plug in EntariConfig.instance.plugin if not plug.startswith("~") or not plug.startswith("$")
plug for plug in EntariConfig.instance.plugin if not plug.startswith("~") and not plug.startswith("$")
]
requires(*plugins)
for plug in plugins:
Expand Down
4 changes: 2 additions & 2 deletions arclet/entari/event/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
from ..message import MessageChain

if TYPE_CHECKING:
from ..session import Session
from ..session import SatoriEvent, Session


@dataclass
class SendRequest:
account: Account
channel: str
message: MessageChain
session: Union["Session", None] = None
session: Union["Session[SatoriEvent]", None] = None

async def gather(self, context: Contexts):
context["account"] = self.account
Expand Down
7 changes: 6 additions & 1 deletion arclet/entari/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from typing import TYPE_CHECKING, Any, Callable, TypeVar, Union, overload
from typing_extensions import Self, SupportsIndex, TypeAlias

from satori import Element, Text
from satori import select as satori_select
from satori.element import At, Element, Link, Sharp, Style, Text

T = TypeVar("T")
TE = TypeVar("TE", bound=Element)
Expand Down Expand Up @@ -610,3 +610,8 @@ def rstrip(self, *segments: str | Element | type[Element]) -> Self:
else:
break
return self.__class__(copy)

def display(self):
return "".join(
str(elem) if isinstance(elem, (Text, Style, At, Sharp, Link)) else elem.__class__.__name__ for elem in self
)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "arclet-entari"
version = "0.10.3"
version = "0.10.4"
description = "Simple IM Framework based on satori-python"
authors = [
{name = "RF-Tar-Railt",email = "[email protected]"},
Expand Down

0 comments on commit b165730

Please sign in to comment.