Skip to content

Instantly share code, notes, and snippets.

@Bestulo
Created December 10, 2017 07:27
Show Gist options
  • Save Bestulo/33a43f8e8884919a1ccd95bfc3dd8bd8 to your computer and use it in GitHub Desktop.
Save Bestulo/33a43f8e8884919a1ccd95bfc3dd8bd8 to your computer and use it in GitHub Desktop.
Failed login attempt to zerobias/telegram-mtproto
const {MTProto} = require('telegram-mtproto')
const fs = require('fs-extra')
const vars = JSON.parse(fs.readFileSync('secrets'))
const {phone, api_id, hash} = vars.userbot
const prompt = require('prompt-promise')
const api = {
layer: 57,
api_id: api_id
}
const log = value => (console.log(value), value)
const server = { dev: true }
const client = MTProto({ server, api })
const login = () =>
client('auth.sendCode', {
phone_number: phone,
current_number: false,
api_id: api_id,
api_hash: hash
}).then(phone_code_hash =>
prompt('code: ').then(code =>
client('auth.signIn', {
phone_number: phone,
phone_code_hash,
phone_code: code
})).then(user =>
log('signed in as ', user)))
login()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment