refactor(client): removed type modification from sendText and sendPhoto return types

This commit is contained in:
teidesu 2021-04-10 11:54:31 +03:00
parent 97e6eb1403
commit 0901f97e0d
4 changed files with 8 additions and 11 deletions

View file

@ -53,11 +53,10 @@ import { Readable } from 'stream'
import { import {
Chat, Chat,
FileDownloadParameters, FileDownloadParameters,
InputFileLike,
InputPeerLike, InputPeerLike,
MaybeDynamic, MaybeDynamic,
InputFileLike,
Message, Message,
Photo,
PropagationSymbol, PropagationSymbol,
ReplyMarkup, ReplyMarkup,
SentCode, SentCode,
@ -809,7 +808,7 @@ export class TelegramClient extends BaseTelegramClient {
*/ */
progressCallback?: (uploaded: number, total: number) => void progressCallback?: (uploaded: number, total: number) => void
} }
): Promise<filters.Modify<Message, { media: Photo }>> { ): Promise<Message> {
return sendPhoto.apply(this, arguments) return sendPhoto.apply(this, arguments)
} }
/** /**
@ -866,7 +865,7 @@ export class TelegramClient extends BaseTelegramClient {
*/ */
replyMarkup?: ReplyMarkup replyMarkup?: ReplyMarkup
} }
): Promise<filters.Modify<Message, { media: null }>> { ): Promise<Message> {
return sendText.apply(this, arguments) return sendText.apply(this, arguments)
} }
/** /**

View file

@ -14,7 +14,6 @@ import {
SentCode, SentCode,
MaybeDynamic, MaybeDynamic,
InputPeerLike, InputPeerLike,
Photo,
UploadedFile, UploadedFile,
UploadFileLike, UploadFileLike,
InputFileLike, InputFileLike,

View file

@ -85,7 +85,7 @@ export async function sendPhoto(
*/ */
progressCallback?: (uploaded: number, total: number) => void progressCallback?: (uploaded: number, total: number) => void
} }
): Promise<filters.Modify<Message, { media: Photo }>> { ): Promise<Message> {
if (!params) params = {} if (!params) params = {}
let media: tl.TypeInputMedia let media: tl.TypeInputMedia
@ -145,5 +145,5 @@ export async function sendPhoto(
entities, entities,
}) })
return this._findMessageInUpdate(res) as any return this._findMessageInUpdate(res)
} }

View file

@ -5,7 +5,6 @@ import { normalizeDate, randomUlong } from '../../utils/misc-utils'
import { import {
InputPeerLike, InputPeerLike,
Message, Message,
filters,
BotKeyboard, BotKeyboard,
ReplyMarkup, ReplyMarkup,
} from '../../types' } from '../../types'
@ -66,7 +65,7 @@ export async function sendText(
*/ */
replyMarkup?: ReplyMarkup replyMarkup?: ReplyMarkup
} }
): Promise<filters.Modify<Message, { media: null }>> { ): Promise<Message> {
if (!params) params = {} if (!params) params = {}
const [message, entities] = await this._parseEntities( const [message, entities] = await this._parseEntities(
@ -107,8 +106,8 @@ export async function sendText(
entities: res.entities, entities: res.entities,
} }
return new Message(this, msg, {}, {}) as any return new Message(this, msg, {}, {})
} }
return this._findMessageInUpdate(res) as any return this._findMessageInUpdate(res)
} }