Corretto le richieste di amicizie, aggiunto Accettazione sul BOT
This commit is contained in:
@@ -122,7 +122,7 @@ const textlang = {
|
||||
'NAVE': 'NAVE',
|
||||
'MSG_SEND_FROM': 'Msg Inviato da',
|
||||
'ZOOM_CONFERMATO': 'Sei stato confermato ad aver visto la Video Conferenza di Benvenuto!',
|
||||
'RICHIESTA_AMICIZIA': 'Richiesta d\'Amicizia da parte di %s',
|
||||
'RICHIESTA_AMICIZIA': '🌈 Richiesta d\'Amicizia da parte di %s',
|
||||
'ACCETTATO_SUL_GRUPPO': 'Sei stato accettato da %s a far parte del Gruppo %s',
|
||||
'ACCETTATO_NOTIFICA_ADMINS': 'l\'utente %s è stato accettato a far parte del Gruppo %s',
|
||||
'RICHIESTA_GRUPPO': 'Richiesta di entrare nel Gruppo %s da parte di %s',
|
||||
@@ -831,18 +831,21 @@ module.exports = {
|
||||
|
||||
},
|
||||
|
||||
sendNotificationByUsername: async function(
|
||||
idapp, username, cmd, telegram, usernameOrig) {
|
||||
sendNotificationByUsername: async function(idapp, username, cmd, telegram, usernameOrig) {
|
||||
|
||||
var {User} = require('../models/user');
|
||||
|
||||
const user = await User.findOne({idapp, username}, {_id: 1, lang: 1});
|
||||
const telegrambot = require('../telegram/telegrambot');
|
||||
|
||||
const user = await User.findOne({idapp, username}, {_id: 1, username:1, lang: 1}).lean();
|
||||
if (!user)
|
||||
return;
|
||||
|
||||
let userId = user._id;
|
||||
let lang = user.lang;
|
||||
|
||||
let sendnotif = true;
|
||||
|
||||
let title = this.getNomeAppByIdApp(idapp);
|
||||
let descr = '';
|
||||
let openUrl = '/';
|
||||
@@ -853,6 +856,13 @@ module.exports = {
|
||||
descr = printf(this.get__('RICHIESTA_AMICIZIA', lang), usernameOrig);
|
||||
openUrl = '/my/' + usernameOrig;
|
||||
tag = 'reqfriends';
|
||||
|
||||
const userrecDest = await User.getUserShortDataByUsername(idapp, usernameOrig);
|
||||
|
||||
if (userrecDest) {
|
||||
sendnotif = false; // non lo rimandare 2 volte !
|
||||
telegrambot.askConfirmationUserFriend(idapp, shared_consts.CallFunz.RICHIESTA_AMICIZIA, userrecDest, username, usernameOrig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -861,8 +871,7 @@ module.exports = {
|
||||
actions);
|
||||
}
|
||||
|
||||
if (telegram) {
|
||||
const telegrambot = require('../telegram/telegrambot');
|
||||
if (telegram && sendnotif) {
|
||||
|
||||
const idtelegram = await User.TelegIdByUsername(idapp, username);
|
||||
|
||||
@@ -2736,7 +2745,7 @@ module.exports = {
|
||||
let msg = '';
|
||||
try {
|
||||
const name = myuser.username +
|
||||
(myuser.name ? `(${myuser.name} + ' ' + ${myuser.surname})` : '');
|
||||
(myuser.name ? ` (${myuser.name} ${myuser.surname})` : '');
|
||||
const linkuserprof = this.getHostByIdApp(idapp) + '/my/' +
|
||||
myuser.username;
|
||||
|
||||
@@ -2751,7 +2760,7 @@ module.exports = {
|
||||
: surname_telegram;
|
||||
|
||||
if (u_tg) {
|
||||
msg += '<br>Profilo su Telegram [' + name_tg + ' ' + surname_tg + ']:<br>' + 'https://t.me/' + u_tg;
|
||||
msg += `<br>Profilo su Telegram [${name_tg} ${surname_tg}]:<br>https://t.me/${u_tg}`;
|
||||
}
|
||||
}catch (e) {
|
||||
console.error('getUserInfoMsg', e);
|
||||
|
||||
Reference in New Issue
Block a user