feat(client): support inline message media contact
This commit is contained in:
parent
d75071c284
commit
f9336841ab
1 changed files with 34 additions and 0 deletions
|
@ -2,6 +2,7 @@ import { tl } from '@mtcute/tl'
|
||||||
import { BotKeyboard, ReplyMarkup } from '../keyboards'
|
import { BotKeyboard, ReplyMarkup } from '../keyboards'
|
||||||
import { TelegramClient } from '../../../client'
|
import { TelegramClient } from '../../../client'
|
||||||
import {
|
import {
|
||||||
|
InputMediaContact,
|
||||||
InputMediaGeo,
|
InputMediaGeo,
|
||||||
InputMediaGeoLive,
|
InputMediaGeoLive,
|
||||||
InputMediaVenue,
|
InputMediaVenue,
|
||||||
|
@ -101,6 +102,16 @@ export interface InputInlineMessageGame {
|
||||||
replyMarkup?: ReplyMarkup
|
replyMarkup?: ReplyMarkup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inline message containing a contact
|
||||||
|
*/
|
||||||
|
export interface InputInlineMessageContact extends InputMediaContact {
|
||||||
|
/**
|
||||||
|
* Message's reply markup
|
||||||
|
*/
|
||||||
|
replyMarkup?: ReplyMarkup
|
||||||
|
}
|
||||||
|
|
||||||
export type InputInlineMessage =
|
export type InputInlineMessage =
|
||||||
| InputInlineMessageText
|
| InputInlineMessageText
|
||||||
| InputInlineMessageMedia
|
| InputInlineMessageMedia
|
||||||
|
@ -108,6 +119,7 @@ export type InputInlineMessage =
|
||||||
| InputInlineMessageGeoLive
|
| InputInlineMessageGeoLive
|
||||||
| InputInlineMessageVenue
|
| InputInlineMessageVenue
|
||||||
| InputInlineMessageGame
|
| InputInlineMessageGame
|
||||||
|
| InputInlineMessageContact
|
||||||
|
|
||||||
export namespace BotInlineMessage {
|
export namespace BotInlineMessage {
|
||||||
/**
|
/**
|
||||||
|
@ -202,6 +214,17 @@ export namespace BotInlineMessage {
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an inline message containing a contact
|
||||||
|
*/
|
||||||
|
export function contact(
|
||||||
|
params: Omit<InputInlineMessageContact, 'type'>
|
||||||
|
): InputInlineMessageContact {
|
||||||
|
const ret = params as tl.Mutable<InputInlineMessageContact>
|
||||||
|
ret.type = 'contact'
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export async function _convertToTl(
|
export async function _convertToTl(
|
||||||
client: TelegramClient,
|
client: TelegramClient,
|
||||||
|
@ -279,6 +302,17 @@ export namespace BotInlineMessage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (obj.type === 'contact') {
|
||||||
|
return {
|
||||||
|
_: 'inputBotInlineMessageMediaContact',
|
||||||
|
phoneNumber: obj.phone,
|
||||||
|
firstName: obj.firstName,
|
||||||
|
lastName: obj.lastName ?? '',
|
||||||
|
vcard: obj.vcard ?? '',
|
||||||
|
replyMarkup: BotKeyboard._convertToTl(obj.replyMarkup),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return obj as never
|
return obj as never
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue