"Autoprodotto": metterlo come campo e filtro a parte ??
Se non hai l'USERNAME TELEGRAM presente, allora il BOT ti deve dire come fare per impostarlo. Creare una Chat di Help Supporto Tecnico
This commit is contained in:
@@ -49,6 +49,9 @@ const MyGoodSchema = new Schema({
|
||||
adType: {
|
||||
type: Number,
|
||||
},
|
||||
otherfilters: [{
|
||||
type: Number,
|
||||
}],
|
||||
photos: [
|
||||
{
|
||||
imagefile: {
|
||||
@@ -149,6 +152,7 @@ MyGoodSchema.statics.executeQueryTable = function(idapp, params) {
|
||||
idCity: 1,
|
||||
numLevel: 1,
|
||||
adType: 1,
|
||||
otherfilters: 1,
|
||||
photos: 1,
|
||||
note: 1,
|
||||
website: 1,
|
||||
@@ -236,6 +240,7 @@ MyGoodSchema.statics.getMyGoodById = function(idapp, idGood) {
|
||||
'idCity': 1,
|
||||
'numLevel': 1,
|
||||
adType: 1,
|
||||
otherfilters: 1,
|
||||
'photos': 1,
|
||||
note: 1,
|
||||
website: 1,
|
||||
@@ -288,6 +293,7 @@ MyGoodSchema.statics.getMyGoodById = function(idapp, idGood) {
|
||||
'idCity': 1,
|
||||
'numLevel': 1,
|
||||
adType: 1,
|
||||
otherfilters: 1,
|
||||
'photos': 1,
|
||||
'note': 1,
|
||||
website: 1,
|
||||
@@ -340,6 +346,7 @@ MyGoodSchema.statics.getMyGoodById = function(idapp, idGood) {
|
||||
'idCity': 1,
|
||||
'numLevel': 1,
|
||||
adType: 1,
|
||||
otherfilters: 1,
|
||||
'photos': 1,
|
||||
'note': 1,
|
||||
website: 1,
|
||||
@@ -392,6 +399,7 @@ MyGoodSchema.statics.getMyGoodById = function(idapp, idGood) {
|
||||
'idCity': 1,
|
||||
'numLevel': 1,
|
||||
adType: 1,
|
||||
otherfilters: 1,
|
||||
'photos': 1,
|
||||
'note': 1,
|
||||
website: 1,
|
||||
@@ -444,6 +452,7 @@ MyGoodSchema.statics.getMyGoodById = function(idapp, idGood) {
|
||||
'idCity': 1,
|
||||
'numLevel': 1,
|
||||
adType: 1,
|
||||
otherfilters: 1,
|
||||
'photos': 1,
|
||||
'note': 1,
|
||||
website: 1,
|
||||
|
||||
@@ -65,6 +65,9 @@ const SiteSchema = new Schema({
|
||||
telegram_bot_name_test: {
|
||||
type: String,
|
||||
},
|
||||
telegram_support_chat: {
|
||||
type: String,
|
||||
},
|
||||
pathreg_add: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
@@ -598,6 +598,8 @@ UserSchema.statics.findByUsername = async function(idapp, username, alsoemail) {
|
||||
const myreg = ['^', username, '$'].join('');
|
||||
let regexusername = new RegExp(myreg, 'i');
|
||||
|
||||
//++TODO: Set only the necessary fields to get in memory
|
||||
|
||||
return User.findOne({
|
||||
idapp: idapp,
|
||||
username: {$regex: regexusername},
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
module.exports = {
|
||||
list: [
|
||||
{
|
||||
_id: 1,
|
||||
istat: 'Istat',
|
||||
comune: 'Comune',
|
||||
prov: 'Provincia',
|
||||
reg: 'Regione',
|
||||
pref: 'Prefisso',
|
||||
cap: 'CAP',
|
||||
abitanti: 'CodFisco',
|
||||
country: 'IT',
|
||||
},
|
||||
{
|
||||
_id: 2,
|
||||
istat: '028001',
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = {
|
||||
{_id: 16, idSectorGood: [3], descr: 'Van (furgoni camperizzati)'},
|
||||
{_id: 17, idSectorGood: [4], descr: 'Bigiotteria'},
|
||||
{_id: 18, idSectorGood: [4], descr: 'Lavoretti'},
|
||||
{_id: 19, idSectorGood: [4], descr: 'Mangia e bevi'},
|
||||
{_id: 19, idSectorGood: [4], descr: 'Altro'},
|
||||
{_id: 20, idSectorGood: [5], descr: 'Accessori bellezza'},
|
||||
{_id: 21, idSectorGood: [5], descr: 'Creme e detergenti'},
|
||||
{_id: 22, idSectorGood: [5], descr: 'Trucchi e profumi'},
|
||||
|
||||
@@ -3,7 +3,7 @@ module.exports = {
|
||||
{_id: 1, descr: 'Abbigliamento'},
|
||||
{_id: 2, descr: 'Arredamento'},
|
||||
{_id: 3, descr: 'Auto e Moto'},
|
||||
{_id: 4, descr: 'Autoproduzione'},
|
||||
{_id: 4, descr: 'Artigianato'},
|
||||
{_id: 5, descr: 'Bellezza e Igiene'},
|
||||
{_id: 6, descr: 'Bimbi'},
|
||||
{_id: 7, descr: 'Cibo'},
|
||||
|
||||
@@ -955,7 +955,7 @@ async function eseguiDbOp(idapp, mydata, locale) {
|
||||
|
||||
// Svuota e Ricrea
|
||||
|
||||
const {City} = require('../modWels/city');
|
||||
const {City} = require('../models/city');
|
||||
const {Province} = require('../models/province');
|
||||
|
||||
await City.deleteMany({});
|
||||
|
||||
@@ -458,8 +458,27 @@ const txt = {
|
||||
MSG_ERR_VERIFY_CODE: 'Codice di Verifica Errato!' + emo.EXCLAMATION_MARK +
|
||||
'\nControlla sul sito %s e riscrivi il nuovo codice di 6 cifre.',
|
||||
MSG_VERIFY_OK: emoji.get('grinning') +
|
||||
' Benvenuto %s! Ti sei correttamente verificato con il BOT. ' +
|
||||
'\nSono il tuo assistente virtuale.\n',
|
||||
' ✅🌈 Benvenuto %s!\n' +
|
||||
'Ti sei correttamente verificato con il BOT. ' +
|
||||
'\nSono il tuo assistente virtuale (BOT).\n\n' +
|
||||
'Questa chat ti servirà per interagire con la Piattaforma e per ricevere delle notifiche Personali.\n' +
|
||||
''+
|
||||
'(🆘 Per Aiuti, guarda il menu qui sotto)\n\n' +
|
||||
''+
|
||||
'😍😍😍 Ora sei pronto per Entrare nella APP!',
|
||||
MSG_SET_USERNAME: '✨✨✨✨✨✨✨✨✨✨\n' +
|
||||
'🔑 Devi impostare un Username per Telegram:\n' +
|
||||
'\n' +
|
||||
'👉🏻 1. Premi sull\'icona (tre linee orizzontali) del <b>menu principale</b> in alto a sinistra.\n' +
|
||||
'👉🏻 2. Seleziona la voce <b>Impostazioni</b> nel menu.\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' +
|
||||
'👉🏻 5. Per confermare premi sull\'icona con la spunta in alto a destra.\n' +
|
||||
'🏁 Infine scrivi OK su questa chat. \n\n' +
|
||||
'💬 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' +
|
||||
'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.',
|
||||
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. %s)\nInvitato da %s',
|
||||
@@ -1413,6 +1432,12 @@ class Telegram {
|
||||
return tools.getHostByIdApp(this.idapp) + '/faq';
|
||||
}
|
||||
|
||||
getstrChatHelp() {
|
||||
return 'Clicca qui per entrare nella Chat HELP di Supporto\n' +
|
||||
tools.getTelegramSupportChat(this.idapp) +
|
||||
'\n\nI miei colleghi umani ti aiuteranno a risolvere !';
|
||||
}
|
||||
|
||||
async IsTesto(msg) {
|
||||
|
||||
let risp = '';
|
||||
@@ -1480,6 +1505,25 @@ class Telegram {
|
||||
|
||||
const menusite = await this.isMenuSite(this.idapp, testo, lang, id);
|
||||
|
||||
if (rec.status === Status.VERIFIED) {
|
||||
if (rec.user) {
|
||||
if (rec.user.profile.username_telegram && msg.from.id > 0 && !msg.from.username) {
|
||||
rec.user.profile.username_telegram = msg.from.username
|
||||
await User.setUsernameTelegram(this.idapp, rec.user._id, msg.from.username || '', msg.from.first_name || '', msg.from.last_name || '');
|
||||
}
|
||||
|
||||
if (!rec.user.profile.username_telegram && msg.from.username) {
|
||||
rec.user.profile.username_telegram = msg.from.username
|
||||
await User.setUsernameTelegram(this.idapp, rec.user._id, msg.from.username || '', msg.from.first_name || '', msg.from.last_name || '');
|
||||
this.sendMsg(msg.from.id, printf(getstr(rec.user.lang, 'MSG_SET_USERNAME_OK')));
|
||||
} else {
|
||||
if (!rec.user.profile.username_telegram) {
|
||||
return this.checkIfUsernameTelegramSet(msg, rec.user);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (risp === '') {
|
||||
if (menusite) {
|
||||
risp = this.getValueMenu(this.idapp, testo, lang);
|
||||
@@ -1561,9 +1605,7 @@ class Telegram {
|
||||
'il più grande esperimento dell\'Uomo di ipnosi di massa, riempiendo di bugie i media mondiali, che servono sostanzialmente a controllare i popoli.' +
|
||||
'E con questo ti ho detto tutto. :D ';
|
||||
} else if (MsgBot.AIUTO.find((rec) => testo.indexOf(rec) > -1)) {
|
||||
risp = 'Clicca qui per entrare nella Chat HELP di Supporto\n' +
|
||||
tools.HELP_CHAT +
|
||||
'\n\nI miei colleghi umani ti aiuteranno a risolvere !';
|
||||
risp = this.getstrChatHelp();
|
||||
} else if (MsgBot.SPOSAMI.find((rec) => testo.indexOf(rec) > -1)) {
|
||||
risp = 'No Grazie! Sono per la Libertà a Vita! ' + emo.JOY +
|
||||
'\nMa se vuoi possiamo conoscerci meglio!' + emo.DANCER + emo.FIRE;
|
||||
@@ -2375,6 +2417,20 @@ class Telegram {
|
||||
}
|
||||
}
|
||||
|
||||
checkIfUsernameTelegramSet(msg, recuser) {
|
||||
try {
|
||||
if (!msg.from.username) {
|
||||
//
|
||||
this.sendMsg(msg.from.id,
|
||||
printf(getstr(recuser.lang, 'MSG_SET_USERNAME')));
|
||||
|
||||
return true;
|
||||
}
|
||||
}catch (e) {
|
||||
console.error('e');
|
||||
}
|
||||
}
|
||||
|
||||
async setVerifyCode(msg) {
|
||||
try {
|
||||
if (!!msg.text) {
|
||||
@@ -2407,6 +2463,8 @@ class Telegram {
|
||||
let name = recuser.name;
|
||||
this.sendMsg(msg.from.id,
|
||||
printf(getstr(recuser.lang, 'MSG_VERIFY_OK'), name));
|
||||
|
||||
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.sendMsg(msg.from.id,
|
||||
@@ -2788,8 +2846,7 @@ class Telegram {
|
||||
await this.isMenu(rec, msg);
|
||||
}
|
||||
} else {
|
||||
await
|
||||
this.isMenuNotVerified(rec, msg);
|
||||
await this.isMenuNotVerified(rec, msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3170,6 +3227,7 @@ class Telegram {
|
||||
|
||||
async sendMsg(id, text, menu, form, msg_id, chat_id, ripr_menuPrec) {
|
||||
|
||||
try {
|
||||
if (text.length > 4090) {
|
||||
let text1 = text.slice(0, 4090);
|
||||
let text2 = text.slice(4090, text.length);
|
||||
@@ -3181,6 +3239,9 @@ class Telegram {
|
||||
return await this._inviaMsg(id, text, form, menu, msg_id, chat_id,
|
||||
ripr_menuPrec);
|
||||
}
|
||||
}catch (e) {
|
||||
console.error('Error sendMsg', e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3317,6 +3378,7 @@ if (true) {
|
||||
try {
|
||||
const token = tools.getTelegramKeyByIdApp(idapp);
|
||||
const nomebot = tools.getTelegramBotNameByIdApp(idapp);
|
||||
|
||||
// console.log('idapp', idapp, 'token', token);
|
||||
|
||||
if (!!token) {
|
||||
|
||||
@@ -1146,6 +1146,17 @@ module.exports = {
|
||||
return (myapp) ? myapp.telegram_bot_name : '';
|
||||
},
|
||||
|
||||
getTelegramSupportChat: function(idapp) {
|
||||
try {
|
||||
const myapp = this.getApps().find((item) => item.idapp === idapp);
|
||||
return (myapp && myapp.telegram_support_chat)
|
||||
? myapp.telegram_support_chat
|
||||
: '';
|
||||
}catch (e) {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
|
||||
getTelegramKeyByIdApp: function(idapp) {
|
||||
const myarr = this.getApps();
|
||||
const myapp = myarr.find((item) => item.idapp === idapp);
|
||||
|
||||
Reference in New Issue
Block a user