Skip to content

Commit

Permalink
🍻 @filter() equals .bind
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Jan 9, 2025
1 parent e7c1937 commit c5965ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion arclet/entari/filter/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ def to_me(self) -> Self:
self.steps.append(ToMeJudger())
return self

def bind(self, func):
def __call__(self, func):
return _bind(self)(func)

bind = __call__

def and_(self, other: Union["Filter", _SessionFilter]) -> "Filter":
new = Filter()
_other = other if isinstance(other, Filter) else Filter(callback=other)
Expand Down
2 changes: 1 addition & 1 deletion example_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def _(session: Session):
return await session.send("Filter: public message, to me, and content is 'aaa'")


@disp_message.on(auxiliaries=[Filter().public().to_me().not_(lambda sess: str(sess.content) == "aaa")])
@Filter().public().to_me().not_(lambda sess: str(sess.content) == "aaa")
async def _(session: Session):
return await session.send("Filter: public message, to me, but content is not 'aaa'")

Expand Down

0 comments on commit c5965ce

Please sign in to comment.