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