mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 18:01:04 +00:00
Make some types hashable.
This commit is contained in:
parent
afd76cce9f
commit
44a24b243c
17 changed files with 151 additions and 1 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import typing
|
||||
|
||||
from aiogram.utils import helper
|
||||
from aiogram.utils.exceptions import TelegramAPIError
|
||||
from . import base
|
||||
from . import fields
|
||||
from .audio import Audio
|
||||
|
|
@ -202,6 +201,17 @@ class Message(base.TelegramObject):
|
|||
async def pin(self, disable_notification: bool = False):
|
||||
return await self.chat.pin_message(self.message_id, disable_notification)
|
||||
|
||||
def __hash__(self):
|
||||
return self.message_id
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, type(self)):
|
||||
return other.message_id == self.message_id
|
||||
return self.message_id == other
|
||||
|
||||
def __int__(self):
|
||||
return self.message_id
|
||||
|
||||
|
||||
class ContentType(helper.Helper):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue