Commit 0b7bd9f 1 parent fc27f9a commit 0b7bd9f Copy full SHA for 0b7bd9f
File tree 3 files changed +14
-5
lines changed
3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -37,4 +37,4 @@ async def get_active_sessions(
37
37
r = await self .invoke (
38
38
raw .functions .account .GetAuthorizations ()
39
39
)
40
- return types .ActiveSessions ._parse (r )
40
+ return types .ActiveSessions ._parse (self , r )
Original file line number Diff line number Diff line change 18
18
19
19
from datetime import datetime
20
20
21
+ import pyrogram
21
22
from pyrogram import raw , utils
22
23
23
24
from ..object import Object
@@ -86,6 +87,7 @@ class ActiveSession(Object):
86
87
def __init__ (
87
88
self ,
88
89
* ,
90
+ client : "pyrogram.Client" = None ,
89
91
id : int = None ,
90
92
device_model : str = None ,
91
93
platform : str = None ,
@@ -105,7 +107,7 @@ def __init__(
105
107
can_accept_calls : bool = None ,
106
108
is_official_application : bool = None
107
109
):
108
- super ().__init__ ()
110
+ super ().__init__ (client )
109
111
110
112
self .id = id
111
113
self .device_model = device_model
@@ -127,8 +129,12 @@ def __init__(
127
129
self .is_official_application = is_official_application
128
130
129
131
@staticmethod
130
- def _parse (session : "raw.types.Authorization" ) -> "ActiveSession" :
132
+ def _parse (
133
+ client : "pyrogram.Client" ,
134
+ session : "raw.types.Authorization"
135
+ ) -> "ActiveSession" :
131
136
return ActiveSession (
137
+ client = client ,
132
138
id = session .hash ,
133
139
device_model = session .device_model ,
134
140
platform = session .platform ,
Original file line number Diff line number Diff line change @@ -48,11 +48,14 @@ def __init__(
48
48
self .active_sessions = active_sessions
49
49
50
50
@staticmethod
51
- def _parse (authorizations : "raw.types.account.Authorizations" ) -> "ActiveSessions" :
51
+ def _parse (
52
+ client : "pyrogram.Client" ,
53
+ authorizations : "raw.types.account.Authorizations"
54
+ ) -> "ActiveSessions" :
52
55
return ActiveSessions (
53
56
inactive_session_ttl_days = authorizations .authorization_ttl_days ,
54
57
active_sessions = types .List ([
55
- types .ActiveSession ._parse (active )
58
+ types .ActiveSession ._parse (client , active )
56
59
for active in authorizations .authorizations
57
60
])
58
61
)
You can’t perform that action at this time.
0 commit comments