gramjs
gramjs copied to clipboard
Multiple session qr
I found a bug, so I used qrcode login and used multiple sessions, when session 1 was successfully scanned and session 2 had not been scanned, if the sessions are run sequentially there is no problem, but if session 2 I run it first than session 1 then session 1 asks for a re-scan
This is very complicated, can you provide some code to go with it?
This is very complicated, can you provide some code to go with it?
this is my code. I run in order
tele()
tele2()
then I scanned for tele() and connected successfully. and for tele2() I didn't scan it, then I stopped node js and changed it
tele2()
tele()
but what happens tele2() and tele() ask for both scans. tele() shouldn't need to scan because it's already scanned. I hope you understand what I mean sir, thank you
const tele = async () => {
const client = new TelegramClient(new StoreSession("tele"), apiId, apiHash, {});
await client.connect();
if (!await client.isUserAuthorized()){
await client.signInUserWithQrCode({ apiId, apiHash },
{
onError: async function(p1) {
console.log("error", p1);
// true = stop the authentication processes
return true;
},
qrCode: async (code) => {
console.log("Convert the next string to a QR code and scan it");
console.log(
`tg://login?token=${code.token.toString("base64url")}`
);
},
password: async (hint) => {
// password if needed
return "1111";
}
}
);
}
console.log("You should now be connected.");
console.log(client.session.save());
await client.sendMessage("me", { message: "Hello!" });
}
const tele2 = async () => {
const client = new TelegramClient(new StoreSession("tele2"), apiId, apiHash, {});
await client.connect();
if (!await client.isUserAuthorized()){
await client.signInUserWithQrCode({ apiId, apiHash },
{
onError: async function(p1) {
console.log("error", p1);
// true = stop the authentication processes
return true;
},
qrCode: async (code) => {
console.log("Convert the next string to a QR code and scan it");
console.log(
`tg://login?token=${code.token.toString("base64url")}`
);
},
password: async (hint) => {
// password if needed
return "1111";
}
}
);
}
console.log("You should now be connected.");
console.log(client.session.save());
await client.sendMessage("me", { message: "Hello!" });
}
tele()
tele2()
@painor helpme sir
@thaziz Please have patience, everyone might not be as free as you are.
Hallo sir can yo helpme
is this still an issue in the latest version?