Abilitazione del BOT

This commit is contained in:
Surya Paolo
2023-12-17 16:20:44 +01:00
parent 4290895a97
commit c71f4af370
8 changed files with 221 additions and 13 deletions

View File

@@ -1804,7 +1804,7 @@ module.exports = {
getTelegramBotNameByIdApp: function (idapp) {
const myapp = this.MYAPPS.find((item) => item.idapp === idapp);
if (process.env.NODE_ENV === 'test')
if (process.env.NODE_ENV === 'test' || process.env.NODE_ENV === 'development')
return (myapp) ? myapp.telegram_bot_name_test : '';
else
return (myapp) ? myapp.telegram_bot_name : '';
@@ -1823,12 +1823,30 @@ module.exports = {
getTelegramKeyByIdApp: function (idapp) {
const myapp = this.MYAPPS.find((item) => item.idapp === idapp);
if (process.env.NODE_ENV === 'test')
if (process.env.NODE_ENV === 'test' || process.env.NODE_ENV === 'development')
return (myapp) ? myapp.telegram_key_test : '';
else
return (myapp) ? myapp.telegram_key : '';
},
getArrTelegramFromSite: function () {
const myapp = this.MYAPPS;
let arrteleg = []
for (const site of myapp) {
if (site.active) {
if (process.env.NODE_ENV === 'test') {
if (myapp.load_process_telegram_test)
arrteleg.push(myapp.idapp)
} else {
if (myapp.load_process_telegram)
arrteleg.push(myapp.idapp)
}
}
}
return arrteleg;
},
getLookupPipeLine(params, proj) {
let myquery = [
@@ -4025,7 +4043,11 @@ module.exports = {
if (!msg)
return msg;
if (!!user) {
if (msg.includes('{host}')) {
msg = msg.replace('{host}', this.getHostByIdApp(user.idapp));
}
if (msg.includes('{appname}'))
msg = msg.replace('{appname}', this.getNomeAppByIdApp(user.idapp));
msg = msg.replace('{username}', user.username);