mirror of
https://git.stupid.fish/teidesu/scripts.git
synced 2025-07-27 18:22:10 +10:00
20 lines
470 B
TypeScript
20 lines
470 B
TypeScript
import qrTerminal from 'qrcode-terminal'
|
|
import { createTg } from '../../utils/telegram.ts'
|
|
|
|
const sessionName = process.argv[2]
|
|
if (!sessionName) {
|
|
console.error('Usage: mtcute-login.ts <session name>')
|
|
process.exit(1)
|
|
}
|
|
|
|
const tg = createTg(sessionName)
|
|
|
|
const self = await tg.start({
|
|
qrCodeHandler(url, expires) {
|
|
console.log(qrTerminal.generate(url, { small: true }))
|
|
},
|
|
})
|
|
|
|
console.log(`Logged in as ${self.displayName} (${self.id})`)
|
|
|
|
await tg.close()
|