Togliere "in attesa di abilitazione"
Registrazione rapida (senza dover confermare, un link che scade dopo 48 ore.
This commit is contained in:
@@ -820,7 +820,7 @@ const MyTelegramBot = {
|
||||
await this.sendMsgTelegramToTheManagers(mylocalsconf.idapp, addtext + text);
|
||||
},
|
||||
|
||||
askConfirmationUser: async function(idapp, myfunc, myuser, userDest = '', groupname = '', groupid = '') {
|
||||
askConfirmationUser: async function(idapp, myfunc, myuser, userDest = '', groupname = '', groupid = '', regexpire = '') {
|
||||
|
||||
try {
|
||||
const cl = getclTelegByidapp(idapp);
|
||||
@@ -846,7 +846,16 @@ const MyTelegramBot = {
|
||||
await cl.sendMsg(telegid, rismsg2.body);
|
||||
|
||||
userDest = myuser.aportador_solidario;
|
||||
const notask_verif = await User.notAsk_VerifByUsername(idapp, userDest);
|
||||
let notask_verif = await User.notAsk_VerifByUsername(idapp, userDest);
|
||||
|
||||
let useraportador = await User.getUserShortDataByUsername(idapp, userDest);
|
||||
|
||||
if (useraportador && useraportador.tokenreg && (regexpire.toLowerCase() === useraportador.tokenreg.toLowerCase())) {
|
||||
const nonchiedereverifica = await User.getifRegTokenIsValid(idapp, useraportador.tokenreg);
|
||||
if (nonchiedereverifica)
|
||||
notask_verif = true;
|
||||
}
|
||||
|
||||
|
||||
if (notask_verif) {
|
||||
// Non chiedi la verifica Registrazione
|
||||
@@ -1044,7 +1053,7 @@ const MyTelegramBot = {
|
||||
|
||||
const cl = getclTelegByidapp(user.idapp);
|
||||
if (cl) {
|
||||
msg = tools.convertSpecialTags(rec.user, msg);
|
||||
msg = await tools.convertSpecialTags(rec.user, msg);
|
||||
}
|
||||
|
||||
if (!!mydata.flotta) {
|
||||
@@ -1692,7 +1701,7 @@ class Telegram {
|
||||
}
|
||||
}
|
||||
|
||||
risp = tools.convertSpecialTags(rec.user, risp);
|
||||
risp = await tools.convertSpecialTags(rec.user, risp);
|
||||
|
||||
let keyboard = null;
|
||||
|
||||
@@ -2526,7 +2535,7 @@ class Telegram {
|
||||
|
||||
try {
|
||||
const msg = await MsgTemplate.getMsgByTitleAndLang(myuser.idapp, title, myuser.lang);
|
||||
const mytext = tools.convertSpecialTags(myuser, msg.body);
|
||||
const mytext = await tools.convertSpecialTags(myuser, msg.body);
|
||||
return await this.sendMsg(myuser.profile.teleg_id, mytext);
|
||||
} catch (e) {
|
||||
console.error('ERR sendMsgByTemplate', e);
|
||||
@@ -2544,7 +2553,7 @@ class Telegram {
|
||||
} catch (e) {
|
||||
}
|
||||
const mymsg = await MsgTemplate.getMsgByTitleAndLang(tools.RISO, title, langcode);
|
||||
const mytext = tools.convertSpecialTags(null, mymsg.body);
|
||||
const mytext = await tools.convertSpecialTags(null, mymsg.body);
|
||||
if (id > 0)
|
||||
return await this.sendMsg(id, mytext);
|
||||
} catch (e) {
|
||||
@@ -2563,7 +2572,7 @@ class Telegram {
|
||||
} catch (e) {
|
||||
}
|
||||
const text = getstr(langcode, keytext);
|
||||
const mytext = tools.convertSpecialTags(null, text);
|
||||
const mytext = await tools.convertSpecialTags(null, text);
|
||||
if (id > 0)
|
||||
return await this.sendMsg(id, mytext);
|
||||
} catch (e) {
|
||||
@@ -2850,7 +2859,7 @@ class Telegram {
|
||||
}
|
||||
|
||||
if (inviaveramente) {
|
||||
textdainviare = tools.convertSpecialTags(utente, textdainviare);
|
||||
textdainviare = await tools.convertSpecialTags(utente, textdainviare);
|
||||
|
||||
if (destin === Destin.A_UTENTE) {
|
||||
await this.sistemaRecDest(rec, msg);
|
||||
@@ -2965,13 +2974,18 @@ class Telegram {
|
||||
|
||||
let mymsg = msg.text.toString().trim().toLowerCase();
|
||||
let invitante = '';
|
||||
let regexpire = '';
|
||||
if (mymsg.startsWith('/start')) {
|
||||
let myarrmsg = mymsg.split(' ');
|
||||
if (myarrmsg.length > 0) {
|
||||
mymsg = myarrmsg[1];
|
||||
if (mymsg.startsWith('inv_')) {
|
||||
invitante = mymsg.substring(4);
|
||||
return invitante;
|
||||
let arrparams = mymsg.split('_');
|
||||
if (arrparams.length > 2) {
|
||||
invitante = arrparams[1];
|
||||
regexpire = arrparams[3];
|
||||
}
|
||||
return {invitante, regexpire};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2981,15 +2995,16 @@ class Telegram {
|
||||
return '';
|
||||
}
|
||||
|
||||
async setInvitante(msg, invitante, crea) {
|
||||
async setInvitante(msg, ris, crea) {
|
||||
let rec = this.getRecInMem(msg);
|
||||
if (!rec && crea) {
|
||||
let status = await this.setInit(msg);
|
||||
rec = this.getRecInMem(msg);
|
||||
}
|
||||
if (rec) {
|
||||
if (!rec.aportador_solidario && invitante) {
|
||||
rec.aportador_solidario = invitante;
|
||||
if (!rec.aportador_solidario && ris && ris.invitante) {
|
||||
rec.aportador_solidario = ris.invitante;
|
||||
rec.regexpire = ris.regexpire;
|
||||
rec.status = Status.SET_USERNAME_INVITANTE;
|
||||
}
|
||||
}
|
||||
@@ -3018,17 +3033,9 @@ class Telegram {
|
||||
await this.askUsernameInvitante(msg, true);
|
||||
// await this.settotheDatabase(msg);
|
||||
} else if (status === Status.SET_USERNAME_INVITANTE) {
|
||||
let mymsg = msg.text.toString().trim().toLowerCase();
|
||||
let invitante = '';
|
||||
if (mymsg && mymsg.startsWith('/start')) {
|
||||
let myarrmsg = mymsg.split(' ');
|
||||
if (myarrmsg.length > 0) {
|
||||
mymsg = myarrmsg[1];
|
||||
if (mymsg && mymsg.startsWith('inv_')) {
|
||||
invitante = mymsg.substring(4);
|
||||
await this.setInvitante(msg, invitante);
|
||||
}
|
||||
}
|
||||
const ris = this.getInvitanteByMsg(msg);
|
||||
if (ris.invitante) {
|
||||
await this.setInvitante(msg, ris, true);
|
||||
}
|
||||
|
||||
await this.setUsernameInvitante(msg);
|
||||
@@ -3857,19 +3864,6 @@ if (true) {
|
||||
|
||||
const myclTelegram = getclTelegBytoken(bot.token);
|
||||
|
||||
let mymsg = msg.text.toString().trim().toLowerCase();
|
||||
let invitante = '';
|
||||
if (mymsg && mymsg.startsWith('/start')) {
|
||||
let myarrmsg = mymsg.split(' ');
|
||||
if (myarrmsg.length > 0) {
|
||||
mymsg = myarrmsg[1];
|
||||
if (mymsg && mymsg.startsWith('inv_')) {
|
||||
invitante = mymsg.substring(4);
|
||||
// await myclTelegram.setInvitante(msg, invitante);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// const chatId = msg.chat.id;
|
||||
myclTelegram.receiveMsg(msg);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user