Skip to content

Commit

Permalink
Merge pull request #43 from Olegt0rr/patch-11
Browse files Browse the repository at this point in the history
Update Chat method and get_link method fix
  • Loading branch information
JrooTJunior committed May 24, 2018
2 parents 232fc23 + 09f540c commit 5beaf86
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion aiogram/types/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,25 @@ async def get_url(self):
if self.type == ChatType.PRIVATE:
return f"tg://user?id={self.id}"

return f'https://t.me/{self.username}' if self.username else await self.export_invite_link()
if self.username:
return f'https://t.me/{self.username}'

if self.invite_link:
return self.invite_link

await self.update_chat()
return self.invite_link

async def update_chat(self):
"""
User this method to update Chat data
:return: None
"""
other = await self.bot.get_chat(self.id)

for key, value in other:
self[key] = value

async def set_photo(self, photo):
"""
Expand Down

0 comments on commit 5beaf86

Please sign in to comment.