Skip to content

Commit

Permalink
🍻 shortcut filter_
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Jan 10, 2025
1 parent 2a8e7aa commit d6c74ba
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 104 deletions.
2 changes: 1 addition & 1 deletion arclet/entari/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from .event import MessageCreatedEvent as MessageCreatedEvent
from .event import MessageEvent as MessageEvent
from .filter import Filter as Filter
from .filter import filter_ as filter_
from .message import MessageChain as MessageChain
from .plugin import Plugin as Plugin
from .plugin import PluginMetadata as PluginMetadata
Expand All @@ -65,6 +66,5 @@

WS = WebsocketsInfo
WH = WebhookInfo
filter_ = Filter

__version__ = "0.11.1"
2 changes: 1 addition & 1 deletion arclet/entari/builtins/inspect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

@command.on(inspect_cmd)
async def inspect(session: Session[MessageEvent], target: Match["At | Sharp"]):
event = session.context
event = session.event
texts = [
Lang.entari_plugin_inspect.platform(platform=session.account.platform),
Lang.entari_plugin_inspect.self(self_id=session.account.self_id),
Expand Down
10 changes: 9 additions & 1 deletion arclet/entari/filter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncio
from datetime import datetime
from typing import Optional, Union
from typing import Optional, Union, cast

from arclet.letoderea import BaseAuxiliary, Interface

Expand Down Expand Up @@ -57,3 +57,11 @@ async def on_prepare(self, interface: Interface) -> Optional[bool]:
async def on_cleanup(self, interface: Interface) -> Optional[bool]:
self.semaphore.release()
return True


class _Wrapper:
def __getattr__(self, item):
return getattr(Filter(), item)


filter_ = cast(Filter, _Wrapper())
7 changes: 7 additions & 0 deletions arclet/entari/filter/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,10 @@ def id(self) -> str:
@property
def before(self) -> set[str]:
return {"entari.filter/judge_reply_me", "entari.filter/judge_notice_me"}


public_message = PublicMessageJudger()
direct_message = DirectMessageJudger()
reply_me = ReplyMeJudger()
notice_me = NoticeMeJudger()
to_me = ToMeJudger()
Loading

0 comments on commit d6c74ba

Please sign in to comment.