add ChatType to exported filters; rename sender -> chat in ChatType.__call__

This commit is contained in:
apepenkov 2023-11-08 12:31:05 +03:00
parent ae44426a78
commit 3f39201d27
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
from .combinators import All, Any, Filter, Not from .combinators import All, Any, Filter, Not
from .common import Chats, Senders from .common import Chats, Senders, ChatType
from .messages import Command, Forward, Incoming, Media, Outgoing, Reply, Text, TextOnly from .messages import Command, Forward, Incoming, Media, Outgoing, Reply, Text, TextOnly
__all__ = [ __all__ = [
@ -9,6 +9,7 @@ __all__ = [
"Not", "Not",
"Chats", "Chats",
"Senders", "Senders",
"ChatType",
"Command", "Command",
"Forward", "Forward",
"Incoming", "Incoming",

View File

@ -88,5 +88,5 @@ class ChatType(Combinable):
raise RuntimeError("unexpected case") raise RuntimeError("unexpected case")
def __call__(self, event: Event) -> bool: def __call__(self, event: Event) -> bool:
sender = getattr(event, "chat", None) chat = getattr(event, "chat", None)
return isinstance(sender, self._type) return isinstance(chat, self._type)