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