Payeer e AdvCash

This commit is contained in:
Paolo Arena
2020-09-04 00:06:49 +02:00
parent 4e59979efd
commit 0ce46aab1e
22 changed files with 425 additions and 111 deletions

View File

@@ -244,8 +244,13 @@ const NOME_COGNOME = 'nomecognome';
const CHEDI_SE_IMBARCARTI = 'chiedi_se_imbarcarti';
const InlineCmd = {
VOGLIO_IMBARCARMI: 'voglio_imbarcarmi',
NON_VOGLIO_IMBARCARMI: 'non_voglio_imbarcarmi'
VOGLIO_IMBARCARMI: 'w_imb',
NON_VOGLIO_IMBARCARMI: 'nw_imb'
};
const InlineZoomConferma = {
CONFERMA_ZOOM_PRESENZA: 'conf_pres',
NON_CONFERMA_ZOOM_PRESENZA: 'nonconf_pres'
};
const SendMsgCmd = [CONTA_SOLO, RICEVI_EMAIL, NOME_COGNOME, CHEDI_SE_IMBARCARTI];
@@ -473,6 +478,30 @@ module.exports = {
REGISTRATION: 1
},
getFormDaMostrare: function (idapp, myfunc, myuser) {
FormDaMostrare = null;
const cl = getclTelegByidapp(idapp);
if (myfunc === shared_consts.CallFunz.ZOOM_GIA_PARTECIPATO) {
FormDaMostrare = cl.getInlineKeyboard(myuser.lang, [
{
text: 'Conferma Presenza Zoom',
// callback_data: { action: InlineZoomConferma.CONFERMA_ZOOM_PRESENZA, username: myuser.username }
callback_data: InlineZoomConferma.CONFERMA_ZOOM_PRESENZA + '|' + myuser.username
},
{
text: 'Annulla Presenza Zoom',
// callback_data: { action: InlineZoomConferma.NON_CONFERMA_ZOOM_PRESENZA, username: myuser.username }
callback_data: InlineZoomConferma.NON_CONFERMA_ZOOM_PRESENZA + '|' + myuser.username
},
]);
}
return FormDaMostrare;
},
getCiao: function (idapp, username, lang) {
return tools.gettranslate('CIAO', lang) + ' ' + username + '!\n';
},
@@ -511,7 +540,7 @@ module.exports = {
},
sendMsgTelegramToTheManagers: async function (idapp, text, onlyintofile) {
sendMsgTelegramToTheManagers: async function (idapp, text, onlyintofile, MyForm = null) {
tools.writeManagersLog(text);
@@ -519,8 +548,26 @@ module.exports = {
const usersmanagers = await User.getusersManagers(idapp);
if (usersmanagers) {
for (const rec of usersmanagers) {
await this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, emo.ROBOT_FACE + ': ' + text, undefined, undefined, true);
await tools.snooze(200)
await this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, emo.ROBOT_FACE + ': ' + text, undefined, undefined, true, MyForm);
await tools.snooze(100)
}
}
}
return true
},
sendMsgTelegramToTheManagersAndZoomeri: async function (idapp, text, onlyintofile, MyForm = null) {
tools.writeManagersLog(text);
if (!onlyintofile) {
// const usersmanagers = await User.getusersManagersAndZoomeri(idapp);
const usersmanagers = await User.getusersManagers(idapp);
if (usersmanagers) {
for (const rec of usersmanagers) {
await this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, emo.ROBOT_FACE + ': ' + text, undefined, undefined, true, MyForm);
await tools.snooze(100)
}
}
}
@@ -560,6 +607,10 @@ module.exports = {
msg = msg.replace('{link_paypalme}', user.profile.link_payment);
if (!!user.profile.revolut)
msg = msg.replace('{revolut}', user.profile.revolut);
if (!!user.profile.payeer_id)
msg = msg.replace('{payeer_id}', user.profile.payeer_id);
if (!!user.profile.advcash_id)
msg = msg.replace('{advcash_id}', user.profile.advcash_id);
if (!!user.profile.email_paypal)
msg = msg.replace('{email_paypal}', user.profile.email_paypal);
if (!!user.profile.note_payment)
@@ -691,7 +742,7 @@ module.exports = {
strout += '\n (' + index + ') ' + user.name + ' ' + user.surname + ':';
if (mydata.inviareale) {
await this.sendMsgTelegramByIdTelegram(idapp, idteleg, mymsg, undefined, undefined, true);
await tools.snooze(300);
await tools.snooze(100);
strout += ' -> (MSG OK)';
if (mydata.inviaemail && !!user.email) {
@@ -836,7 +887,7 @@ module.exports = {
return ris;
},
sendMsgTelegramByIdTelegram: async function (idapp, idtelegram, text, message_id, chat_id, ripr_menuPrec) {
sendMsgTelegramByIdTelegram: async function (idapp, idtelegram, text, message_id, chat_id, ripr_menuPrec, MyForm = null) {
if (!idtelegram)
return;
@@ -844,7 +895,7 @@ module.exports = {
if (cl && idtelegram) {
let myform = null;
return await cl.sendMsg(idtelegram, text, null, null, message_id, chat_id, ripr_menuPrec)
return await cl.sendMsg(idtelegram, text, null, MyForm, message_id, chat_id, ripr_menuPrec)
}
}
@@ -912,7 +963,7 @@ async function local_sendMsgTelegramToTheManagers(idapp, text, msg, username_bo)
if (cl && idtelegram) {
await cl.sendMsg(idtelegram, text, undefined, undefined, undefined, undefined, true)
}
await tools.snooze(300)
await tools.snooze(100)
}
}
return true
@@ -1357,7 +1408,6 @@ class Telegram {
ispayment(user) {
if (user) {
let ispaypal = false;
if (!!user.profile.paymenttypes) {
/*if (user.profile.paymenttypes.includes('paypal')) {
if (user.profile.email_paypal) {
@@ -1737,7 +1787,7 @@ class Telegram {
let help = "";
let helpaperta = true;
if (tools.isMonToSat() && tools.isBetweenTwoTime('8:00:00', '19:50:00')) {
if (tools.isMonToFri() && tools.isBetweenTwoTime('9:00:00', '19:00:00')) {
help = '✅ ' + this.getlink('help');
} else {
help = "🔴 [ORA CHIUSA - NOW CLOSED]";
@@ -2021,11 +2071,13 @@ class Telegram {
FormDaMostrare = this.getInlineKeyboard(lang, [
{
text: Menu[lang].SI,
callback_data: { action: InlineCmd.VOGLIO_IMBARCARMI, username: utente.username }
// callback_data: { action: InlineCmd.VOGLIO_IMBARCARMI, username: utente.username }
callback_data: InlineCmd.VOGLIO_IMBARCARMI + '|' + utente.username
},
{
text: Menu[lang].NO,
callback_data: { action: InlineCmd.NON_VOGLIO_IMBARCARMI, username: utente.username }
// callback_data: { action: InlineCmd.NON_VOGLIO_IMBARCARMI, username: utente.username }
callback_data: InlineCmd.NON_VOGLIO_IMBARCARMI + '|' + utente.username
},
]);
inviaveramente = true;
@@ -2053,16 +2105,16 @@ class Telegram {
// break;
}
await tools.snooze(300);
await tools.snooze(100);
nummsgsent++;
}
if (!SendMsgCmd.includes(cmd)) {
if ((nummsgsent % 50) === 0) {
myid = await this.sendMsg(msg.chat.id, nummsgsent + ' ' + getstr(this.getlang(msg), 'MSG_MSG_INCORSO'), null, { message_id: myid });
await tools.snooze(300)
if ((nummsgsent % 100) === 0) {
myid = await this.sendMsg(msg.chat.id, nummsgsent + ' ' + getstr(this.getlang(msg), 'MSG_MSG_INCORSO'), null, null, myid);
await tools.snooze(100)
}
}
}
@@ -2404,6 +2456,7 @@ class Telegram {
return res;
} catch (e) {
console.error(e);
return 0
}
}
@@ -2627,7 +2680,22 @@ if (!tools.testing()) {
const myclTelegram = getclTelegBytoken(bot.token);
const data = callbackQuery.data;
let dataarr = [];
let data = {
action: 0,
username: ''
};
const datastr = callbackQuery.data;
if (!!datastr) {
dataarr = datastr.split("|");
if (!!dataarr) {
data = {
action: dataarr[0],
username: dataarr[1],
}
}
}
const msg = callbackQuery.message;
const opts = {
chat_id: msg.chat.id,
@@ -2654,6 +2722,14 @@ if (!tools.testing()) {
const msgadd = '[' + user.username + '] ' + user.name + ' ' + user.surname + ' ha risposto che NON VUOLE IMBARCARSI !';
await local_sendMsgTelegramToTheManagers(user.idapp, msgadd, msg, false); // Anche a STAFF
} else if (data.action === InlineZoomConferma.CONFERMA_ZOOM_PRESENZA) {
await User.setZoomPresenza(user.idapp, user._id, true);
} else if (data.action === InlineZoomConferma.NON_CONFERMA_ZOOM_PRESENZA) {
await User.setZoomPresenza(user.idapp, user._id, false);
}
}
}