Skip to content

Commit

Permalink
feat: ass generate telegram session
Browse files Browse the repository at this point in the history
  • Loading branch information
zdm committed Nov 5, 2024
1 parent 748993d commit d48bbe6
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/commands/generate/telegram-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,24 @@ export default class extends Command {

if ( !res.ok ) return res;

console.log( res.data );
const client = new TelegramClient( {
"apiId": process.cli.arguments[ "api-id" ],
"apiHash": process.cli.arguments[ "api-hash" ],
"session": res.data,
} );

await client.connect();

const me = await client.getMe();

console.log( `
User ID: ${ me.id }
Username: ${ me.username }
Is bot: ${ me.bot }
Session:
${ res.data }
` );

if ( process.cli.options.copy && process.platform === "win32" ) {
childProcess.spawnSync( "clip", {
Expand Down

0 comments on commit d48bbe6

Please sign in to comment.