Aggio App
This commit is contained in:
@@ -1249,9 +1249,9 @@ router.post('/mgt', authenticate, async (req, res) => {
|
||||
locale = req.body.locale;
|
||||
|
||||
try {
|
||||
const {nummsgsent, numrec, textsent} = await telegrambot.sendMsgFromSiteToBotTelegram(idapp, req.user, mydata);
|
||||
const {nummsgsent, numrec, textsent, text} = await telegrambot.sendMsgFromSiteToBotTelegram(idapp, req.user, mydata);
|
||||
|
||||
return res.send({numrec, nummsgsent, textsent});
|
||||
return res.send({numrec, nummsgsent, textsent, text});
|
||||
|
||||
} catch (e) {
|
||||
res.status(400).send();
|
||||
|
||||
@@ -1194,6 +1194,7 @@ const MyTelegramBot = {
|
||||
let ris = {
|
||||
numrec: 0,
|
||||
nummsgsent: 0,
|
||||
text: '',
|
||||
};
|
||||
|
||||
let invia = false;
|
||||
@@ -1334,7 +1335,7 @@ async function local_sendMsgTelegram(idapp, username, text) {
|
||||
const teleg_id = await User.TelegIdByUsername(idapp, username);
|
||||
const cl = getclTelegByidapp(idapp);
|
||||
let ris = null;
|
||||
if (cl && teleg_id) {
|
||||
if (cl && teleg_id > 0) {
|
||||
ris = await cl.sendMsg(teleg_id, text);
|
||||
}
|
||||
|
||||
|
||||
@@ -354,6 +354,7 @@ module.exports = {
|
||||
|
||||
let numrec = 0;
|
||||
let nummsgsent = 0;
|
||||
let text = '';
|
||||
|
||||
if (invia) {
|
||||
|
||||
@@ -367,6 +368,7 @@ module.exports = {
|
||||
},
|
||||
).lean();
|
||||
|
||||
|
||||
for (const user of arrusers) {
|
||||
|
||||
const mytitle = await tools.convertSpecialTags(user, params.title);
|
||||
@@ -390,8 +392,9 @@ module.exports = {
|
||||
if (tools.isBitActive(params.typesend, shared_consts.TypeSend.TELEGRAM)) {
|
||||
const telegid = user.profile.teleg_id;
|
||||
|
||||
text = tools.getContentNotifByParams(params, mycontent, shared_consts.TypeSend.TELEGRAM);
|
||||
if (telegid > 0) {
|
||||
risult = await telegrambot.local_sendMsgTelegramByIdTelegram(idapp, telegid, tools.getContentNotifByParams(params, mycontent, shared_consts.TypeSend.TELEGRAM));
|
||||
risult = await telegrambot.local_sendMsgTelegramByIdTelegram(idapp, telegid, text);
|
||||
await tools.snooze(50);
|
||||
|
||||
textsent = risult.text;
|
||||
@@ -418,6 +421,7 @@ module.exports = {
|
||||
numrec,
|
||||
nummsgsent,
|
||||
textsent,
|
||||
text,
|
||||
};
|
||||
} catch (e) {
|
||||
console.error('SendMsgToParam', e);
|
||||
|
||||
Reference in New Issue
Block a user