|
|
|
|
@@ -523,8 +523,29 @@ const txt_es = {
|
|
|
|
|
emo.EXCLAMATION_MARK +
|
|
|
|
|
'\nComprueba en el sitio %s y reescribe el nuevo código de 6 dígitos.',
|
|
|
|
|
MSG_VERIFY_OK: emoji.get('grinning') +
|
|
|
|
|
' Bienvenido %s! Ha verificado correctamente con el BOT. ' +
|
|
|
|
|
emo.GREEN_HEART,
|
|
|
|
|
' ✅🌈 Benvenuto %s!\n' +
|
|
|
|
|
'Ti sei correttamente verificato con il BOT. ' +
|
|
|
|
|
'\nSono il tuo assistente virtuale (BOT).\n\n' +
|
|
|
|
|
'Questa chat ti servirà per interagire con la Piattaforma e per ricevere delle notifiche Personali.\n' +
|
|
|
|
|
'' +
|
|
|
|
|
'(🆘 Per Aiuti, guarda il menu qui sotto)\n\n' +
|
|
|
|
|
'' +
|
|
|
|
|
'😍😍😍 Ora sei pronto per Entrare nella APP!\n' +
|
|
|
|
|
'👉🏻 Clicca qui: %s',
|
|
|
|
|
MSG_SET_USERNAME: '✨✨✨✨✨✨✨✨✨✨\n' +
|
|
|
|
|
'🔑 Devi impostare un Username per Telegram:\n' +
|
|
|
|
|
'\n' +
|
|
|
|
|
'👉🏻 1. Premi sull\'icona (tre linee orizzontali) del <b>menu principale</b> in alto a sinistra.\n' +
|
|
|
|
|
'👉🏻 2. Seleziona la voce <b>Impostazioni</b> nel menu.\n' +
|
|
|
|
|
'👉🏻 3.Premi su <b>Username</b> nella sezione account.\n' +
|
|
|
|
|
'👉🏻 4. Digita il tuo username. Deve essere un nome ancora libero e non già usato da altri.\n' +
|
|
|
|
|
'👉🏻 5. Per confermare premi sull\'icona con la spunta in alto a destra.\n' +
|
|
|
|
|
'🏁 Infine scrivi OK su questa chat. \n\n' +
|
|
|
|
|
'💬 In questo modo le persone potranno contattarti dalla APP cliccando sull\'icona di Telegram, presente nel tuo profilo.',
|
|
|
|
|
MSG_SET_USERNAME_OK: '😄😄✅✅ Ottimo! Hai impostato lo Username Telegram!\n\n' +
|
|
|
|
|
'Ora le persone potranno contattarti su Telegram, anche dalla APP visitando il tuo profilo e cliccando sull\'icona di Telegram, (senza dover pubblicare il proprio numero di cellulare).\n\n' +
|
|
|
|
|
'Ora puoi proseguire sulla APP.',
|
|
|
|
|
MSG_SET_PICPROFILE: '🖼 Abbiamo impostato <b>la tua foto del Profilo</b>, copiandola dalla foto profilo di Telegram. Potrai comunque cambiarla dalla APP (%s)',
|
|
|
|
|
MSG_ERR_UNKNOWN_VERIFY_CODE: 'Error al guardar en el servidor. Inténtalo de nuevo más tarde.',
|
|
|
|
|
MSG_EXIT_TELEGRAM: 'La cuenta ha sido desconectada de Telegram BOT.',
|
|
|
|
|
MSG_APORTADOR_USER_REGISTERED: emo.FIRE +
|
|
|
|
|
@@ -556,10 +577,29 @@ const txt_fr = {
|
|
|
|
|
emo.EXCLAMATION_MARK +
|
|
|
|
|
'\nControllez sur le site %s et réécrivez le nouveau code à 6 chiffres.',
|
|
|
|
|
MSG_VERIFY_OK: emoji.get('grinning') +
|
|
|
|
|
' Bienvenu(e) %s! Vous vous êtes vérifié avec succès avec le BOT. ' +
|
|
|
|
|
'\nJe suis ton assistant virtuel.\n' +
|
|
|
|
|
'Continuez le guide étape par étape en revenant sur le site. \n\nCe chat vous servira pour voir rapidement votre tableau de bord et recevoir des avis importants sur la marche à suivre pour continuer votre parcours.\n\nUtilisez le menu ci-dessous pour vérifier votre situation. ' +
|
|
|
|
|
emo.GREEN_HEART,
|
|
|
|
|
' ✅🌈 Benvenuto %s!\n' +
|
|
|
|
|
'Ti sei correttamente verificato con il BOT. ' +
|
|
|
|
|
'\nSono il tuo assistente virtuale (BOT).\n\n' +
|
|
|
|
|
'Questa chat ti servirà per interagire con la Piattaforma e per ricevere delle notifiche Personali.\n' +
|
|
|
|
|
'' +
|
|
|
|
|
'(🆘 Per Aiuti, guarda il menu qui sotto)\n\n' +
|
|
|
|
|
'' +
|
|
|
|
|
'😍😍😍 Ora sei pronto per Entrare nella APP!\n' +
|
|
|
|
|
'👉🏻 Clicca qui: %s',
|
|
|
|
|
MSG_SET_USERNAME: '✨✨✨✨✨✨✨✨✨✨\n' +
|
|
|
|
|
'🔑 Devi impostare un Username per Telegram:\n' +
|
|
|
|
|
'\n' +
|
|
|
|
|
'👉🏻 1. Premi sull\'icona (tre linee orizzontali) del <b>menu principale</b> in alto a sinistra.\n' +
|
|
|
|
|
'👉🏻 2. Seleziona la voce <b>Impostazioni</b> nel menu.\n' +
|
|
|
|
|
'👉🏻 3.Premi su <b>Username</b> nella sezione account.\n' +
|
|
|
|
|
'👉🏻 4. Digita il tuo username. Deve essere un nome ancora libero e non già usato da altri.\n' +
|
|
|
|
|
'👉🏻 5. Per confermare premi sull\'icona con la spunta in alto a destra.\n' +
|
|
|
|
|
'🏁 Infine scrivi OK su questa chat. \n\n' +
|
|
|
|
|
'💬 In questo modo le persone potranno contattarti dalla APP cliccando sull\'icona di Telegram, presente nel tuo profilo.',
|
|
|
|
|
MSG_SET_USERNAME_OK: '😄😄✅✅ Ottimo! Hai impostato lo Username Telegram!\n\n' +
|
|
|
|
|
'Ora le persone potranno contattarti su Telegram, anche dalla APP visitando il tuo profilo e cliccando sull\'icona di Telegram, (senza dover pubblicare il proprio numero di cellulare).\n\n' +
|
|
|
|
|
'Ora puoi proseguire sulla APP.',
|
|
|
|
|
MSG_SET_PICPROFILE: '🖼 Abbiamo impostato <b>la tua foto del Profilo</b>, copiandola dalla foto profilo di Telegram. Potrai comunque cambiarla dalla APP (%s)',
|
|
|
|
|
MSG_ERR_UNKNOWN_VERIFY_CODE: 'Erreur lors de l\'enregistrement sur le serveur. Retentez plus tard',
|
|
|
|
|
MSG_EXIT_TELEGRAM: 'L\'account a été déconnecté de Telegram BOT.',
|
|
|
|
|
MSG_APORTADOR_USER_REGISTERED: emo.FIRE +
|
|
|
|
|
@@ -589,10 +629,29 @@ const txt_si = {
|
|
|
|
|
MSG_ERR_VERIFY_CODE: 'Napačna koda za preverjanje!' + emo.EXCLAMATION_MARK +
|
|
|
|
|
'\nPreveri na strani %s in ponovno napiši 6 mestno kodo.',
|
|
|
|
|
MSG_VERIFY_OK: emoji.get('grinning') +
|
|
|
|
|
'Dobrodošel %s! Pravilno ste se preveriliz BOT. ' +
|
|
|
|
|
' \nsem tvoj virtualni asisten.\n ' +
|
|
|
|
|
'Vodenje se nadeljuje z vodenimi koraki, ko se vrneš na spletno stran. \n\nTa klepet ti bo služil za hitri pregled tvoje table in za sprejemanje pomembnih obvestil glede poteka tvojega potovanja. \n\nUporabite meni tu spodaj, da lahko kontrolirate svojo situacijo. ' +
|
|
|
|
|
emo.GREEN_HEART,
|
|
|
|
|
' ✅🌈 Benvenuto %s!\n' +
|
|
|
|
|
'Ti sei correttamente verificato con il BOT. ' +
|
|
|
|
|
'\nSono il tuo assistente virtuale (BOT).\n\n' +
|
|
|
|
|
'Questa chat ti servirà per interagire con la Piattaforma e per ricevere delle notifiche Personali.\n' +
|
|
|
|
|
'' +
|
|
|
|
|
'(🆘 Per Aiuti, guarda il menu qui sotto)\n\n' +
|
|
|
|
|
'' +
|
|
|
|
|
'😍😍😍 Ora sei pronto per Entrare nella APP!\n' +
|
|
|
|
|
'👉🏻 Clicca qui: %s',
|
|
|
|
|
MSG_SET_USERNAME: '✨✨✨✨✨✨✨✨✨✨\n' +
|
|
|
|
|
'🔑 Devi impostare un Username per Telegram:\n' +
|
|
|
|
|
'\n' +
|
|
|
|
|
'👉🏻 1. Premi sull\'icona (tre linee orizzontali) del <b>menu principale</b> in alto a sinistra.\n' +
|
|
|
|
|
'👉🏻 2. Seleziona la voce <b>Impostazioni</b> nel menu.\n' +
|
|
|
|
|
'👉🏻 3.Premi su <b>Username</b> nella sezione account.\n' +
|
|
|
|
|
'👉🏻 4. Digita il tuo username. Deve essere un nome ancora libero e non già usato da altri.\n' +
|
|
|
|
|
'👉🏻 5. Per confermare premi sull\'icona con la spunta in alto a destra.\n' +
|
|
|
|
|
'🏁 Infine scrivi OK su questa chat. \n\n' +
|
|
|
|
|
'💬 In questo modo le persone potranno contattarti dalla APP cliccando sull\'icona di Telegram, presente nel tuo profilo.',
|
|
|
|
|
MSG_SET_USERNAME_OK: '😄😄✅✅ Ottimo! Hai impostato lo Username Telegram!\n\n' +
|
|
|
|
|
'Ora le persone potranno contattarti su Telegram, anche dalla APP visitando il tuo profilo e cliccando sull\'icona di Telegram, (senza dover pubblicare il proprio numero di cellulare).\n\n' +
|
|
|
|
|
'Ora puoi proseguire sulla APP.',
|
|
|
|
|
MSG_SET_PICPROFILE: '🖼 Abbiamo impostato <b>la tua foto del Profilo</b>, copiandola dalla foto profilo di Telegram. Potrai comunque cambiarla dalla APP (%s)',
|
|
|
|
|
MSG_ERR_UNKNOWN_VERIFY_CODE: 'Napaka strežnika.Poskusi kasneje ',
|
|
|
|
|
MSG_EXIT_TELEGRAM: 'Račun se nahaja v programu Telegram BOT.',
|
|
|
|
|
MSG_APORTADOR_USER_REGISTERED: emo.FIRE +
|
|
|
|
|
@@ -621,10 +680,29 @@ const txt_en = {
|
|
|
|
|
MSG_ERR_VERIFY_CODE: 'Incorrect Verification Code!' + emo.EXCLAMATION_MARK +
|
|
|
|
|
'\nCheck on the site %s and rewrite the new 6-digit code.',
|
|
|
|
|
MSG_VERIFY_OK: emoji.get('grinning') +
|
|
|
|
|
' Welcome %s! You have correctly verified yourself with BOT. ' +
|
|
|
|
|
'\nI am your virtual assistant.\n' +
|
|
|
|
|
'Continue the step-by-step guide back to the website.\n\nThis chat will help you to quickly see your DashBoard and receive important alerts on how to proceed on your path.\n\nUse the menu below to check your situation.' +
|
|
|
|
|
emo.GREEN_HEART,
|
|
|
|
|
' ✅🌈 Benvenuto %s!\n' +
|
|
|
|
|
'Ti sei correttamente verificato con il BOT. ' +
|
|
|
|
|
'\nSono il tuo assistente virtuale (BOT).\n\n' +
|
|
|
|
|
'Questa chat ti servirà per interagire con la Piattaforma e per ricevere delle notifiche Personali.\n' +
|
|
|
|
|
'' +
|
|
|
|
|
'(🆘 Per Aiuti, guarda il menu qui sotto)\n\n' +
|
|
|
|
|
'' +
|
|
|
|
|
'😍😍😍 Ora sei pronto per Entrare nella APP!\n' +
|
|
|
|
|
'👉🏻 Clicca qui: %s',
|
|
|
|
|
MSG_SET_USERNAME: '✨✨✨✨✨✨✨✨✨✨\n' +
|
|
|
|
|
'🔑 Devi impostare un Username per Telegram:\n' +
|
|
|
|
|
'\n' +
|
|
|
|
|
'👉🏻 1. Premi sull\'icona (tre linee orizzontali) del <b>menu principale</b> in alto a sinistra.\n' +
|
|
|
|
|
'👉🏻 2. Seleziona la voce <b>Impostazioni</b> nel menu.\n' +
|
|
|
|
|
'👉🏻 3.Premi su <b>Username</b> nella sezione account.\n' +
|
|
|
|
|
'👉🏻 4. Digita il tuo username. Deve essere un nome ancora libero e non già usato da altri.\n' +
|
|
|
|
|
'👉🏻 5. Per confermare premi sull\'icona con la spunta in alto a destra.\n' +
|
|
|
|
|
'🏁 Infine scrivi OK su questa chat. \n\n' +
|
|
|
|
|
'💬 In questo modo le persone potranno contattarti dalla APP cliccando sull\'icona di Telegram, presente nel tuo profilo.',
|
|
|
|
|
MSG_SET_USERNAME_OK: '😄😄✅✅ Ottimo! Hai impostato lo Username Telegram!\n\n' +
|
|
|
|
|
'Ora le persone potranno contattarti su Telegram, anche dalla APP visitando il tuo profilo e cliccando sull\'icona di Telegram, (senza dover pubblicare il proprio numero di cellulare).\n\n' +
|
|
|
|
|
'Ora puoi proseguire sulla APP.',
|
|
|
|
|
MSG_SET_PICPROFILE: '🖼 Abbiamo impostato <b>la tua foto del Profilo</b>, copiandola dalla foto profilo di Telegram. Potrai comunque cambiarla dalla APP (%s)',
|
|
|
|
|
MSG_ERR_UNKNOWN_VERIFY_CODE: 'Error while saving to the Server. Try again later',
|
|
|
|
|
MSG_EXIT_TELEGRAM: 'The account has now been disconnected from this Telegram BOT.',
|
|
|
|
|
MSG_APORTADOR_USER_REGISTERED: emo.FIRE +
|
|
|
|
|
@@ -656,10 +734,29 @@ const txt_pt = {
|
|
|
|
|
emo.EXCLAMATION_MARK +
|
|
|
|
|
'\nCódigo de Verificação ErradoCheque no local %s e reescreva o novo código de 6 dígitos.',
|
|
|
|
|
MSG_VERIFY_OK: emoji.get('grinning') +
|
|
|
|
|
' Bem-vindo %s! Você verificou corretamente com BOT. ' +
|
|
|
|
|
'\nEu sou o vosso assistente virtual.\n' +
|
|
|
|
|
'Continue o guia passo-a-passo de volta ao site.\n\nEste chat vai ajudá-lo a ver rapidamente o seu Quadro Negro e a receber alertas importantes sobre como proceder..\n\n' +
|
|
|
|
|
'Use o menu abaixo para verificar a sua situação.' + emo.GREEN_HEART,
|
|
|
|
|
' ✅🌈 Benvenuto %s!\n' +
|
|
|
|
|
'Ti sei correttamente verificato con il BOT. ' +
|
|
|
|
|
'\nSono il tuo assistente virtuale (BOT).\n\n' +
|
|
|
|
|
'Questa chat ti servirà per interagire con la Piattaforma e per ricevere delle notifiche Personali.\n' +
|
|
|
|
|
'' +
|
|
|
|
|
'(🆘 Per Aiuti, guarda il menu qui sotto)\n\n' +
|
|
|
|
|
'' +
|
|
|
|
|
'😍😍😍 Ora sei pronto per Entrare nella APP!\n' +
|
|
|
|
|
'👉🏻 Clicca qui: %s',
|
|
|
|
|
MSG_SET_USERNAME: '✨✨✨✨✨✨✨✨✨✨\n' +
|
|
|
|
|
'🔑 Devi impostare un Username per Telegram:\n' +
|
|
|
|
|
'\n' +
|
|
|
|
|
'👉🏻 1. Premi sull\'icona (tre linee orizzontali) del <b>menu principale</b> in alto a sinistra.\n' +
|
|
|
|
|
'👉🏻 2. Seleziona la voce <b>Impostazioni</b> nel menu.\n' +
|
|
|
|
|
'👉🏻 3.Premi su <b>Username</b> nella sezione account.\n' +
|
|
|
|
|
'👉🏻 4. Digita il tuo username. Deve essere un nome ancora libero e non già usato da altri.\n' +
|
|
|
|
|
'👉🏻 5. Per confermare premi sull\'icona con la spunta in alto a destra.\n' +
|
|
|
|
|
'🏁 Infine scrivi OK su questa chat. \n\n' +
|
|
|
|
|
'💬 In questo modo le persone potranno contattarti dalla APP cliccando sull\'icona di Telegram, presente nel tuo profilo.',
|
|
|
|
|
MSG_SET_USERNAME_OK: '😄😄✅✅ Ottimo! Hai impostato lo Username Telegram!\n\n' +
|
|
|
|
|
'Ora le persone potranno contattarti su Telegram, anche dalla APP visitando il tuo profilo e cliccando sull\'icona di Telegram, (senza dover pubblicare il proprio numero di cellulare).\n\n' +
|
|
|
|
|
'Ora puoi proseguire sulla APP.',
|
|
|
|
|
MSG_SET_PICPROFILE: '🖼 Abbiamo impostato <b>la tua foto del Profilo</b>, copiandola dalla foto profilo di Telegram. Potrai comunque cambiarla dalla APP (%s)',
|
|
|
|
|
MSG_ERR_UNKNOWN_VERIFY_CODE: 'Erro ao salvar no Servidor. Tente novamente mais tarde.',
|
|
|
|
|
MSG_EXIT_TELEGRAM: 'A conta foi agora desconectada deste Telegrama BOT.',
|
|
|
|
|
MSG_APORTADOR_USER_REGISTERED: emo.FIRE +
|
|
|
|
|
@@ -693,6 +790,15 @@ module.exports = {
|
|
|
|
|
ISCRIZIONE_CONACREIS: 2,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
deleteRecInMemByUsername: function(idapp, username_bo) {
|
|
|
|
|
|
|
|
|
|
const cl = getclTelegByidapp(idapp);
|
|
|
|
|
if (cl) {
|
|
|
|
|
cl.arrUsers = cl.arrUsers.filter(
|
|
|
|
|
(rec) => rec.username_bo !== username_bo);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getFormDaMostrare: function(idapp, myfunc, myuser) {
|
|
|
|
|
|
|
|
|
|
let FormDaMostrare = null;
|
|
|
|
|
@@ -735,7 +841,7 @@ module.exports = {
|
|
|
|
|
|
|
|
|
|
let aportador = '';
|
|
|
|
|
if (userdest) {
|
|
|
|
|
aportador = ` (${userdest})`;
|
|
|
|
|
aportador = `${userdest}`;
|
|
|
|
|
NameFrom += aportador;
|
|
|
|
|
} else {
|
|
|
|
|
aportador = mylocalsconf.user.aportador_solidario_nome_completo
|
|
|
|
|
@@ -750,8 +856,8 @@ module.exports = {
|
|
|
|
|
shared_consts.ConfSite.Notif_Reg_Bot_ToManagers)) {
|
|
|
|
|
if (userdest) {
|
|
|
|
|
NameFrom = await User.getNameSurnameByUsername(mylocalsconf.idapp,
|
|
|
|
|
userdest, true) + aportador;
|
|
|
|
|
aportador = NameFrom;
|
|
|
|
|
userdest, true);
|
|
|
|
|
aportador = NameFrom ? NameFrom + ' ' + aportador : aportador;
|
|
|
|
|
}
|
|
|
|
|
const numutenti = await User.getNumUsers(mylocalsconf.idapp);
|
|
|
|
|
let nome = tools.getNomeCognomeEUserNameByUser(mylocalsconf.user);
|
|
|
|
|
@@ -764,10 +870,10 @@ module.exports = {
|
|
|
|
|
let rismsg = null;
|
|
|
|
|
|
|
|
|
|
if (text) {
|
|
|
|
|
if (!!mylocalsconf.user.aportador_solidario) {
|
|
|
|
|
/*if (!!mylocalsconf.user.aportador_solidario) {
|
|
|
|
|
addtext = '[Inviato a ' + NameFrom + ']:' + '\n';
|
|
|
|
|
rismsg = await this.sendMsgTelegram(mylocalsconf.idapp, userdest, text);
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
await this.sendMsgTelegramToTheManagers(mylocalsconf.idapp,
|
|
|
|
|
addtext + text, false, null, userdest);
|
|
|
|
|
@@ -1217,21 +1323,6 @@ module.exports = {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
setVerifiedReg: async function(idapp, lang, usernameorig, usernameDest) {
|
|
|
|
|
try {
|
|
|
|
|
await User.setVerifiedByAportador(idapp, usernameDest, true);
|
|
|
|
|
await User.setFriendsCmd(idapp, usernameorig, usernameDest,
|
|
|
|
|
shared_consts.FRIENDSCMD.SETFRIEND);
|
|
|
|
|
|
|
|
|
|
const msgDest = printf(getstr(lang, 'MSG_APORTADOR_CONFIRMED'),
|
|
|
|
|
`${usernameDest}`);
|
|
|
|
|
await local_sendMsgTelegram(idapp, usernameorig, msgDest);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log('e', e);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
async function sendMsgTelegramToTheAdmin(idapp, text, msg) {
|
|
|
|
|
@@ -1267,7 +1358,23 @@ async function sendMsgTelegramToTheAdmin(idapp, text, msg) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function askConfirmationUserRegistration(idapp, myfunc, myuser, usernametelegram = '', name_telegram = '', surname_telegram = '') {
|
|
|
|
|
async function setVerifiedReg(idapp, lang, usernameorig, usernameDest) {
|
|
|
|
|
try {
|
|
|
|
|
await User.setVerifiedByAportador(idapp, usernameorig, true);
|
|
|
|
|
await User.setFriendsCmd(idapp, usernameorig, usernameDest,
|
|
|
|
|
shared_consts.FRIENDSCMD.SETFRIEND);
|
|
|
|
|
|
|
|
|
|
const msgDest = printf(getstr(lang, 'MSG_APORTADOR_CONFIRMED'),
|
|
|
|
|
`${usernameDest}`);
|
|
|
|
|
await local_sendMsgTelegram(idapp, usernameorig, msgDest);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log('e', e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function askConfirmationUserRegistration(
|
|
|
|
|
idapp, myfunc, myuser, usernametelegram = '', name_telegram = '',
|
|
|
|
|
surname_telegram = '') {
|
|
|
|
|
|
|
|
|
|
const cl = getclTelegByidapp(idapp);
|
|
|
|
|
|
|
|
|
|
@@ -1284,8 +1391,7 @@ async function askConfirmationUserRegistration(idapp, myfunc, myuser, usernamete
|
|
|
|
|
|
|
|
|
|
if (notask_verif) {
|
|
|
|
|
// Non chiedi la verifica Registrazione
|
|
|
|
|
this.setVerifiedReg(myuser.idapp, myuser.lang, userDest,
|
|
|
|
|
myuser.username);
|
|
|
|
|
setVerifiedReg(myuser.idapp, myuser.lang, userDest, myuser.username);
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
const name = myuser.username +
|
|
|
|
|
@@ -1297,7 +1403,8 @@ async function askConfirmationUserRegistration(idapp, myfunc, myuser, usernamete
|
|
|
|
|
myuser.email);
|
|
|
|
|
|
|
|
|
|
if (usernametelegram) {
|
|
|
|
|
domanda += '<br>Profilo su Telegram [' + name_telegram + ' ' + surname_telegram + ']:<br>' + 'https://t.me/' + usernametelegram;
|
|
|
|
|
domanda += '<br>Profilo su Telegram [' + name_telegram + ' ' +
|
|
|
|
|
surname_telegram + ']:<br>' + 'https://t.me/' + usernametelegram;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keyb = cl.getInlineKeyboard(myuser.lang, [
|
|
|
|
|
@@ -1383,7 +1490,8 @@ async function local_sendMsgTelegram(idapp, username, text) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function local_sendMsgTelegramByIdTelegram(idapp, idtelegram, text, message_id, chat_id, ripr_menuPrec,
|
|
|
|
|
async function local_sendMsgTelegramByIdTelegram(idapp, idtelegram, text,
|
|
|
|
|
message_id, chat_id, ripr_menuPrec,
|
|
|
|
|
MyForm = null) {
|
|
|
|
|
|
|
|
|
|
console.log('sendMsgTelegramByIdTelegram', text);
|
|
|
|
|
@@ -1400,7 +1508,6 @@ async function local_sendMsgTelegramByIdTelegram(idapp, idtelegram, text, messag
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getstr(lang, key, param1) {
|
|
|
|
|
|
|
|
|
|
let mystr = '';
|
|
|
|
|
@@ -1739,9 +1846,11 @@ class Telegram {
|
|
|
|
|
emo.GIFT_HEART;
|
|
|
|
|
} else if (MsgBot.MA_ALLORA.find((rec) => testo.indexOf(rec) > -1)) {
|
|
|
|
|
risp = 'Ma allora cosa?';
|
|
|
|
|
} else if (MsgBot.DOVE_VUOI_VIVERE.find((rec) => testo.indexOf(rec) > -1)) {
|
|
|
|
|
} else if (MsgBot.DOVE_VUOI_VIVERE.find(
|
|
|
|
|
(rec) => testo.indexOf(rec) > -1)) {
|
|
|
|
|
risp = 'Mah a me piacerebbe vivere al mare, ma anche vicino al verde, in montagna. Sarebbe l\'ideale 😄';
|
|
|
|
|
} else if (MsgBot.TROVAMI_UN_UOMO_DONNA.find((rec) => testo.indexOf(rec) > -1)) {
|
|
|
|
|
} else if (MsgBot.TROVAMI_UN_UOMO_DONNA.find(
|
|
|
|
|
(rec) => testo.indexOf(rec) > -1)) {
|
|
|
|
|
risp = 'Eh non è cosi facile. Ma se t\'impegni a cercare ci riuscirai. Nel frattempo trova la tua strada, fai il tuo percorso interiore, e magari arriva proprio quando meno te l\'aspetti';
|
|
|
|
|
} else if (MsgBot.SEI_LIBERO_STASERA.find(
|
|
|
|
|
(rec) => testo.indexOf(rec) > -1)) {
|
|
|
|
|
@@ -2279,6 +2388,7 @@ class Telegram {
|
|
|
|
|
const mystr = this.getstrChatHelp();
|
|
|
|
|
await this.sendMsg(msg.chat.id, mystr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async menuAdmin(msg) {
|
|
|
|
|
const mystr = tools.get__('SCEGLI_VOCE', this.getlang(msg));
|
|
|
|
|
await
|
|
|
|
|
@@ -2598,18 +2708,21 @@ class Telegram {
|
|
|
|
|
this.setPhotoProfile(rec, msg);
|
|
|
|
|
let username = recuser.name;
|
|
|
|
|
|
|
|
|
|
this.sendMsg(msg.from.id,
|
|
|
|
|
printf(getstr(recuser.lang, 'MSG_VERIFY_OK'), username, tools.getHostByIdApp(this.idapp)));
|
|
|
|
|
this.sendMsgLog(msg.from.id,
|
|
|
|
|
printf(getstr(recuser.lang, 'MSG_VERIFY_OK'), username,
|
|
|
|
|
tools.getHostByIdApp(this.idapp)));
|
|
|
|
|
|
|
|
|
|
if (msg.from.username) {
|
|
|
|
|
askConfirmationUserRegistration(this.idapp,
|
|
|
|
|
shared_consts.CallFunz.REGISTRATION, recuser,msg.from.username || '', msg.from.first_name || '', msg.from.last_name || '');
|
|
|
|
|
shared_consts.CallFunz.REGISTRATION, recuser,
|
|
|
|
|
msg.from.username || '', msg.from.first_name || '',
|
|
|
|
|
msg.from.last_name || '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.checkIfUsernameTelegramSet(msg, recuser);
|
|
|
|
|
// local_sendMsgTelegramToTheManagers(this.idapp, recuser.name + ' ' + recuser.surname + ' si è Verificato a Telegram BOT! (lang=' + recuser.lang + ')' + emo.STARS, msg);
|
|
|
|
|
} else {
|
|
|
|
|
this.sendMsg(msg.from.id,
|
|
|
|
|
this.sendMsgLog(msg.from.id,
|
|
|
|
|
getstr(this.getlang(msg), 'MSG_ERR_UNKNOWN_VERIFY_CODE'));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@@ -2617,13 +2730,13 @@ class Telegram {
|
|
|
|
|
if (rec.retry < 2) {
|
|
|
|
|
rec.retry++;
|
|
|
|
|
await
|
|
|
|
|
this.sendMsg(msg.from.id,
|
|
|
|
|
this.sendMsgLog(msg.from.id,
|
|
|
|
|
printf(getstr(this.getlang(msg), 'MSG_ERR_VERIFY_CODE'),
|
|
|
|
|
tools.getHostByIdApp(this.idapp)));
|
|
|
|
|
} else {
|
|
|
|
|
rec.status = Status.NONE;
|
|
|
|
|
await
|
|
|
|
|
this.sendMsg(msg.from.id, getstr(this.getlang(msg),
|
|
|
|
|
this.sendMsgLog(msg.from.id, getstr(this.getlang(msg),
|
|
|
|
|
'MSG_ERRORE_USERNAME_ANNULLA'));
|
|
|
|
|
this.deleteRecInMem(msg);
|
|
|
|
|
}
|
|
|
|
|
@@ -2633,11 +2746,11 @@ class Telegram {
|
|
|
|
|
if (rec)
|
|
|
|
|
rec.status = Status.NONE;
|
|
|
|
|
await
|
|
|
|
|
this.sendMsg(msg.from.id,
|
|
|
|
|
this.sendMsgLog(msg.from.id,
|
|
|
|
|
getstr(this.getlang(msg), 'MSG_ERRORE_USERNAME_ANNULLA'));
|
|
|
|
|
} else {
|
|
|
|
|
await
|
|
|
|
|
this.sendMsg(msg.from.id,
|
|
|
|
|
this.sendMsgLog(msg.from.id,
|
|
|
|
|
getstr(this.getlang(msg), 'MSG_ERRORE_VERIFY_CODE_MAXLEN'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -2788,7 +2901,8 @@ class Telegram {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (inviaveramente) {
|
|
|
|
|
textdainviare = this.convertSpecialTags(utente, textdainviare);
|
|
|
|
|
textdainviare = this.convertSpecialTags(utente,
|
|
|
|
|
textdainviare);
|
|
|
|
|
|
|
|
|
|
if (destin === Destin.A_UTENTE) {
|
|
|
|
|
await this.sistemaRecDest(rec, msg);
|
|
|
|
|
@@ -3159,9 +3273,12 @@ class Telegram {
|
|
|
|
|
for (const rec of recuser.menuDb) {
|
|
|
|
|
rec.active_mem = false;
|
|
|
|
|
if (rec.active && rec.page === recuser.pagenow
|
|
|
|
|
&& (tools.isBitAttivoESelez(rec.visibility, shared_consts.VISIB_ONLY_ADMIN, isAdmin) &&
|
|
|
|
|
tools.isBitAttivoESelez(rec.visibility, shared_consts.VISIB_ONLY_MANAGER, isManager) &&
|
|
|
|
|
tools.isBitAttivoESelez(rec.visibility, shared_consts.VISIB_ONLYIF_VERIFIED, isVerified))
|
|
|
|
|
&& (tools.isBitAttivoESelez(rec.visibility,
|
|
|
|
|
shared_consts.VISIB_ONLY_ADMIN, isAdmin) &&
|
|
|
|
|
tools.isBitAttivoESelez(rec.visibility,
|
|
|
|
|
shared_consts.VISIB_ONLY_MANAGER, isManager) &&
|
|
|
|
|
tools.isBitAttivoESelez(rec.visibility,
|
|
|
|
|
shared_consts.VISIB_ONLYIF_VERIFIED, isVerified))
|
|
|
|
|
) {
|
|
|
|
|
rec.active_mem = true;
|
|
|
|
|
if (rec.main) {
|
|
|
|
|
@@ -3400,6 +3517,7 @@ class Telegram {
|
|
|
|
|
async sendMsg(id, text, menu, form, msg_id, chat_id, ripr_menuPrec) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
if (text.length > 4090) {
|
|
|
|
|
let text1 = text.slice(0, 4090);
|
|
|
|
|
let text2 = text.slice(4090, text.length);
|
|
|
|
|
@@ -3417,6 +3535,16 @@ class Telegram {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async sendMsgLog(id, text, menu, form, msg_id, chat_id, ripr_menuPrec) {
|
|
|
|
|
|
|
|
|
|
const rec = this.getRecInMemById(id);
|
|
|
|
|
const username = rec ? rec.username : ''
|
|
|
|
|
|
|
|
|
|
console.log('Msg inviato a ', username, text);
|
|
|
|
|
this.sendMsg(id, text, menu, form, msg_id, chat_id, ripr_menuPrec)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getmenuKey(mymenu, lang) {
|
|
|
|
|
let mymenuout = null;
|
|
|
|
|
try {
|
|
|
|
|
@@ -3439,7 +3567,7 @@ class Telegram {
|
|
|
|
|
const token = this.token;
|
|
|
|
|
const editprofile = tools.getHostByIdApp(idapp, true) + '/editprofile';
|
|
|
|
|
let myfileprofile = tools.getdirByIdApp(idapp, true) +
|
|
|
|
|
server_constants.DIR_UPLOAD + '/profile/' + username +'/';
|
|
|
|
|
server_constants.DIR_UPLOAD + '/profile/' + username + '/';
|
|
|
|
|
let user_profile = bot.getUserProfilePhotos(msg.from.id);
|
|
|
|
|
user_profile.then(function(res) {
|
|
|
|
|
if (res.photos[0]) {
|
|
|
|
|
@@ -3448,22 +3576,26 @@ class Telegram {
|
|
|
|
|
file.then(function(result) {
|
|
|
|
|
|
|
|
|
|
const file_path = result.file_path;
|
|
|
|
|
const photo_url = 'https://api.telegram.org/file/bot' + token + '/' + file_path;
|
|
|
|
|
console.log('1) photo_url', photo_url);
|
|
|
|
|
const photo_url = 'https://api.telegram.org/file/bot' + token +
|
|
|
|
|
'/' + file_path;
|
|
|
|
|
// console.log('1) photo_url', photo_url);
|
|
|
|
|
let filename = tools.extractFileName(photo_url);
|
|
|
|
|
myfileprofile += filename;
|
|
|
|
|
|
|
|
|
|
const pathfile = tools.extractFilePath(myfileprofile);
|
|
|
|
|
tools.mkdirpath(pathfile);
|
|
|
|
|
|
|
|
|
|
console.log('2) myfileprofile', pathfile);
|
|
|
|
|
// console.log('2) myfileprofile', pathfile);
|
|
|
|
|
return tools.downloadImage(photo_url, myfileprofile).
|
|
|
|
|
then((ris) => {
|
|
|
|
|
console.log('3) setPicProfile ris', ris);
|
|
|
|
|
return User.setPicProfile(idapp, username, filename).then((ris) => {
|
|
|
|
|
console.log('4) sendMsg picprofile Copied !');
|
|
|
|
|
local_sendMsgTelegram(idapp, username, printf(getstr(lang, 'MSG_SET_PICPROFILE'), editprofile));
|
|
|
|
|
});
|
|
|
|
|
// console.log('3) setPicProfile ris', ris);
|
|
|
|
|
return User.setPicProfile(idapp, username, filename).
|
|
|
|
|
then((ris) => {
|
|
|
|
|
// console.log('4) sendMsg picprofile Copied !');
|
|
|
|
|
local_sendMsgTelegram(idapp, username,
|
|
|
|
|
printf(getstr(lang, 'MSG_SET_PICPROFILE'),
|
|
|
|
|
editprofile));
|
|
|
|
|
});
|
|
|
|
|
// console.log('scaricato');
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
console.error('Error setPhotoProfile', err);
|
|
|
|
|
@@ -3478,7 +3610,6 @@ class Telegram {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getInlineKeyboard(lang, arrrisp1, arrrisp2, arrrisp3) {
|
|
|
|
|
let mykeyb = {
|
|
|
|
|
parse_mode: 'HTML',
|
|
|
|
|
|