Skip to content

Commit c5965ce

Browse files
committed
🍻 @filter() equals .bind
1 parent e7c1937 commit c5965ce

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

arclet/entari/filter/common.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,11 @@ def to_me(self) -> Self:
194194
self.steps.append(ToMeJudger())
195195
return self
196196

197-
def bind(self, func):
197+
def __call__(self, func):
198198
return _bind(self)(func)
199199

200+
bind = __call__
201+
200202
def and_(self, other: Union["Filter", _SessionFilter]) -> "Filter":
201203
new = Filter()
202204
_other = other if isinstance(other, Filter) else Filter(callback=other)

example_plugin.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async def _(session: Session):
4646
return await session.send("Filter: public message, to me, and content is 'aaa'")
4747

4848

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

0 commit comments

Comments
 (0)