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

@@ -30,6 +30,7 @@ const i18n = require('i18n');
const shared_consts = require('../tools/shared_nodejs');
mongoose.Promise = global.Promise;
mongoose.level = 'F';
@@ -5387,6 +5388,8 @@ UserSchema.statics.addNewSite = async function (idappPass, body) {
};
if (arrSite && arrSite.length === 1 && numutenti < 2) {
const MyTelegramBot = require('../telegram/telegrambot');
// Nessun Sito Installato e Nessun Utente installato !
let myuser = new User();
myuser._id = new ObjectID();
@@ -5403,11 +5406,19 @@ UserSchema.statics.addNewSite = async function (idappPass, body) {
myuser.perm = '3';
myuser.profile.special_req = true;
myuser.profile.nationality = 'IT';
myuser.profile.manage_telegram = true;
myuser.profile.teleg_id = MyTelegramBot.ADMIN_IDTELEGRAM_SERVER;
myuser.profile.username_telegram = MyTelegramBot.ADMIN_USERNAME_TELEGRAM;
myuser.lasttimeonline = new Date();
myuser.date_reg = new Date();
await myuser.save();
const { MyBot } = require('../models/bot');
// Genera il Menu del BOT:
await MyBot.generateBotMenuRecords(idapp);
return { code: server_constants.RIS_CODE_OK, idapp };
}
}