Use get_message_id instead

This commit is contained in:
painor 2019-11-03 21:21:40 +01:00 committed by GitHub
parent 1c7947c03a
commit 75142e2fdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1210,13 +1210,7 @@ class MessageMethods:
message = await client.send_message(chat, 'Pinotifying is fun!')
await client.pin_message(chat, message, notify=True)
"""
if not message:
message = 0
elif hasattr(message, 'id'):
message = message.id
elif not isinstance(message, int):
raise ValueError('Incorrect message argument')
message = utils.get_message_id(message) or 0
entity = await self.get_input_entity(entity)
await self(functions.messages.UpdatePinnedMessageRequest(
peer=entity,