Impostato la lingua fissa a ITALIANO: ancora non ci sono le traduzioni e poi qualcosa sul server fa casino (non arrivano le richieste...)
Risolto Bug sui messaggi di registrazione, se l'utente non aveva l'Username Telegram
This commit is contained in:
@@ -4,7 +4,6 @@ const validator = require('validator');
|
|||||||
const jwt = require('jsonwebtoken');
|
const jwt = require('jsonwebtoken');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
|
|
||||||
const tools = require('../tools/general');
|
const tools = require('../tools/general');
|
||||||
|
|
||||||
const {Settings} = require('../models/settings');
|
const {Settings} = require('../models/settings');
|
||||||
@@ -571,7 +570,7 @@ UserSchema.statics.findByCredentials = function(idapp, username, password, pwdcr
|
|||||||
$or: [
|
$or: [
|
||||||
{deleted: {$exists: false}},
|
{deleted: {$exists: false}},
|
||||||
{deleted: {$exists: true, $eq: false}}],
|
{deleted: {$exists: true, $eq: false}}],
|
||||||
}).lean();
|
});
|
||||||
} else {
|
} else {
|
||||||
return !user.deleted || (user.deleted && user.subaccount) ? user : null;
|
return !user.deleted || (user.deleted && user.subaccount) ? user : null;
|
||||||
}
|
}
|
||||||
@@ -582,10 +581,10 @@ UserSchema.statics.findByCredentials = function(idapp, username, password, pwdcr
|
|||||||
pwd = user.password;
|
pwd = user.password;
|
||||||
|
|
||||||
if (pwdcrypted) {
|
if (pwdcrypted) {
|
||||||
if (pwd === user.password){
|
if (pwd === user.password) {
|
||||||
return user
|
return user;
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -664,6 +663,7 @@ UserSchema.statics.getUserShortDataByUsername = async function(
|
|||||||
verified_email: 1,
|
verified_email: 1,
|
||||||
verified_by_aportador: 1,
|
verified_by_aportador: 1,
|
||||||
'profile.teleg_id': 1,
|
'profile.teleg_id': 1,
|
||||||
|
'profile.username_telegram': 1,
|
||||||
// 'profile.saw_zoom_presentation': 1,
|
// 'profile.saw_zoom_presentation': 1,
|
||||||
'profile.ask_zoom_partecipato': 1,
|
'profile.ask_zoom_partecipato': 1,
|
||||||
'profile.qualified': 1,
|
'profile.qualified': 1,
|
||||||
@@ -907,7 +907,6 @@ UserSchema.statics.setVerifiedByAportador = async function(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
UserSchema.statics.setnotask_verif = async function(
|
UserSchema.statics.setnotask_verif = async function(
|
||||||
@@ -1071,6 +1070,55 @@ UserSchema.statics.findByLinkTokenforgot = function(idapp, email, tokenforgot) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UserSchema.statics.createNewRequestPwd = function(idapp, email) {
|
||||||
|
const User = this;
|
||||||
|
|
||||||
|
const sendemail = require('../sendemail');
|
||||||
|
|
||||||
|
return User.findByEmail(idapp, email).then(async (user) => {
|
||||||
|
if (!user) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// Creo il tokenforgot
|
||||||
|
user.tokenforgot = jwt.sign(user._id.toHexString(), process.env.SIGNCODE).
|
||||||
|
toString();
|
||||||
|
user.date_tokenforgot = new Date();
|
||||||
|
user.lasttimeonline = new Date();
|
||||||
|
return user.save().then(async () => {
|
||||||
|
await sendemail.sendEmail_RequestNewPassword(user.lang, user, user.email, user.idapp, user.tokenforgot);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
UserSchema.statics.createNewRequestPwdByUsernameAndGetLink = async function(idapp, username) {
|
||||||
|
const User = this;
|
||||||
|
|
||||||
|
const user = await User.findOne({
|
||||||
|
idapp,
|
||||||
|
username,
|
||||||
|
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||||
|
});
|
||||||
|
|
||||||
|
if (user) {
|
||||||
|
// Creo il tokenforgot
|
||||||
|
user.tokenforgot = jwt.sign(user._id.toHexString(), process.env.SIGNCODE).
|
||||||
|
toString();
|
||||||
|
user.date_tokenforgot = new Date();
|
||||||
|
user.lasttimeonline = new Date();
|
||||||
|
|
||||||
|
return user.save().then(() => {
|
||||||
|
return tools.getlinkRequestNewPassword(idapp, user.email, user.tokenforgot);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
UserSchema.statics.findByEmail = function(idapp, email, onlyifVerifiedByAportador) {
|
UserSchema.statics.findByEmail = function(idapp, email, onlyifVerifiedByAportador) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
@@ -1976,7 +2024,7 @@ UserSchema.statics.notAsk_VerifByUsername = async function(idapp, username) {
|
|||||||
idapp, username,
|
idapp, username,
|
||||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||||
}, {'notask_verif': 1}).lean().then((rec) => {
|
}, {'notask_verif': 1}).lean().then((rec) => {
|
||||||
return (!!rec && rec.notask_verif) ? true: false;
|
return (!!rec && rec.notask_verif) ? true : false;
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.error('notAsk_VerifByUsername', e);
|
console.error('notAsk_VerifByUsername', e);
|
||||||
return false;
|
return false;
|
||||||
@@ -2052,7 +2100,6 @@ UserSchema.statics.setUsernameTelegram = async function(
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
UserSchema.statics.SetLang = async function(idapp, id, lang) {
|
UserSchema.statics.SetLang = async function(idapp, id, lang) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
@@ -2155,7 +2202,6 @@ UserSchema.statics.getNameSurnameById = async function(idapp, userId) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
UserSchema.statics.getusersManagers = async function(idapp) {
|
UserSchema.statics.getusersManagers = async function(idapp) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
@@ -2219,11 +2265,10 @@ UserSchema.statics.getUsersTelegALL = async function(idapp, username) {
|
|||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
if (!!username) {
|
if (!!username) {
|
||||||
return User.find({idapp, username, 'profile.teleg_id': {$gt: 0}})
|
return User.find({idapp, username, 'profile.teleg_id': {$gt: 0}}).lean();
|
||||||
.lean()
|
then((arrrec) => {
|
||||||
then((arrrec) => {
|
return (!!arrrec) ? arrrec : null;
|
||||||
return (!!arrrec) ? arrrec : null;
|
}).
|
||||||
}).
|
|
||||||
catch((e) => {
|
catch((e) => {
|
||||||
console.error('getUsersTelegALL', e);
|
console.error('getUsersTelegALL', e);
|
||||||
});
|
});
|
||||||
@@ -2315,8 +2360,8 @@ UserSchema.statics.getFieldsForSearch = function() {
|
|||||||
{field: 'profile.link_payment', type: tools.FieldType.string},
|
{field: 'profile.link_payment', type: tools.FieldType.string},
|
||||||
{field: 'profile.teleg_id', type: tools.FieldType.number},
|
{field: 'profile.teleg_id', type: tools.FieldType.number},
|
||||||
{field: 'profile.username_telegram', type: tools.FieldType.string},
|
{field: 'profile.username_telegram', type: tools.FieldType.string},
|
||||||
{field: 'ipaddr', type: tools.FieldType.string}
|
{field: 'ipaddr', type: tools.FieldType.string},
|
||||||
];
|
];
|
||||||
//{field: 'aportador_solidario', type: tools.FieldType.string}
|
//{field: 'aportador_solidario', type: tools.FieldType.string}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2555,6 +2600,32 @@ UserSchema.statics.getUsersTelegramAttivo = async function(idapp) {
|
|||||||
return User.count(myfind);
|
return User.count(myfind);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UserSchema.statics.getUsersAutorizzati = async function(idapp) {
|
||||||
|
const User = this;
|
||||||
|
|
||||||
|
const myfind = {
|
||||||
|
idapp,
|
||||||
|
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||||
|
'profile.teleg_id': {$gt: 0},
|
||||||
|
verified_by_aportador: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
return User.count(myfind);
|
||||||
|
};
|
||||||
|
|
||||||
|
UserSchema.statics.getUsersAutorizzare = async function(idapp) {
|
||||||
|
const User = this;
|
||||||
|
|
||||||
|
const myfind = {
|
||||||
|
idapp,
|
||||||
|
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||||
|
'profile.teleg_id': {$gt: 0},
|
||||||
|
$or: [{verified_by_aportador: {$exists: false}}, {verified_by_aportador: {$exists: true, $eq: false}}],
|
||||||
|
};
|
||||||
|
|
||||||
|
return User.count(myfind);
|
||||||
|
};
|
||||||
|
|
||||||
UserSchema.statics.getUsersTelegramPending = async function(idapp) {
|
UserSchema.statics.getUsersTelegramPending = async function(idapp) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
@@ -2692,7 +2763,7 @@ UserSchema.statics.calculateStat = async function(idapp, username) {
|
|||||||
|
|
||||||
const numGroups = await MyGroup.countDocuments({idapp});
|
const numGroups = await MyGroup.countDocuments({idapp});
|
||||||
|
|
||||||
let numByTab = {}
|
let numByTab = {};
|
||||||
|
|
||||||
const globalTables = require('../tools/globalTables');
|
const globalTables = require('../tools/globalTables');
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ router.post(process.env.LINKVERIF_REG, (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Faccio richiesta di una Nuova Password
|
// Faccio richiesta di una Nuova Password
|
||||||
router.post(process.env.LINK_REQUEST_NEWPASSWORD, (req, res) => {
|
router.post(process.env.LINK_REQUEST_NEWPASSWORD, async (req, res) => {
|
||||||
const body = _.pick(req.body, ['idapp', 'email']);
|
const body = _.pick(req.body, ['idapp', 'email']);
|
||||||
const idapp = body.idapp;
|
const idapp = body.idapp;
|
||||||
const email = body.email.toLowerCase().trim();
|
const email = body.email.toLowerCase().trim();
|
||||||
@@ -154,28 +154,21 @@ router.post(process.env.LINK_REQUEST_NEWPASSWORD, (req, res) => {
|
|||||||
'POST ' + process.env.LINK_REQUEST_NEWPASSWORD + ' idapp= ' + idapp +
|
'POST ' + process.env.LINK_REQUEST_NEWPASSWORD + ' idapp= ' + idapp +
|
||||||
' email = ' + email);
|
' email = ' + email);
|
||||||
|
|
||||||
User.findByEmail(idapp, email).then(async (user) => {
|
|
||||||
if (!user) {
|
try {
|
||||||
await tools.snooze(5000);
|
const ris = await User.createNewRequestPwd(idapp, email);
|
||||||
|
if (ris) {
|
||||||
|
res.send({code: server_constants.RIS_CODE_OK, msg: ''});
|
||||||
|
} else {
|
||||||
|
tools.snooze(5000);
|
||||||
return res.status(200).
|
return res.status(200).
|
||||||
send({code: server_constants.RIS_CODE_EMAIL_NOT_EXIST, msg: ''});
|
send({code: server_constants.RIS_CODE_EMAIL_NOT_EXIST, msg: ''});
|
||||||
} else {
|
|
||||||
// Creo il tokenforgot
|
|
||||||
user.tokenforgot = jwt.sign(user._id.toHexString(), process.env.SIGNCODE).
|
|
||||||
toString();
|
|
||||||
user.date_tokenforgot = new Date();
|
|
||||||
user.lasttimeonline = new Date();
|
|
||||||
user.save().then(async () => {
|
|
||||||
await sendemail.sendEmail_RequestNewPassword(res.locale, user,
|
|
||||||
user.email, user.idapp, user.tokenforgot);
|
|
||||||
res.send({code: server_constants.RIS_CODE_OK, msg: ''});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}).catch((e) => {
|
} catch(e) {
|
||||||
console.log(process.env.LINK_REQUEST_NEWPASSWORD, e.message);
|
console.log(process.env.LINK_REQUEST_NEWPASSWORD, e.message);
|
||||||
res.status(400).send();
|
res.status(400).send();
|
||||||
res.send({code: server_constants.RIS_CODE_ERR, msg: e});
|
res.send({code: server_constants.RIS_CODE_ERR, msg: e});
|
||||||
});
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,8 @@ router.post('/send', authenticate, async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
params.typesend = shared_consts.TypeSend.PUSH_NOTIFICATION;
|
if (params.typesend === 0)
|
||||||
|
params.typesend = shared_consts.TypeSend.PUSH_NOTIFICATION;
|
||||||
params.sendreally = true;
|
params.sendreally = true;
|
||||||
const ris = await globalTables.SendMsgToParam(idapp, params);
|
const ris = await globalTables.SendMsgToParam(idapp, params);
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ router.post('/load', async (req, res) => {
|
|||||||
// num_imbarcati: 0,
|
// num_imbarcati: 0,
|
||||||
// email_non_verif: await User.getEmailNotVerified(idapp),
|
// email_non_verif: await User.getEmailNotVerified(idapp),
|
||||||
num_teleg_attivo: await User.getUsersTelegramAttivo(idapp),
|
num_teleg_attivo: await User.getUsersTelegramAttivo(idapp),
|
||||||
|
num_autorizzati: await User.getUsersAutorizzati(idapp),
|
||||||
|
num_autorizzare: await User.getUsersAutorizzare(idapp),
|
||||||
num_teleg_pending: await User.getUsersTelegramPending(idapp),
|
num_teleg_pending: await User.getUsersTelegramPending(idapp),
|
||||||
// num_qualificati: await User.getNumUsersQualified(idapp, 2),
|
// num_qualificati: await User.getNumUsersQualified(idapp, 2),
|
||||||
// num_requisiti: await User.getNumUsersQualified(idapp, 0),
|
// num_requisiti: await User.getNumUsersQualified(idapp, 0),
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ router.post('/', authenticate, (req, res) => {
|
|||||||
|
|
||||||
if (myitem === null) {
|
if (myitem === null) {
|
||||||
myitem = subscriptionModel;
|
myitem = subscriptionModel;
|
||||||
tools.mylogshow('Subscription NOT EXISTED IN DB, so I use this created!', myitem)
|
tools.mylogshow('Subscription NOT EXISTED IN DB, so I use this created!')
|
||||||
} else {
|
} else {
|
||||||
myitem.endpoint = subscriptionModel.endpoint;
|
myitem.endpoint = subscriptionModel.endpoint;
|
||||||
myitem.keys = subscriptionModel.keys;
|
myitem.keys = subscriptionModel.keys;
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ router.post('/', async (req, res) => {
|
|||||||
await User.setaportador_solidario(user.idapp, user.username,
|
await User.setaportador_solidario(user.idapp, user.username,
|
||||||
user.aportador_solidario);
|
user.aportador_solidario);
|
||||||
|
|
||||||
const myuser = await User.findOne({_id: trovarec._id}).lean();
|
const myuser = await User.findOne({_id: trovarec._id});
|
||||||
if (myuser) {
|
if (myuser) {
|
||||||
|
|
||||||
await telegrambot.askConfirmationUser(myuser.idapp, shared_consts.CallFunz.REGISTRATION, myuser);
|
await telegrambot.askConfirmationUser(myuser.idapp, shared_consts.CallFunz.REGISTRATION, myuser);
|
||||||
|
|||||||
@@ -177,10 +177,6 @@ module.exports = {
|
|||||||
const strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINKVERIF_REG + `?idapp=${idapp}&idlink=${idreg}`;
|
const strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINKVERIF_REG + `?idapp=${idapp}&idlink=${idreg}`;
|
||||||
return strlinkreg;
|
return strlinkreg;
|
||||||
},
|
},
|
||||||
getlinkRequestNewPassword: function (idapp, email, tokenforgot) {
|
|
||||||
const strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINK_UPDATE_PASSWORD + `?idapp=${idapp}&email=${email}&tokenforgot=${tokenforgot}`;
|
|
||||||
return strlinkreg;
|
|
||||||
},
|
|
||||||
sendEmail_Registration: async function (lang, emailto, user, idapp, idreg) {
|
sendEmail_Registration: async function (lang, emailto, user, idapp, idreg) {
|
||||||
|
|
||||||
// console.log('idapp', idapp, tools.getNomeAppByIdApp(idapp));
|
// console.log('idapp', idapp, tools.getNomeAppByIdApp(idapp));
|
||||||
@@ -258,7 +254,7 @@ module.exports = {
|
|||||||
dataemail: await this.getdataemail(idapp),
|
dataemail: await this.getdataemail(idapp),
|
||||||
locale: lang,
|
locale: lang,
|
||||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||||
strlinksetpassword: this.getlinkRequestNewPassword(idapp, emailto, tokenforgot),
|
strlinksetpassword: tools.getlinkRequestNewPassword(idapp, emailto, tokenforgot),
|
||||||
emailto: emailto,
|
emailto: emailto,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ const Menu = {
|
|||||||
AIUTO: '🔮 Help',
|
AIUTO: '🔮 Help',
|
||||||
ALTRO: emoji.get('newspaper') + ' Altro',
|
ALTRO: emoji.get('newspaper') + ' Altro',
|
||||||
SETPICPROFILE: '🖼 SetPicProfile',
|
SETPICPROFILE: '🖼 SetPicProfile',
|
||||||
|
RESETPWD: '🔑 SetResetPwd',
|
||||||
// MSG_TO_NAVE: emoji.get('incoming_envelope') + 'Msg_to_Navi',
|
// MSG_TO_NAVE: emoji.get('incoming_envelope') + 'Msg_to_Navi',
|
||||||
// MSG_NO_7_REQ: emoji.get('incoming_envelope') + 'No 7 Req.',
|
// MSG_NO_7_REQ: emoji.get('incoming_envelope') + 'No 7 Req.',
|
||||||
// MSG_NO_9_REQ: emoji.get('incoming_envelope') + 'No 9 Req',
|
// MSG_NO_9_REQ: emoji.get('incoming_envelope') + 'No 9 Req',
|
||||||
@@ -490,12 +491,14 @@ const txt = {
|
|||||||
'👉🏻 3.Premi su <b>Username</b> nella sezione account.\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' +
|
'👉🏻 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' +
|
'👉🏻 5. Per confermare premi sull\'icona con la spunta in alto a destra.\n' +
|
||||||
'🏁 Infine scrivi OK su questa chat. \n\n' +
|
'🏁 Infine scrivi OK su questa chat. \n' +
|
||||||
|
'(Se non riesci clicca qui per la guida: www.nigiara.it/telegram/come-impostare-uno-username-su-telegram.htm) \n\n' +
|
||||||
'💬 In questo modo le persone potranno contattarti dalla APP cliccando sull\'icona di Telegram, presente nel tuo profilo.',
|
'💬 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' +
|
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 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.',
|
'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_SET_PICPROFILE: '🖼 Abbiamo impostato <b>la tua foto del Profilo</b>, copiandola dalla foto profilo di Telegram. Potrai comunque cambiarla dalla APP (%s)',
|
||||||
|
MSG_RESETPWD: 'Clicca qui per impostare una nuova password per accedere alla APP:',
|
||||||
MSG_ERR_UNKNOWN_VERIFY_CODE: 'Errore durante il salvataggio sul Server. Riprovare piú tardi',
|
MSG_ERR_UNKNOWN_VERIFY_CODE: 'Errore durante il salvataggio sul Server. Riprovare piú tardi',
|
||||||
MSG_EXIT_TELEGRAM: 'L\'account è stato ora scollegato da questo Telegram BOT.',
|
MSG_EXIT_TELEGRAM: 'L\'account è stato ora scollegato da questo Telegram BOT.',
|
||||||
MSG_APORTADOR_USER_REGISTERED: emo.FIRE +
|
MSG_APORTADOR_USER_REGISTERED: emo.FIRE +
|
||||||
@@ -922,13 +925,13 @@ const MyTelegramBot = {
|
|||||||
await this.sendMsgTelegramToTheManagers(mylocalsconf.idapp, addtext + text);
|
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 = '') {
|
||||||
|
|
||||||
const cl = getclTelegByidapp(idapp);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const cl = getclTelegByidapp(idapp);
|
||||||
|
|
||||||
const langdest = myuser.lang;
|
const langdest = myuser.lang;
|
||||||
|
const telegid = myuser.profile.teleg_id;
|
||||||
|
|
||||||
let keyb = null;
|
let keyb = null;
|
||||||
let domanda = '';
|
let domanda = '';
|
||||||
@@ -936,12 +939,21 @@ const MyTelegramBot = {
|
|||||||
const struserinfomsg = tools.getUserInfoMsg(idapp, myuser);
|
const struserinfomsg = tools.getUserInfoMsg(idapp, myuser);
|
||||||
|
|
||||||
if (myfunc === shared_consts.CallFunz.REGISTRATION) {
|
if (myfunc === shared_consts.CallFunz.REGISTRATION) {
|
||||||
|
|
||||||
|
cl.setPhotoProfile(myuser, telegid, false);
|
||||||
|
|
||||||
|
const rismsg = await MsgTemplate.getMsgByLang(idapp, shared_consts.TypeMsgTemplate.MSG_BENVENUTO, myuser.lang);
|
||||||
|
const rismsg2 = await MsgTemplate.getMsgByLang(idapp, shared_consts.TypeMsgTemplate.MS_SHARE_LINK, myuser.lang);
|
||||||
|
|
||||||
|
await cl.sendMsgLog(telegid, rismsg.body);
|
||||||
|
await cl.sendMsg(telegid, rismsg2.body);
|
||||||
|
|
||||||
userDest = myuser.aportador_solidario;
|
userDest = myuser.aportador_solidario;
|
||||||
const notask_verif = await User.notAsk_VerifByUsername(idapp, userDest);
|
const notask_verif = await User.notAsk_VerifByUsername(idapp, userDest);
|
||||||
|
|
||||||
if (notask_verif) {
|
if (notask_verif) {
|
||||||
// Non chiedi la verifica Registrazione
|
// Non chiedi la verifica Registrazione
|
||||||
setVerifiedReg(myuser.idapp, myuser.lang, myuser.username, userDest);
|
await setVerifiedReg(myuser.idapp, myuser.lang, myuser.username, userDest);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
domanda = getstr(langdest, 'MSG_APORTADOR_ASK_CONFIRM') + '<br>' + struserinfomsg;
|
domanda = getstr(langdest, 'MSG_APORTADOR_ASK_CONFIRM') + '<br>' + struserinfomsg;
|
||||||
@@ -968,7 +980,7 @@ const MyTelegramBot = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '🚫 Rifiuta ' + myuser.username,
|
text: '🚫 Rifiuta ' + myuser.username,
|
||||||
callback_data: InlineConferma.RISPOSTA_NO + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + groupid ,
|
callback_data: InlineConferma.RISPOSTA_NO + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + groupid,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -1276,8 +1288,7 @@ async function sendMsgTelegramToTheAdmin(idapp, text, msg) {
|
|||||||
async function setVerifiedReg(idapp, lang, usernameorig, usernameDest) {
|
async function setVerifiedReg(idapp, lang, usernameorig, usernameDest) {
|
||||||
try {
|
try {
|
||||||
await User.setVerifiedByAportador(idapp, usernameorig, true);
|
await User.setVerifiedByAportador(idapp, usernameorig, true);
|
||||||
await User.setFriendsCmd(idapp, usernameorig, usernameDest,
|
await User.setFriendsCmd(idapp, usernameorig, usernameDest, shared_consts.FRIENDSCMD.SETFRIEND);
|
||||||
shared_consts.FRIENDSCMD.SETFRIEND);
|
|
||||||
|
|
||||||
const msgDest = printf(getstr(lang, 'MSG_APORTADOR_CONFIRMED'),
|
const msgDest = printf(getstr(lang, 'MSG_APORTADOR_CONFIRMED'),
|
||||||
`${usernameorig}`, usernameDest);
|
`${usernameorig}`, usernameDest);
|
||||||
@@ -1510,15 +1521,14 @@ class Telegram {
|
|||||||
|
|
||||||
if (rec.status === Status.VERIFIED) {
|
if (rec.status === Status.VERIFIED) {
|
||||||
if (rec.user) {
|
if (rec.user) {
|
||||||
if (rec.user.profile.username_telegram && msg.from.id > 0 &&
|
if (rec.user.profile.username_telegram && msg.from.id > 0 && !msg.from.username) {
|
||||||
!msg.from.username) {
|
|
||||||
rec.user.profile.username_telegram = msg.from.username;
|
rec.user.profile.username_telegram = msg.from.username;
|
||||||
await User.setUsernameTelegram(this.idapp, rec.user._id,
|
await User.setUsernameTelegram(this.idapp, rec.user._id,
|
||||||
msg.from.username || '', msg.from.first_name || '',
|
msg.from.username || '', msg.from.first_name || '',
|
||||||
msg.from.last_name || '');
|
msg.from.last_name || '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rec.user.profile.username_telegram && msg.from.username) {
|
if (!rec.user.profile.username_telegram && !!msg.from.username) {
|
||||||
rec.user.profile.username_telegram = msg.from.username;
|
rec.user.profile.username_telegram = msg.from.username;
|
||||||
await User.setUsernameTelegram(this.idapp, rec.user._id,
|
await User.setUsernameTelegram(this.idapp, rec.user._id,
|
||||||
msg.from.username || '', msg.from.first_name || '',
|
msg.from.username || '', msg.from.first_name || '',
|
||||||
@@ -1527,7 +1537,7 @@ class Telegram {
|
|||||||
printf(getstr(rec.user.lang, 'MSG_SET_USERNAME_OK')));
|
printf(getstr(rec.user.lang, 'MSG_SET_USERNAME_OK')));
|
||||||
|
|
||||||
if (!rec.user.verified_by_aportador) {
|
if (!rec.user.verified_by_aportador) {
|
||||||
this.askConfirmationUser(this.idapp, shared_consts.CallFunz.REGISTRATION, rec.user);
|
MyTelegramBot.askConfirmationUser(this.idapp, shared_consts.CallFunz.REGISTRATION, rec.user);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1843,7 +1853,9 @@ class Telegram {
|
|||||||
} else if (cmd1.toLowerCase() === Menu.MSG_TO_USER) {
|
} else if (cmd1.toLowerCase() === Menu.MSG_TO_USER) {
|
||||||
await this.menumsg_A_Utente(msg);
|
await this.menumsg_A_Utente(msg);
|
||||||
} else if (testo === Menu.SETPICPROFILE) {
|
} else if (testo === Menu.SETPICPROFILE) {
|
||||||
await this.setPhotoProfile(rec, msg);
|
await this.setPhotoProfile(rec.user, msg.from.id);
|
||||||
|
} else if (testo === Menu.RESETPWD) {
|
||||||
|
await this.setResetPwd(rec, msg);
|
||||||
} else if (this.isSelMenu(msg, testo, 'INDIETRO') ||
|
} else if (this.isSelMenu(msg, testo, 'INDIETRO') ||
|
||||||
(testo === Menu.it.INDIETRO)) {
|
(testo === Menu.it.INDIETRO)) {
|
||||||
await this.msgScegliMenu(msg);
|
await this.msgScegliMenu(msg);
|
||||||
@@ -2385,6 +2397,13 @@ class Telegram {
|
|||||||
return this.arrUsers.find((rec) => rec.username_bo === username);
|
return this.arrUsers.find((rec) => rec.username_bo === username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setRecByUsername(username, myrec) {
|
||||||
|
const ind = this.arrUsers.findIndex((rec) => rec.username_bo === username);
|
||||||
|
if (ind >= 0) {
|
||||||
|
this.arrUsers[ind] = myrec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
deleteRecInMem(msg) {
|
deleteRecInMem(msg) {
|
||||||
this.arrUsers = this.arrUsers.filter(
|
this.arrUsers = this.arrUsers.filter(
|
||||||
(rec) => rec.id !== this.getchatid(msg));
|
(rec) => rec.id !== this.getchatid(msg));
|
||||||
@@ -2496,35 +2515,24 @@ class Telegram {
|
|||||||
rec.status = Status.VERIFIED;
|
rec.status = Status.VERIFIED;
|
||||||
rec.datemenu_updated = null;
|
rec.datemenu_updated = null;
|
||||||
rec.menuDb = null;
|
rec.menuDb = null;
|
||||||
await User.SetTelegramIdSuccess(this.idapp, user._id, msg.from.id).then(async (recuser) => {
|
const recuser = await User.SetTelegramIdSuccess(this.idapp, user._id, msg.from.id);
|
||||||
|
if (recuser) {
|
||||||
|
console.log(recuser.username, ' SI E\' VERIFICATO CON TELEGRAM !');
|
||||||
|
let username = recuser.name;
|
||||||
|
|
||||||
const rismsg = await MsgTemplate.getMsgByLang(this.idapp, shared_consts.TypeMsgTemplate.MSG_BENVENUTO, recuser.lang);
|
// this.sendMsgLog(msg.from.id, printf(getstr(recuser.lang, 'MSG_VERIFY_OK'), username, tools.getHostByIdApp(this.idapp)));
|
||||||
const rismsg2 = await MsgTemplate.getMsgByLang(this.idapp, shared_consts.TypeMsgTemplate.MS_SHARE_LINK, recuser.lang);
|
if (!!msg.from.username) {
|
||||||
|
await MyTelegramBot.askConfirmationUser(this.idapp, shared_consts.CallFunz.REGISTRATION, recuser);
|
||||||
return {recuser, rismsg, rismsg2};
|
|
||||||
|
|
||||||
}).then(async ({recuser, rismsg, rismsg2}) => {
|
|
||||||
|
|
||||||
if (recuser) {
|
|
||||||
console.log(recuser.username, ' SI E\' VERIFICATO CON TELEGRAM !');
|
|
||||||
this.setPhotoProfile(rec, msg, false);
|
|
||||||
let username = recuser.name;
|
|
||||||
|
|
||||||
// this.sendMsgLog(msg.from.id, printf(getstr(recuser.lang, 'MSG_VERIFY_OK'), username, tools.getHostByIdApp(this.idapp)));
|
|
||||||
await this.sendMsgLog(msg.from.id, rismsg.body);
|
|
||||||
await this.sendMsg(msg.from.id, rismsg2.body);
|
|
||||||
|
|
||||||
if (msg.from.username) {
|
|
||||||
MyTelegramBot.askConfirmationUser(this.idapp, shared_consts.CallFunz.REGISTRATION, recuser);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.checkIfUsernameTelegramSet(msg, recuser);
|
|
||||||
// local_sendMsgTelegramToTheManagers(this.idapp, recuser.name + ' ' + recuser.surname + ' si è Verificato a Telegram BOT! (lang=' + recuser.lang + ')' + emo.STARS, msg);
|
|
||||||
} else {
|
} else {
|
||||||
this.sendMsgLog(msg.from.id, getstr(this.getlang(msg), 'MSG_ERR_UNKNOWN_VERIFY_CODE'));
|
console.log(' ... MA GLI MANCA L\'USERNAME TELEGRAM !! ');
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
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.sendMsgLog(msg.from.id, getstr(this.getlang(msg), 'MSG_ERR_UNKNOWN_VERIFY_CODE'));
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (rec.retry < 2) {
|
if (rec.retry < 2) {
|
||||||
rec.retry++;
|
rec.retry++;
|
||||||
@@ -3079,7 +3087,7 @@ class Telegram {
|
|||||||
shared_consts.VISIB_ONLYIF_VERIFIED, isVerified))
|
shared_consts.VISIB_ONLYIF_VERIFIED, isVerified))
|
||||||
) {
|
) {
|
||||||
rec.active_mem = true;
|
rec.active_mem = true;
|
||||||
if (rec.main) {
|
if (true) {
|
||||||
lang = rec.lang;
|
lang = rec.lang;
|
||||||
if (!arrlang[rec.lang])
|
if (!arrlang[rec.lang])
|
||||||
arrlang[rec.lang] = {menu: []};
|
arrlang[rec.lang] = {menu: []};
|
||||||
@@ -3152,8 +3160,9 @@ class Telegram {
|
|||||||
return recdb.value;
|
return recdb.value;
|
||||||
} else if (recdb.type === shared_consts.BOTTYPE_PAGE) {
|
} else if (recdb.type === shared_consts.BOTTYPE_PAGE) {
|
||||||
if (tools.isNumber(recdb.value)) {
|
if (tools.isNumber(recdb.value)) {
|
||||||
recdb.pagenow = parseInt(recdb.value);
|
recuser.pagenow = parseInt(recdb.value);
|
||||||
recdb.pageChange = true;
|
recuser.pageChange = true;
|
||||||
|
// this.setRecByUsername(recuser.username, recuser);
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
} else if (recdb.type === shared_consts.BOTTYPE_MENU) {
|
} else if (recdb.type === shared_consts.BOTTYPE_MENU) {
|
||||||
@@ -3329,6 +3338,7 @@ class Telegram {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error sendMsg', e);
|
console.error('Error sendMsg', e);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3354,18 +3364,35 @@ class Telegram {
|
|||||||
return mymenuout;
|
return mymenuout;
|
||||||
}
|
}
|
||||||
|
|
||||||
async setPhotoProfile(rec, msg, showmsg = true) {
|
async setResetPwd(rec, msg) {
|
||||||
try {
|
try {
|
||||||
if (rec.user) {
|
if (rec.user) {
|
||||||
const idapp = this.idapp;
|
const idapp = this.idapp;
|
||||||
const bot = this.bot;
|
|
||||||
const username = rec.user.username;
|
const username = rec.user.username;
|
||||||
const lang = rec.user.lang;
|
const lang = rec.user.lang;
|
||||||
|
|
||||||
|
const link = await User.createNewRequestPwdByUsernameAndGetLink(idapp, username);
|
||||||
|
if (link) {
|
||||||
|
local_sendMsgTelegram(idapp, username, getstr(lang, 'MSG_RESETPWD') + '\n' + link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Err', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async setPhotoProfile(user, telegid, showmsg = true) {
|
||||||
|
try {
|
||||||
|
if (user) {
|
||||||
|
const idapp = this.idapp;
|
||||||
|
const bot = this.bot;
|
||||||
|
const username = user.username;
|
||||||
|
const lang = user.lang;
|
||||||
const token = this.token;
|
const token = this.token;
|
||||||
const editprofile = tools.getHostByIdApp(idapp, true) + '/editprofile';
|
const editprofile = tools.getHostByIdApp(idapp, true) + '/editprofile';
|
||||||
let myfileprofile = tools.getdirByIdApp(idapp, true) +
|
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);
|
let user_profile = bot.getUserProfilePhotos(telegid);
|
||||||
user_profile.then(function(res) {
|
user_profile.then(function(res) {
|
||||||
if (res.photos[0]) {
|
if (res.photos[0]) {
|
||||||
var file_id = res.photos[0][2].file_id;
|
var file_id = res.photos[0][2].file_id;
|
||||||
@@ -3390,9 +3417,7 @@ class Telegram {
|
|||||||
then((ris) => {
|
then((ris) => {
|
||||||
// console.log('4) sendMsg picprofile Copied !');
|
// console.log('4) sendMsg picprofile Copied !');
|
||||||
if (showmsg) {
|
if (showmsg) {
|
||||||
local_sendMsgTelegram(idapp, username,
|
local_sendMsgTelegram(idapp, username, printf(getstr(lang, 'MSG_SET_PICPROFILE'), editprofile));
|
||||||
printf(getstr(lang, 'MSG_SET_PICPROFILE'),
|
|
||||||
editprofile));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// console.log('scaricato');
|
// console.log('scaricato');
|
||||||
|
|||||||
@@ -816,7 +816,7 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log('ERROR: sendNotificationToUser', error);
|
console.log('ERROR: sendNotificationToUser', error.data.body ? error.data.body : error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// q.allSettled(parallelSubscriptionCalls).then((pushResults) => {
|
// q.allSettled(parallelSubscriptionCalls).then((pushResults) => {
|
||||||
@@ -941,7 +941,7 @@ module.exports = {
|
|||||||
objmsg.tag = 'reqgroups';
|
objmsg.tag = 'reqgroups';
|
||||||
|
|
||||||
sendnotif = false; // non lo rimandare 2 volte !
|
sendnotif = false; // non lo rimandare 2 volte !
|
||||||
telegrambot.askConfirmationUser(idapp, shared_consts.CallFunz.RICHIESTA_GRUPPO, myuser, singleadmin.username, {groupid: group._id, groupname });
|
telegrambot.askConfirmationUser(idapp, shared_consts.CallFunz.RICHIESTA_GRUPPO, myuser, singleadmin.username, groupname, group._id);
|
||||||
|
|
||||||
} else if (cmd === shared_consts.GROUPSCMD.BLOCK_USER) {
|
} else if (cmd === shared_consts.GROUPSCMD.BLOCK_USER) {
|
||||||
objmsg.descr = printf(this.get__('RICHIESTA_BLOCCO_GRUPPO', lang),
|
objmsg.descr = printf(this.get__('RICHIESTA_BLOCCO_GRUPPO', lang),
|
||||||
@@ -1403,19 +1403,27 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
if (params.filterand.includes(shared_consts.FILTER_USER_NO_TELEGRAM_ID))
|
if (params.filterand.includes(shared_consts.FILTER_USER_NO_TELEGRAM_ID))
|
||||||
filtriadded.push({'profile.teleg_id': {$lt: 1}});
|
filtriadded.push({'profile.teleg_id': {$lt: 1}});
|
||||||
|
if (params.filterand.includes(shared_consts.FILTER_USER_SI_TELEGRAM_ID))
|
||||||
|
filtriadded.push({'profile.teleg_id': {$gt: 1}});
|
||||||
if (params.filterand.includes(
|
if (params.filterand.includes(
|
||||||
shared_consts.FILTER_USER_CODICE_AUTH_TELEGRAM))
|
shared_consts.FILTER_USER_CODICE_AUTH_TELEGRAM))
|
||||||
filtriadded.push({'profile.teleg_checkcode': {$gt: 1}});
|
filtriadded.push({'profile.teleg_checkcode': {$gt: 1}});
|
||||||
if (params.filterand.includes(
|
if (params.filterand.includes(
|
||||||
shared_consts.FILTER_USER_NO_EMAIL_VERIFICATA))
|
shared_consts.FILTER_USER_NO_EMAIL_VERIFICATA))
|
||||||
filtriadded.push({verified_email: false});
|
filtriadded.push({verified_email: false});
|
||||||
if (params.filterand.includes(
|
if (params.filterand.includes(shared_consts.FILTER_USER_NO_VERIFIED_APORTADOR))
|
||||||
shared_consts.FILTER_USER_NO_VERIFIED_APORTADOR))
|
|
||||||
filtriadded.push({
|
filtriadded.push({
|
||||||
$or: [
|
$or: [
|
||||||
{verified_by_aportador: {$exists: false}},
|
{verified_by_aportador: {$exists: false}},
|
||||||
{verified_by_aportador: {$exists: true, $eq: false}}],
|
{verified_by_aportador: {$exists: true, $eq: false}}],
|
||||||
|
|
||||||
|
});
|
||||||
|
if (params.filterand.includes(shared_consts.FILTER_USER_WITHOUT_USERNAME_TELEGRAM))
|
||||||
|
filtriadded.push({
|
||||||
|
$or: [
|
||||||
|
{'profile.username_telegram': {$exists: false}},
|
||||||
|
{'profile.username_telegram': {$exists: true, $eq: ''}}],
|
||||||
|
|
||||||
});
|
});
|
||||||
if (params.filterand.includes(shared_consts.FILTER_USER_NO_DREAM))
|
if (params.filterand.includes(shared_consts.FILTER_USER_NO_DREAM))
|
||||||
filtriadded.push({
|
filtriadded.push({
|
||||||
@@ -2756,5 +2764,9 @@ module.exports = {
|
|||||||
return msg;
|
return msg;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getlinkRequestNewPassword: function (idapp, email, tokenforgot) {
|
||||||
|
const strlinkreg = this.getHostByIdApp(idapp) + process.env.LINK_UPDATE_PASSWORD + `?idapp=${idapp}&email=${email}&tokenforgot=${tokenforgot}`;
|
||||||
|
return strlinkreg;
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -254,10 +254,12 @@ module.exports = {
|
|||||||
const mytitle = tools.convertSpecialTags(user, params.title);
|
const mytitle = tools.convertSpecialTags(user, params.title);
|
||||||
const mycontent = tools.convertSpecialTags(user, params.content);
|
const mycontent = tools.convertSpecialTags(user, params.content);
|
||||||
|
|
||||||
|
let risult = null;
|
||||||
|
|
||||||
if (params.sendreally) {
|
if (params.sendreally) {
|
||||||
if (tools.isBitActive(params.typesend,
|
if (tools.isBitActive(params.typesend,
|
||||||
shared_consts.TypeSend.PUSH_NOTIFICATION)) {
|
shared_consts.TypeSend.PUSH_NOTIFICATION)) {
|
||||||
tools.sendNotificationToUser(user._id, mytitle, mycontent, params.openUrl, params.openUrl2, params.tag,
|
risult = tools.sendNotificationToUser(user._id, mytitle, mycontent, params.openUrl, params.openUrl2, params.tag,
|
||||||
params.actions).
|
params.actions).
|
||||||
then(ris => {
|
then(ris => {
|
||||||
|
|
||||||
@@ -270,18 +272,27 @@ module.exports = {
|
|||||||
const telegid = user.profile.teleg_id;
|
const telegid = user.profile.teleg_id;
|
||||||
|
|
||||||
if (telegid > 0) {
|
if (telegid > 0) {
|
||||||
telegrambot.local_sendMsgTelegramByIdTelegram(idapp, telegid, mycontent);
|
risult = await telegrambot.local_sendMsgTelegramByIdTelegram(idapp, telegid, mycontent);
|
||||||
|
await tools.snooze(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
numrec++;
|
numrec++;
|
||||||
if (params.sendreally) {
|
if (params.sendreally && risult) {
|
||||||
nummsgsent++;
|
nummsgsent++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((nummsgsent % 100) === 0) {
|
||||||
|
console.log('Inviati ', nummsgsent, 'messaggi...')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nummsgsent > 0) {
|
||||||
|
console.log('FINE Invio Messaggi ! Inviati Totali: ', nummsgsent, 'su', numrec);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
numrec,
|
numrec,
|
||||||
nummsgsent,
|
nummsgsent,
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ module.exports = {
|
|||||||
FILTER_TO_MAKE_MEMBERSHIP_CARD: 524288,
|
FILTER_TO_MAKE_MEMBERSHIP_CARD: 524288,
|
||||||
FILTER_MEMBERSHIP_CARD_OK: 1048576,
|
FILTER_MEMBERSHIP_CARD_OK: 1048576,
|
||||||
FILTER_USER_NO_VERIFIED_APORTADOR: 2097152,
|
FILTER_USER_NO_VERIFIED_APORTADOR: 2097152,
|
||||||
|
FILTER_USER_SI_TELEGRAM_ID: 4194304,
|
||||||
|
FILTER_USER_WITHOUT_USERNAME_TELEGRAM: 8388608,
|
||||||
|
|
||||||
OPTIONS_SEARCH_ONLY_FULL_WORDS: 1,
|
OPTIONS_SEARCH_ONLY_FULL_WORDS: 1,
|
||||||
OPTIONS_SEARCH_USER_ONLY_FULL_WORDS: 2,
|
OPTIONS_SEARCH_USER_ONLY_FULL_WORDS: 2,
|
||||||
|
|||||||
Reference in New Issue
Block a user