mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-18 12:30:59 +03:00
Implement __bytes__ and use count instead sum
This commit is contained in:
parent
2191fbf30b
commit
9db9d1ed5c
|
@ -50,6 +50,9 @@ class Message:
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return repr(self.original_message)
|
return repr(self.original_message)
|
||||||
|
|
||||||
|
def __bytes__(self):
|
||||||
|
return bytes(self.original_message)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def client(self):
|
def client(self):
|
||||||
return self._client
|
return self._client
|
||||||
|
@ -296,7 +299,7 @@ class Message:
|
||||||
returns ``True``. The callable should accept a single
|
returns ``True``. The callable should accept a single
|
||||||
`telethon.tl.custom.messagebutton.MessageButton` argument.
|
`telethon.tl.custom.messagebutton.MessageButton` argument.
|
||||||
"""
|
"""
|
||||||
if sum(int(x is not None) for x in (i, text, filter)) >= 2:
|
if (i, text, filter).count(None) >= 2:
|
||||||
raise ValueError('You can only set either of i, text or filter')
|
raise ValueError('You can only set either of i, text or filter')
|
||||||
|
|
||||||
if not self.buttons:
|
if not self.buttons:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user