pyrogram-client 0.0.6__tar.gz → 0.0.7.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyrogram_client-0.0.6/pyrogram_client.egg-info → pyrogram_client-0.0.7.dev2}/PKG-INFO +1 -1
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/client/base.py +2 -1
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/client/bot.py +2 -4
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/client/user.py +6 -7
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/loader.py +8 -0
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2/pyrogram_client.egg-info}/PKG-INFO +1 -1
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/.env.sample +0 -0
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/.gitignore +0 -0
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/.pre-commit-config.yaml +0 -0
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/makefile +0 -0
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyproject.toml +0 -0
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/client/dc.json +0 -0
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/client/file.py +0 -0
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/storage.py +0 -0
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyrogram_client.egg-info/SOURCES.txt +0 -0
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyrogram_client.egg-info/dependency_links.txt +0 -0
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyrogram_client.egg-info/requires.txt +0 -0
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyrogram_client.egg-info/top_level.txt +0 -0
- {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/setup.cfg +0 -0
|
@@ -48,10 +48,11 @@ class BaseClient(Client):
|
|
|
48
48
|
if not self.is_connected:
|
|
49
49
|
await self.preload()
|
|
50
50
|
try:
|
|
51
|
-
await super().start(use_qr=use_qr, except_ids=except_ids or [])
|
|
51
|
+
return await super().start(use_qr=use_qr, except_ids=except_ids or [])
|
|
52
52
|
except (AuthKeyUnregistered, Unauthorized) as e:
|
|
53
53
|
await self.storage.session.delete()
|
|
54
54
|
raise e
|
|
55
|
+
return self
|
|
55
56
|
|
|
56
57
|
async def send(
|
|
57
58
|
self,
|
|
@@ -21,12 +21,10 @@ class BotClient(BaseClient):
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
async def main():
|
|
24
|
-
from x_auth import models
|
|
25
24
|
from x_model import init_db
|
|
25
|
+
from pyro_client.loader import TORM
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
_ = await init_db(PG_DSN, models, True)
|
|
27
|
+
_ = await init_db(TORM, True)
|
|
30
28
|
|
|
31
29
|
bc: BotClient = BotClient(6806432376)
|
|
32
30
|
bc1: BotClient = BotClient(TOKEN)
|
|
@@ -84,7 +84,7 @@ class UserClient(BaseClient):
|
|
|
84
84
|
return v
|
|
85
85
|
return 2
|
|
86
86
|
|
|
87
|
-
async def authorize(self, sent_code: SentCode = None) -> User:
|
|
87
|
+
async def authorize(self, sent_code: SentCode = None) -> User | None:
|
|
88
88
|
sent_code_desc = {
|
|
89
89
|
enums.SentCodeType.APP: "Telegram app",
|
|
90
90
|
enums.SentCodeType.SMS: "SMS",
|
|
@@ -134,8 +134,8 @@ class UserClient(BaseClient):
|
|
|
134
134
|
except BadRequest as e:
|
|
135
135
|
await self.send(e.MESSAGE)
|
|
136
136
|
self.password = None
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
else:
|
|
138
|
+
raise Exception("User does not sent code")
|
|
139
139
|
if isinstance(signed_in, User):
|
|
140
140
|
await self.send("✅")
|
|
141
141
|
await self.storage.save()
|
|
@@ -143,6 +143,7 @@ class UserClient(BaseClient):
|
|
|
143
143
|
|
|
144
144
|
if not signed_in:
|
|
145
145
|
await self.receive("No registered such phone number")
|
|
146
|
+
return None
|
|
146
147
|
|
|
147
148
|
async def session_update(self, dc: int):
|
|
148
149
|
await self.session.stop()
|
|
@@ -164,12 +165,10 @@ class UserClient(BaseClient):
|
|
|
164
165
|
|
|
165
166
|
|
|
166
167
|
async def main():
|
|
167
|
-
from x_auth import models
|
|
168
168
|
from x_model import init_db
|
|
169
|
+
from pyro_client.loader import TORM
|
|
169
170
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
_ = await init_db(PG_DSN, models, True)
|
|
171
|
+
_ = await init_db(TORM, True)
|
|
173
172
|
|
|
174
173
|
logging.basicConfig(level=logging.INFO)
|
|
175
174
|
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
from dotenv import load_dotenv
|
|
2
2
|
from os import getenv as env
|
|
3
3
|
|
|
4
|
+
from x_auth import models
|
|
5
|
+
|
|
4
6
|
load_dotenv()
|
|
5
7
|
|
|
6
8
|
API_ID = env("API_ID")
|
|
7
9
|
API_HASH = env("API_HASH")
|
|
8
10
|
PG_DSN = f"postgres://{env('POSTGRES_USER')}:{env('POSTGRES_PASSWORD')}@{env('POSTGRES_HOST', 'xyncdbs')}:" \
|
|
9
11
|
f"{env('POSTGRES_PORT', 5432)}/{env('POSTGRES_DB', env('POSTGRES_USER'))}"
|
|
12
|
+
TORM = {
|
|
13
|
+
"connections": {"default": PG_DSN},
|
|
14
|
+
"apps": {"models": {"models": [models]}},
|
|
15
|
+
"use_tz": False,
|
|
16
|
+
"timezone": "UTC",
|
|
17
|
+
}
|
|
10
18
|
TOKEN = env("TOKEN")
|
|
11
19
|
WSToken = env("WST")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyrogram_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|