mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 05:18:10 +00:00
Allow non-interactive migration from storage v2 to v3 (#979)
This commit is contained in:
parent
bbe90fc6d3
commit
795ffc027a
@ -592,21 +592,24 @@ class Client(Methods):
|
|||||||
else:
|
else:
|
||||||
# Needed for migration from storage v2 to v3
|
# Needed for migration from storage v2 to v3
|
||||||
if not await self.storage.api_id():
|
if not await self.storage.api_id():
|
||||||
while True:
|
if self.api_id:
|
||||||
try:
|
await self.storage.api_id(self.api_id)
|
||||||
value = int(await ainput("Enter the api_id part of the API key: "))
|
else:
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
value = int(await ainput("Enter the api_id part of the API key: "))
|
||||||
|
|
||||||
if value <= 0:
|
if value <= 0:
|
||||||
print("Invalid value")
|
print("Invalid value")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
confirm = (await ainput(f'Is "{value}" correct? (y/N): ')).lower()
|
confirm = (await ainput(f'Is "{value}" correct? (y/N): ')).lower()
|
||||||
|
|
||||||
if confirm == "y":
|
if confirm == "y":
|
||||||
await self.storage.api_id(value)
|
await self.storage.api_id(value)
|
||||||
break
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
def load_plugins(self):
|
def load_plugins(self):
|
||||||
if self.plugins:
|
if self.plugins:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user