Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
420 changes: 420 additions & 0 deletions .github/workflows/pr-summary.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "accxus"
version = "0.1.0"
version = "0.3.0"
description = "accxus is a program where you can create, manage, and modify accounts on various social networks. It uses SMS activation services for registration."
readme = "README.md"
requires-python = ">=3.10"
Expand Down
2 changes: 1 addition & 1 deletion src/accxus/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.0"
__version__ = "0.3.0"
12 changes: 11 additions & 1 deletion src/accxus/platforms/telegram/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pyrogram import Client # type: ignore[import-untyped]

import accxus.config as cfg
from accxus.platforms.telegram import sessions as tg_sessions
from accxus.types.core import ProxyConfig
from accxus.types.telegram import SessionInfo, SessionStatus
from accxus.utils.session_convert import detect_kind
Expand All @@ -27,6 +28,10 @@ def make_client(
) -> Client:
from pyrogram import Client as _Client # type: ignore[import-untyped]

dc_id = tg_sessions.hydrate_session_dc_metadata(session_name)
if dc_id is not None:
log.debug("[tg] session %s uses dc_id=%s", session_name, dc_id)

_proxy = proxy or cfg.config.telegram_proxy
return _Client( # type: ignore[reportCallIssue]
name=session_name,
Expand Down Expand Up @@ -68,6 +73,7 @@ async def fetch_info(
) -> SessionInfo:
async with connected(session_name, proxy=proxy) as client:
me = await client.get_me()
dc_id = await client.storage.dc_id()
try:
chat = await client.get_chat(me.id)
bio: str = getattr(chat, "bio", "") or ""
Expand All @@ -82,6 +88,7 @@ async def fetch_info(
last_name=me.last_name or "",
username=me.username or "",
bio=bio,
dc_id=dc_id,
kind=kind,
status=SessionStatus.VALID,
)
Expand All @@ -100,7 +107,10 @@ async def check_validity(
try:
async with connected(session_name, proxy=proxy) as client:
me = await client.get_me()
return SessionStatus.VALID if me else SessionStatus.INVALID
if me:
tg_sessions.update_metadata_dc_id(session_name, await client.storage.dc_id())
return SessionStatus.VALID
return SessionStatus.INVALID
except (AuthKeyUnregistered, UserDeactivated, UserDeactivatedBan):
return SessionStatus.INVALID
except Exception:
Expand Down
Loading
Loading