diff --git a/packages/client/src/client.ts b/packages/client/src/client.ts index f01be465..ceba2952 100644 --- a/packages/client/src/client.ts +++ b/packages/client/src/client.ts @@ -989,7 +989,6 @@ export interface TelegramClient extends BaseTelegramClient { * * @param latitude Latitude of the location * @param longitude Longitude of the location - */ getNearbyChats(latitude: number, longitude: number): Promise /** @@ -2295,7 +2294,7 @@ export interface TelegramClient extends BaseTelegramClient { */ clearDraft?: boolean } - ): Promise + ): Promise /** * Send a single media (a photo or a document-based media) * diff --git a/packages/client/src/methods/messages/send-media-group.ts b/packages/client/src/methods/messages/send-media-group.ts index be4d8b1d..fcced130 100644 --- a/packages/client/src/methods/messages/send-media-group.ts +++ b/packages/client/src/methods/messages/send-media-group.ts @@ -8,6 +8,8 @@ import { } from '../../types' import { normalizeDate, randomUlong } from '../../utils/misc-utils' import { tl } from '@mtcute/tl' +import { assertIsUpdatesGroup } from '../../utils/updates-utils' +import { createUsersChatsIndex } from '../../utils/peer-utils' /** * Send a group of media. @@ -75,7 +77,7 @@ export async function sendMediaGroup( */ clearDraft?: boolean } -): Promise { +): Promise { if (!params) params = {} const peer = await this.resolvePeer(chatId) @@ -123,5 +125,26 @@ export async function sendMediaGroup( clearDraft: params.clearDraft, }) - return this._findMessageInUpdate(res) + assertIsUpdatesGroup('_findMessageInUpdate', res) + this._handleUpdate(res, true) + + const { users, chats } = createUsersChatsIndex(res) + + return res.updates + .filter( + (u) => + u._ === 'updateNewMessage' || + u._ === 'updateNewChannelMessage' || + u._ === 'updateNewScheduledMessage' + ) + .map( + (u) => + new Message( + this, + (u as any).message, + users, + chats, + u._ === 'updateNewScheduledMessage' + ) + ) }