la creazione dell'annuncio impiega troppo tempo (e le persone cliccavano su "Salva" più volte)...
This commit is contained in:
12
filelog.txt
12
filelog.txt
@@ -29,3 +29,15 @@ Gio 16/02 ORE 18:14: USER [paoloar77]: vai al sito
|
||||
Mar 06/06 ORE 19:39: USER [paoloar77]: ciaooooooooooooooooo
|
||||
|
||||
Mar 06/06 ORE 19:54: USER [paoloar77]: dasjdalksjdasdklasjkldasjlkdjasl
|
||||
|
||||
Sab 17/06 ORE 20:03: USER [paoloar77]: pro v adsasdasdaksdas
|
||||
|
||||
Dom 18/06 ORE 19:22: USER [paoloar77]: /start inv
|
||||
|
||||
Dom 18/06 ORE 19:42: USER [paoloar77]: /start inv
|
||||
|
||||
Dom 18/06 ORE 19:58: USER [paoloar77]: /start inv
|
||||
|
||||
Dom 18/06 ORE 19:59: USER [paoloar77]: /start inv
|
||||
|
||||
Dom 18/06 ORE 19:59: USER [paoloar77]: /start inv
|
||||
|
||||
@@ -11,3 +11,7 @@ Mar 06/06 ORE 19:49: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
|
||||
✅ SuryaArena2 è stato Abilitato correttamente (da paoloar77)!
|
||||
Mar 06/06 ORE 19:54: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
|
||||
dasjdalksjdasdklasjkldasjlkdjasl
|
||||
Sab 17/06 ORE 20:03: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
|
||||
pro v adsasdasdaksdas
|
||||
Dom 18/06 ORE 19:22: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
|
||||
/start inv
|
||||
@@ -397,16 +397,21 @@ AccountSchema.statics.getUserAccounts = async function (idapp, username) {
|
||||
|
||||
if (ris) {
|
||||
for (const account of ris) {
|
||||
try {
|
||||
const pendingtransactions = await SendNotif.getSumPendingTransactions(idapp, username, account.circuit.name);
|
||||
const saldopending = pendingtransactions.reduce((sum, rec) => sum + rec.extrarec.qty, 0);
|
||||
account.saldo -= saldopending;
|
||||
account.totTransato = account.totTransato || 0;
|
||||
} catch (e) {
|
||||
console.error('getUserAccounts 1) ', e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return ris;
|
||||
} catch (e) {
|
||||
console.error('e', e);
|
||||
console.error('getUserAccounts', e);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -478,7 +478,9 @@ router.post('/settable', authenticate, async (req, res) => {
|
||||
}
|
||||
|
||||
if (setnotif) {
|
||||
await SendNotif.createNewNotification(req, res, { groupnameDest, circuitnameDest }, params.table, myrec, typedir, typeid);
|
||||
const myreq = {...req};
|
||||
const myres = {...res};
|
||||
SendNotif.createNewNotification(myreq, myres, { groupnameDest, circuitnameDest }, params.table, myrec, typedir, typeid);
|
||||
}
|
||||
|
||||
if (params.table === 'circuits') {
|
||||
|
||||
@@ -5,7 +5,7 @@ const appTelegram = [tools.FREEPLANET, tools.RISO];
|
||||
const appTelegram_TEST = [tools.FREEPLANET, tools.RISO];
|
||||
const appTelegram_DEVELOP = [tools.RISO];
|
||||
|
||||
const appTelegramFinti = ['2', tools.CNM, tools.ARCADEI];
|
||||
const appTelegramFinti = ['2', tools.CNM];
|
||||
const appTelegramDest = [tools.FREEPLANET, tools.FREEPLANET];
|
||||
|
||||
const printf = require('util').format;
|
||||
@@ -143,6 +143,7 @@ MsgBot = {
|
||||
'grazie 😘',
|
||||
'grazie😘'],
|
||||
PRINCIPE_AZZURRO: ['principe azzurro'],
|
||||
START_INV: ['/start inv'],
|
||||
COSE_COVID: [
|
||||
'cos\'è il covid',
|
||||
'cosa è il covid',
|
||||
@@ -709,7 +710,7 @@ const MyTelegramBot = {
|
||||
MyForm = null) {
|
||||
|
||||
if (!idtelegram)
|
||||
return {text: ''};
|
||||
return { text: '' };
|
||||
|
||||
const cl = getclTelegByidapp(idapp);
|
||||
if (cl && idtelegram) {
|
||||
@@ -718,7 +719,7 @@ const MyTelegramBot = {
|
||||
chat_id, ripr_menuPrec);
|
||||
}
|
||||
|
||||
return {text: ''};
|
||||
return { text: '' };
|
||||
|
||||
},
|
||||
|
||||
@@ -1056,9 +1057,9 @@ const MyTelegramBot = {
|
||||
}
|
||||
return true;
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
sendMsgTelegramToTheManagersAndZoomeri: async function (
|
||||
sendMsgTelegramToTheManagersAndZoomeri: async function (
|
||||
idapp, text, onlyintofile, MyForm = null) {
|
||||
|
||||
tools.writeManagersLog(text);
|
||||
@@ -1076,8 +1077,8 @@ sendMsgTelegramToTheManagersAndZoomeri: async function (
|
||||
}
|
||||
return true;
|
||||
|
||||
},
|
||||
getMsgByTipoMsg: async function (mydata, lang, user, sonosognatore) {
|
||||
},
|
||||
getMsgByTipoMsg: async function (mydata, lang, user, sonosognatore) {
|
||||
if (!!mydata.msgextra) {
|
||||
return { body: mydata.msgextra, title: '' };
|
||||
}
|
||||
@@ -1145,16 +1146,16 @@ getMsgByTipoMsg: async function (mydata, lang, user, sonosognatore) {
|
||||
}
|
||||
|
||||
return { body: msg, title };
|
||||
},
|
||||
},
|
||||
|
||||
sendMsgTelegramToTheAdminAllSites: async function (text, senzaintestazione) {
|
||||
sendMsgTelegramToTheAdminAllSites: async function (text, senzaintestazione) {
|
||||
for (const idapp of this.getAppTelegram()) {
|
||||
text = text.replace('{appname}', tools.getNomeAppByIdApp(idapp));
|
||||
await this.sendMsgTelegramToTheAdmin(idapp, text, senzaintestazione);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
sendMsgTelegramToTheAdmin: async function (idapp, text, senzaintestazione) {
|
||||
sendMsgTelegramToTheAdmin: async function (idapp, text, senzaintestazione) {
|
||||
const usersmanagers = await User.getusersAdmin(idapp);
|
||||
|
||||
let intestaz = emo.ROBOT_FACE + '[BOT-ADMIN]' + emo.ADMIN + ': ';
|
||||
@@ -1172,9 +1173,9 @@ sendMsgTelegramToTheAdmin: async function (idapp, text, senzaintestazione) {
|
||||
}
|
||||
return true;
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
sendMsgTelegramToALL: async function (idapp, text) {
|
||||
sendMsgTelegramToALL: async function (idapp, text) {
|
||||
const usersall = await User.getUsersTelegALL(idapp);
|
||||
|
||||
if (usersall) {
|
||||
@@ -1184,9 +1185,9 @@ sendMsgTelegramToALL: async function (idapp, text) {
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
sendMsgTelegram: async function (
|
||||
sendMsgTelegram: async function (
|
||||
idapp, username, text, alsotomanagers = false, username_mitt = '') {
|
||||
const { User } = require('../models/user');
|
||||
|
||||
@@ -1210,14 +1211,12 @@ sendMsgTelegram: async function (
|
||||
}
|
||||
|
||||
return ris;
|
||||
},
|
||||
},
|
||||
|
||||
sendMsgTelegramByIdTelegram: async function (
|
||||
sendMsgTelegramByIdTelegram: async function (
|
||||
idapp, idtelegram, text, message_id, chat_id, ripr_menuPrec,
|
||||
MyForm = null) {
|
||||
|
||||
console.log('sendMsgTelegramByIdTelegram', text);
|
||||
|
||||
if (!idtelegram)
|
||||
return;
|
||||
|
||||
@@ -1229,24 +1228,24 @@ sendMsgTelegramByIdTelegram: async function (
|
||||
chat_id, ripr_menuPrec);
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
reloadMenuBot: async function (idapp) {
|
||||
reloadMenuBot: async function (idapp) {
|
||||
|
||||
const cl = getclTelegByidapp(idapp);
|
||||
if (cl) {
|
||||
return cl.updateMenuBot();
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
reloadSites: async function () {
|
||||
reloadSites: async function () {
|
||||
|
||||
tools.loadApps();
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
sendMsgFromSite: async function (idapp, user, params) {
|
||||
sendMsgFromSite: async function (idapp, user, params) {
|
||||
|
||||
try {
|
||||
let ris = {
|
||||
@@ -1288,9 +1287,9 @@ sendMsgFromSite: async function (idapp, user, params) {
|
||||
} catch (e) {
|
||||
console.error('sendMsgFromSite', e);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
sendMsgFromSiteToBotTelegram: async function (idapp, user, params) {
|
||||
sendMsgFromSiteToBotTelegram: async function (idapp, user, params) {
|
||||
|
||||
if (!params.typesend) {
|
||||
params.typesend = shared_consts.TypeSend.TELEGRAM;
|
||||
@@ -1298,7 +1297,7 @@ sendMsgFromSiteToBotTelegram: async function (idapp, user, params) {
|
||||
|
||||
return this.sendMsgFromSite(idapp, user, params);
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
@@ -1676,6 +1675,9 @@ class Telegram {
|
||||
} else if (MsgBot.PRINCIPE_AZZURRO.find(
|
||||
(rec) => testo.indexOf(rec) > -1)) {
|
||||
risp = 'Chissà... Forse si!\nAnche se meglio averne un altro di scorta, nel caso il Principe non sia disponibile.';
|
||||
} else if (MsgBot.START_INV.find(
|
||||
(rec) => testo.indexOf(rec) > -1)) {
|
||||
risp = 'Sei già registrato a RISO. Per accedere alla App, aprila dall\'icona sul tuo schermo, oppure vai su https://riso.app ed installa la App.\n\nSe hai dimenticato la password: \n clicca sul menu in basso su "⚒ Strumenti" e poi "🔑 Cambio Password"'
|
||||
} else if (MsgBot.COSE_COVID.find(
|
||||
(rec) => testo.indexOf(rec) > -1)) {
|
||||
risp = 'Un \'influenza più "grave", dovuta a paure e a fattori interiori di evoluzione, oltre ad una pulizia del corpo. ';
|
||||
@@ -3090,7 +3092,7 @@ class Telegram {
|
||||
status = this.getstatus(rec);
|
||||
if (testo === Menu.EXIT_TELEGRAM) {
|
||||
await this.menuExitToTelegram(msg);
|
||||
}else if (status === Status.WAITFOR_USERNAME_TELEGRAM && !this.selectMenuHelp(msg) && !this.selectMenuLang(msg)) {
|
||||
} else if (status === Status.WAITFOR_USERNAME_TELEGRAM && !this.selectMenuHelp(msg) && !this.selectMenuLang(msg)) {
|
||||
// await this.setUsernameBo(msg);
|
||||
await this.settotheDatabase(msg);
|
||||
} else if (status === Status.WAITFOR_USERNAME_INVITANTE && !this.selectMenuHelp(msg) && !this.selectMenuLang(msg)) {
|
||||
@@ -3530,9 +3532,11 @@ class Telegram {
|
||||
return 0;
|
||||
|
||||
if (process.env.LOCALE === '1') {
|
||||
if (id !== ADMIN_IDTELEGRAM_TEST)
|
||||
if (id !== ADMIN_IDTELEGRAM_TEST) {
|
||||
text = '[Msg da inviare ipoteticamente a : ' + id + ']' + '\n' + text;
|
||||
id = '12429864';
|
||||
}
|
||||
}
|
||||
|
||||
if (!!msg_id) {
|
||||
return this.modificaMsg(chat_id, msg_id, text);
|
||||
@@ -3565,7 +3569,7 @@ class Telegram {
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('<<< SEND MSG TELEGRAM: >>> ', text.substring(0, 100));
|
||||
console.log('<<< SEND MSG TELEGRAM: >>> [id=', id, ']', text.substring(0, 100));
|
||||
text = text.replace(/<br>/g, '\n');
|
||||
text = text.replace(/<br\/>/g, '\n');
|
||||
text = text.replace(/<div>/g, '');
|
||||
@@ -3656,7 +3660,10 @@ class Telegram {
|
||||
async sendMsgLog(id, text, menu, form, msg_id, chat_id, ripr_menuPrec) {
|
||||
|
||||
const rec = this.getRecInMemById(id);
|
||||
const username = rec ? rec.username_bo : '';
|
||||
let username = rec ? rec.username_bo : '';
|
||||
if (!username) {
|
||||
|
||||
}
|
||||
|
||||
console.log('Msg inviato a ', username, '(', id, ')', text);
|
||||
return await this.sendMsg(id, text, menu, form, msg_id, chat_id, ripr_menuPrec);
|
||||
|
||||
@@ -1452,7 +1452,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
checkUserOk(userpassed, userauth, res) {
|
||||
this.mylog('checkUserOk', userpassed, userauth);
|
||||
// this.mylog('checkUserOk', userpassed, userauth);
|
||||
if (String(userpassed) !== String(userauth)) {
|
||||
// I'm trying to write something not mine!
|
||||
this.mylog('I\'m trying to write something not mine!: userId = ', userpassed, 'req.user._id', userauth);
|
||||
|
||||
@@ -288,7 +288,7 @@ module.exports = {
|
||||
SendMsgToParam: async function (idapp, params) {
|
||||
|
||||
try {
|
||||
console.log('SendMsgToParam', params.typesend);
|
||||
// console.log('SendMsgToParam', params.typesend, params.typemsg);
|
||||
|
||||
const { User } = require('../models/user');
|
||||
|
||||
@@ -414,7 +414,7 @@ module.exports = {
|
||||
text = tools.getContentNotifByParams(params, mycontent, shared_consts.TypeSend.TELEGRAM);
|
||||
if (telegid > 0) {
|
||||
risult = await telegrambot.local_sendMsgTelegramByIdTelegram(idapp, telegid, text);
|
||||
await tools.snooze(50);
|
||||
await tools.snooze(25);
|
||||
|
||||
textsent = risult.text;
|
||||
}
|
||||
@@ -434,6 +434,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
if (nummsgsent > 0) {
|
||||
if (nummsgsent != numrec && (numrec !== 1))
|
||||
console.log('FINE Invio Messaggi ! Inviati Totali: ', nummsgsent, 'su', numrec);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user