- Chart Maps Nationality
- Username lowercase - Statistics - Telegram
This commit is contained in:
@@ -101,18 +101,18 @@ const StatusMSGALL = {
|
||||
|
||||
const txt = {
|
||||
MSG_SCEGLI_MENU: emoji.get('dizzy') + ' Scegli una voce di menu:' + emoji.get('dizzy'),
|
||||
MSG_ASK_USERNAME_BO: 'Inserire lo username con cui ti sei registrato sul sito:',
|
||||
MSG_ASK_USERNAME_BO: 'Inserire lo username con cui ti sei registrato sul sito %s:',
|
||||
MSG_ERRORE_USERNAME: 'Attenzione! Devi inserire solo lo username (20 caratteri massimo)',
|
||||
MSG_ERRORE_USERNAME_NOT_FOUND: 'Attenzione! Username non trovato in archivio. Verifica che sia corretto.',
|
||||
MSG_ERRORE_USERNAME_ANNULLA: 'Inserimento Annullato. Riprovare',
|
||||
MSG_OPERAZ_ANNULLATA: 'Operazione Annullata',
|
||||
MSG_ERRORE_VERIFY_CODE_MAXLEN: 'Attenzione! Devi inserire solo il codice a 6 cifre',
|
||||
MSG_VERIFY_CODE: 'Vai sul sito e scrivi qui il Codice di Autenticazione che vedrai visualizzato',
|
||||
MSG_VERIFY_CODE: 'Ritorna sul sito cliccando qui %s, poi torna qui e scrivi il Codice di Autenticazione che vedrai visualizzato',
|
||||
MSG_ERR_VERIFY_CODE: 'Codice di Verifica Errato! Controllare sul Sito e reinserire il nuovo codice di 6 cifre.',
|
||||
MSG_VERIFY_OK: emoji.get('grinning') + ' Benvenuto %s. Ora sei correttamente verificato!',
|
||||
MSG_VERIFY_OK: emoji.get('grinning') + ' Benvenuto %s. Sono il tuo BOT. Chiedi utilizzando il menu che trovi in basso.\nOra sei correttamente verificato!\nContinua la guida passo passo che trovi sul sito. Qui puoi ritornare per vedere La tua Lavagna in maniera rapida, senza passare dal sito.',
|
||||
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_APORTADOR_USER_REGISTERED: emo.FIRE + ' Si è appena Registrato %s\n(Invitato da %s)',
|
||||
MSG_APORTADOR_USER_REGISTERED: emo.FIRE + ' Si è appena Registrato "%s (n. %s)"\n(Invitato da %s)',
|
||||
MSG_MSG_SENT: emoji.get('envelope') + ' Messaggi Inviati !',
|
||||
};
|
||||
|
||||
@@ -131,6 +131,7 @@ module.exports = {
|
||||
notifyToTelegram: async function (phase, mylocalsconf) {
|
||||
let userdest = mylocalsconf.user.aportador_solidario;
|
||||
let NameFrom = `${mylocalsconf.user.name} ${mylocalsconf.user.surname}`;
|
||||
const ind_order = mylocalsconf.user.ind_order;
|
||||
|
||||
let aportador = '';
|
||||
if (userdest) {
|
||||
@@ -146,7 +147,7 @@ module.exports = {
|
||||
NameFrom = await User.getNameSurnameByUsername(mylocalsconf.idapp, userdest) + aportador;
|
||||
aportador = NameFrom;
|
||||
}
|
||||
text = printf(txt.MSG_APORTADOR_USER_REGISTERED, `${mylocalsconf.user.name} ${mylocalsconf.user.surname} (${mylocalsconf.user.username})`, aportador);
|
||||
text = printf(txt.MSG_APORTADOR_USER_REGISTERED, `${mylocalsconf.user.name} ${mylocalsconf.user.surname} (${mylocalsconf.user.username})`, ind_order, aportador);
|
||||
}
|
||||
|
||||
let addtext = "";
|
||||
@@ -275,14 +276,14 @@ class Telegram {
|
||||
}
|
||||
}
|
||||
|
||||
getsymb(symb, valid, isnum, verdeif, smileif) {
|
||||
getsymb(symb, valid, isnum, num, smileif) {
|
||||
let str = symb + ': ';
|
||||
if (valid)
|
||||
str += emo.CHECK_VERDE;
|
||||
else
|
||||
str += emo.CROSS_ROSSA;
|
||||
if (isnum) {
|
||||
str += ' ' + getemojibynumber(valid);
|
||||
str += ' ' + getemojibynumber(num);
|
||||
if (smileif)
|
||||
str += emo.SMILE_STAR;
|
||||
}
|
||||
@@ -317,7 +318,7 @@ class Telegram {
|
||||
// mystr += `____________________________________________\n`;
|
||||
|
||||
if (rec.user) {
|
||||
mystr += tools.get__('BENVENUTO', msg) + ' ' + rec.user.name + ' ' + emo.DIZZY;
|
||||
mystr += tools.get__('BENVENUTO', msg) + ' ' + rec.user.name + ' (' + rec.user.username + ') ' + emo.DIZZY;
|
||||
mystr += '\n' + '\n' + this.getsymb(emo.ENVELOPE, rec.user.verified_email);
|
||||
mystr += rec.user.verified_email ? tools.get__('EMAIL_VERIF', msg) : tools.get__('EMAIL_NON_VERIF', msg);
|
||||
|
||||
@@ -328,9 +329,9 @@ class Telegram {
|
||||
// mystr += tools.get__('TELEGRAM_NOT_CONNECTED', msg) + ' ' + emoji.get('e-mail');
|
||||
}
|
||||
|
||||
// numpersone = 3;
|
||||
// numpersone = 2;
|
||||
|
||||
mystr += '\n' + '\n' + this.getsymb(emo.INVITATI, numpersone, true, numpersone >= 2, numpersone >= 3) + tools.get__('INVITATI', msg) + '\n';
|
||||
mystr += '\n' + '\n' + this.getsymb(emo.INVITATI, numpersone >= 2, numpersone, numpersone, numpersone >= 3) + tools.get__('INVITATI', msg) + '\n';
|
||||
|
||||
if (numpersone > 0) {
|
||||
let index = 1;
|
||||
@@ -382,28 +383,31 @@ class Telegram {
|
||||
|
||||
let index = 1;
|
||||
listazoom.forEach((evento) => {
|
||||
let iniziata = false;
|
||||
if (nextzoom)
|
||||
iniziata = (nextzoom._id.toString() === evento._id.toString());
|
||||
let iniziata = false;
|
||||
if (nextzoom)
|
||||
iniziata = (nextzoom._id.toString() === evento._id.toString());
|
||||
|
||||
|
||||
if (iniziata) {
|
||||
mystr += emo.CHECK_VERDE + ' QUESTA CONFERENZA E\' INIZIATA! ' + emo.CHECK_VERDE + '\n';
|
||||
}
|
||||
|
||||
mystr += `${emo.EYES} ${tools.getstrDateTimeShort(evento.date_start)} ${emo.EYES}`;
|
||||
mystr += `\n${evento.title}\n(${evento.note})\n\n`;
|
||||
if (nextzoom) {
|
||||
if (iniziata) {
|
||||
mystr += emo.FIRE + 'CLICCA QUI PER ENTRARE ! ' + emo.FIRE + '\n';
|
||||
mystr += tools.getlinkzoom(evento.id_conf_zoom) + '\n\n';
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
if (iniziata) {
|
||||
mystr += emo.CHECK_VERDE + ' QUESTA CONFERENZA E\' INIZIATA! ' + emo.CHECK_VERDE + '\n';
|
||||
}
|
||||
)
|
||||
;
|
||||
|
||||
mystr += `${emo.EYES} ${tools.getstrDateTimeShort(evento.date_start)} ${emo.EYES}`;
|
||||
mystr += `\n${evento.title}\n(${evento.note})\n\n`;
|
||||
if (nextzoom) {
|
||||
if (iniziata) {
|
||||
mystr += emo.FIRE + 'CLICCA QUI PER ENTRARE ! ' + emo.FIRE + '\n';
|
||||
mystr += tools.getlinkzoom(evento.id_conf_zoom) + '\n\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
index++;
|
||||
});
|
||||
|
||||
if (!nextzoom && index > 1) {
|
||||
mystr += "LINK ZOOM DA CONDIVIDERE :\n" + tools.getlinkzoom(listazoom[0].id_conf_zoom) + '\n\n';
|
||||
}
|
||||
|
||||
|
||||
await
|
||||
@@ -429,8 +433,7 @@ class Telegram {
|
||||
if (rec.user) {
|
||||
const mystr = 'Scrivi qui un Messaggio da inviare a TUTTI:';
|
||||
rec.msgall_status = StatusMSGALL.ASK;
|
||||
await
|
||||
this.sendMsg(msg.chat.id, mystr, MenuAdmin);
|
||||
await this.sendMsg(msg.chat.id, mystr, MenuAdmin);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,6 +473,9 @@ class Telegram {
|
||||
async setUsernameBo(msg) {
|
||||
try {
|
||||
const rec = this.getRecInMem(msg);
|
||||
if (msg.text === undefined)
|
||||
return false;
|
||||
|
||||
console.log('msg.text', msg.text);
|
||||
const text = msg.text;
|
||||
if (text.length < 20) {
|
||||
@@ -480,15 +486,16 @@ class Telegram {
|
||||
const user = await
|
||||
User.findByUsername(this.idapp, rec.username_bo);
|
||||
if (!user) {
|
||||
await
|
||||
this.sendMsg(msg.from.id, txt.MSG_ERRORE_USERNAME_NOT_FOUND)
|
||||
await this.sendMsg(msg.from.id, txt.MSG_ERRORE_USERNAME_NOT_FOUND);
|
||||
rec.username_bo = '';
|
||||
} else {
|
||||
rec.user = user;
|
||||
await
|
||||
User.SetTelegramCheckCode(this.idapp, rec.username_bo, rec.code);
|
||||
rec.status = Status.WAITFOR_VERIFY_CODE;
|
||||
await
|
||||
this.sendMsg(msg.from.id, txt.MSG_VERIFY_CODE)
|
||||
this.sendMsg(msg.from.id, printf(txt.MSG_VERIFY_CODE, tools.getHostByIdApp(this.idapp)))
|
||||
|
||||
}
|
||||
}
|
||||
} else if (text.length === 0) {
|
||||
@@ -570,9 +577,9 @@ class Telegram {
|
||||
|
||||
if (usersall) {
|
||||
for (const rec of usersall) {
|
||||
await
|
||||
this.sendMsg(rec.profile.teleg_id, texttosend);
|
||||
await this.sendMsg(rec.profile.teleg_id, texttosend);
|
||||
nummsgsent++;
|
||||
// ++Todo: SLEEP ??? sleep(0.03)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -657,7 +664,7 @@ class Telegram {
|
||||
this.addUser(msg);
|
||||
|
||||
await
|
||||
this.sendMsg(msg.chat.id, getstr(msg.from.language_code, txt.MSG_ASK_USERNAME_BO));
|
||||
this.sendMsg(msg.chat.id, getstr(msg.from.language_code, printf(txt.MSG_ASK_USERNAME_BO, tools.getHostByIdApp(this.idapp))));
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -730,7 +737,7 @@ class Telegram {
|
||||
let keyb = MenuStandard;
|
||||
// Check if you are Admin
|
||||
const ismanager = await
|
||||
User.isManagerByIdTeleg(this.idapp, id);
|
||||
User.isAdminByIdTeleg(this.idapp, id);
|
||||
if (ismanager)
|
||||
keyb = MenuPerAdmin;
|
||||
if (menu) {
|
||||
|
||||
Reference in New Issue
Block a user