mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-06-13 12:41:16 +00:00
feat: detect and persist Telegram Premium status after authentication
After TDLib login completes, calls getMe() to detect isPremium, persists
it to DB via updateAccountPremiumStatus, and returns { client, isPremium }
from createTdlibClient. All callers updated to destructure accordingly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -73,10 +73,10 @@ export async function authenticateAccount(
|
||||
|
||||
let client: Client | undefined;
|
||||
try {
|
||||
client = await createTdlibClient({
|
||||
client = (await createTdlibClient({
|
||||
id: account.id,
|
||||
phone: account.phone,
|
||||
});
|
||||
})).client;
|
||||
aLog.info("Authentication successful");
|
||||
|
||||
// Auto-fetch channels and create a fetch request result
|
||||
@@ -131,7 +131,7 @@ export async function processFetchRequest(requestId: string): Promise<void> {
|
||||
await updateFetchRequestStatus(requestId, "IN_PROGRESS");
|
||||
aLog.info({ accountId: request.accountId }, "Processing fetch request");
|
||||
|
||||
const client = await createTdlibClient({
|
||||
const { client } = await createTdlibClient({
|
||||
id: request.account.id,
|
||||
phone: request.account.phone,
|
||||
});
|
||||
@@ -336,10 +336,11 @@ export async function runWorkerForAccount(
|
||||
currentStep: "connecting",
|
||||
});
|
||||
|
||||
const client = await createTdlibClient({
|
||||
const { client, isPremium } = await createTdlibClient({
|
||||
id: account.id,
|
||||
phone: account.phone,
|
||||
});
|
||||
void isPremium; // will be used in Task 6 for upload limits
|
||||
|
||||
// Load all chats into TDLib's local cache using loadChats (the recommended API).
|
||||
// Without this, getChat/searchChatMessages fail with "Chat not found".
|
||||
|
||||
Reference in New Issue
Block a user