Bot description video & photo
This commit is contained in:
parent
24bdb104b0
commit
94d0414fb0
@ -3881,6 +3881,7 @@ export default class ChatBubbles {
|
||||
group: CHAT_ANIMATION_GROUP,
|
||||
loadPromises,
|
||||
autoDownload: this.chat.autoDownload,
|
||||
noInfo: message.mid < 0
|
||||
});
|
||||
//}
|
||||
} else {
|
||||
@ -4084,6 +4085,7 @@ export default class ChatBubbles {
|
||||
useSearch: !(message as Message.message).pFlags.is_scheduled,
|
||||
isScheduled: (message as Message.message).pFlags.is_scheduled
|
||||
} : undefined,
|
||||
noInfo: message.mid < 0
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@ -5336,7 +5338,10 @@ export default class ChatBubbles {
|
||||
}
|
||||
|
||||
const message = await this.generateLocalFirstMessage(false, (message) => {
|
||||
message.message = userFull.bot_info.description;
|
||||
const botInfo = userFull.bot_info;
|
||||
message.message = botInfo.description;
|
||||
if(botInfo.description_document) message.media = {_: 'messageMediaDocument', document: botInfo.description_document};
|
||||
if(botInfo.description_photo) message.media = {_: 'messageMediaPhoto', photo: botInfo.description_photo};
|
||||
});
|
||||
|
||||
if(!middleware()) {
|
||||
|
@ -68,7 +68,7 @@ export default async function wrapVideo({doc, container, message, boxWidth, boxH
|
||||
isOut?: boolean,
|
||||
middleware?: () => boolean,
|
||||
lazyLoadQueue?: LazyLoadQueue,
|
||||
noInfo?: true,
|
||||
noInfo?: boolean,
|
||||
noPlayButton?: boolean,
|
||||
group?: string,
|
||||
onlyPreview?: boolean,
|
||||
|
@ -26,7 +26,7 @@ export class AppPhotosManager extends AppManager {
|
||||
} = {};
|
||||
|
||||
public savePhoto(photo: Photo, context?: ReferenceContext) {
|
||||
if(photo._ === 'photoEmpty') return undefined;
|
||||
if(!photo || photo._ === 'photoEmpty') return;
|
||||
|
||||
/* if(photo.id === TEST_FILE_REFERENCE) {
|
||||
console.warn('Testing FILE_REFERENCE_EXPIRED');
|
||||
|
@ -19,6 +19,7 @@ import getPeerId from "./utils/peers/getPeerId";
|
||||
import getPhotoInput from "./utils/photos/getPhotoInput";
|
||||
import getParticipantPeerId from "./utils/chats/getParticipantPeerId";
|
||||
import ctx from "../../environment/ctx";
|
||||
import { ReferenceContext } from "../mtproto/referenceDatabase";
|
||||
|
||||
export type UserTyping = Partial<{userId: UserId, action: SendMessageAction, timeout: number}>;
|
||||
|
||||
@ -180,6 +181,13 @@ export class AppProfileManager extends AppManager {
|
||||
userFull.profile_photo = this.appPhotosManager.savePhoto(userFull.profile_photo, {type: 'profilePhoto', peerId});
|
||||
}
|
||||
|
||||
const botInfo = userFull.bot_info;
|
||||
if(botInfo) {
|
||||
const referenceContext: ReferenceContext = {type: 'userFull', userId: id};
|
||||
botInfo.description_document = this.appDocsManager.saveDoc(botInfo.description_document, referenceContext);
|
||||
botInfo.description_photo = this.appPhotosManager.savePhoto(botInfo.description_photo, referenceContext);
|
||||
}
|
||||
|
||||
this.appNotificationsManager.savePeerSettings({
|
||||
peerId,
|
||||
settings: userFull.notify_settings
|
||||
|
@ -10,7 +10,7 @@ import bytesToHex from "../../helpers/bytes/bytesToHex";
|
||||
import deepEqual from "../../helpers/object/deepEqual";
|
||||
import { AppManager } from "../appManagers/manager";
|
||||
|
||||
export type ReferenceContext = ReferenceContext.referenceContextProfilePhoto | ReferenceContext.referenceContextMessage | ReferenceContext.referenceContextEmojiesSounds | ReferenceContext.referenceContextReactions;
|
||||
export type ReferenceContext = ReferenceContext.referenceContextProfilePhoto | ReferenceContext.referenceContextMessage | ReferenceContext.referenceContextEmojiesSounds | ReferenceContext.referenceContextReactions | ReferenceContext.referenceContextUserFull;
|
||||
export namespace ReferenceContext {
|
||||
export type referenceContextProfilePhoto = {
|
||||
type: 'profilePhoto',
|
||||
@ -30,6 +30,11 @@ export namespace ReferenceContext {
|
||||
export type referenceContextReactions = {
|
||||
type: 'reactions'
|
||||
};
|
||||
|
||||
export type referenceContextUserFull = {
|
||||
type: 'userFull',
|
||||
userId: UserId
|
||||
};
|
||||
}
|
||||
|
||||
export type ReferenceBytes = Photo.photo['file_reference'];
|
||||
@ -139,6 +144,11 @@ export class ReferenceDatabase extends AppManager {
|
||||
break;
|
||||
}
|
||||
|
||||
case 'userFull': {
|
||||
promise = Promise.resolve(this.appProfileManager.getProfile(context.userId, true));
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
this.log.warn('refreshReference: not implemented context', context);
|
||||
return Promise.reject();
|
||||
|
@ -935,6 +935,10 @@ $bubble-beside-button-width: 38px;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.attachment {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.bubble-content-wrapper {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user