mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-17 10:36:37 +00:00
Fix loading of SqliteSession
This commit is contained in:
parent
03a85dfd1a
commit
f2b8a91fa9
@ -113,7 +113,9 @@ class SqliteSession(Storage):
|
|||||||
date=state[2],
|
date=state[2],
|
||||||
seq=state[3],
|
seq=state[3],
|
||||||
channels=[ChannelState(id=id, pts=pts) for id, pts in channelstate],
|
channels=[ChannelState(id=id, pts=pts) for id, pts in channelstate],
|
||||||
),
|
)
|
||||||
|
if state
|
||||||
|
else None,
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -163,13 +165,14 @@ class SqliteSession(Storage):
|
|||||||
)
|
)
|
||||||
if c.fetchone():
|
if c.fetchone():
|
||||||
c.execute("select version from version")
|
c.execute("select version from version")
|
||||||
res = c.fetchone()[0]
|
tup = c.fetchone()
|
||||||
assert isinstance(res, int)
|
if tup and isinstance(tup[0], int):
|
||||||
return res
|
return tup[0]
|
||||||
else:
|
SqliteSession._reset(c)
|
||||||
SqliteSession._create_tables(c)
|
|
||||||
c.execute("insert into version values (?)", (CURRENT_VERSION,))
|
SqliteSession._create_tables(c)
|
||||||
return CURRENT_VERSION
|
c.execute("insert into version values (?)", (CURRENT_VERSION,))
|
||||||
|
return CURRENT_VERSION
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _create_tables(c: sqlite3.Cursor) -> None:
|
def _create_tables(c: sqlite3.Cursor) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user