- Inserire l'immagine degli annunci sul bot Telegram
This commit is contained in:
@@ -5125,6 +5125,8 @@ module.exports = {
|
||||
let organizedby = '';
|
||||
let contributo = '';
|
||||
|
||||
let img = '';
|
||||
|
||||
if ((tablerec === shared_consts.TABLES_MYGOODS) || (tablerec === shared_consts.TABLES_MYSKILLS)) {
|
||||
iconascambio = this.getIconByAdType(myrec.adType);
|
||||
if (myrec.adType === shared_consts.AdType.OFFRO)
|
||||
@@ -5235,14 +5237,19 @@ module.exports = {
|
||||
out += this.addRowTelegram('👤', 'Contatto', contatto, true);
|
||||
}
|
||||
|
||||
|
||||
out += this.addRowTelegram('', `👉🏻 Vedi Annuncio completo su RISO`, url, true, true);
|
||||
|
||||
if (myrec.photos && myrec.photos.length > 0) {
|
||||
// prende la prima foto ! ;
|
||||
if (myrec.photos[0].imagefile)
|
||||
img = this.getURLImg(myrec.idapp, tablerec, myrec.username, myrec.photos[0].imagefile, false);
|
||||
}
|
||||
|
||||
console.log('out', out);
|
||||
|
||||
// out += i18n.__('ADDED_FROM', );
|
||||
|
||||
return { newdescr, newdescrtelegram: out }
|
||||
return { newdescr, newdescrtelegram: out, img };
|
||||
} catch (e) {
|
||||
console.error('Error', e);
|
||||
}
|
||||
@@ -5609,5 +5616,35 @@ module.exports = {
|
||||
|
||||
ImageDownloader,
|
||||
|
||||
getDirUpload() {
|
||||
return 'upload/'
|
||||
},
|
||||
|
||||
getURLImg(idapp, table, username, img, checkifExist) {
|
||||
let dirmain = '';
|
||||
|
||||
try {
|
||||
|
||||
let dir = this.getdirByIdApp(idapp) + dirmain + '/' + this.getDirUpload();
|
||||
|
||||
let foldermain = dir + 'profile/' + username;
|
||||
|
||||
img = foldermain + '/' + table + '/' + img;
|
||||
|
||||
if (checkifExist) {
|
||||
if (!fs.existsSync(img)) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
img = 'https://riso.app/upload/profile/SoniaVioletFlame/myskills/1000133092.jpg';
|
||||
|
||||
return img;
|
||||
} catch (e) {
|
||||
console.error('Err GetURLImg', e);
|
||||
return '';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user