Skip to content

Commit

Permalink
Added the required interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Feb 15, 2022
1 parent 4371263 commit 7d190bc
Show file tree
Hide file tree
Showing 6 changed files with 209 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/types/IDocument.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { IPhotoSize } from "./IIPhotoSize";
/**
* This object represents a general file (as opposed to photos, voice messages and audio files).
*/

export interface IDocument {
/**
* Identifier for this file, which can be used to download or reuse the file
*/
file_id: string;
/**
* Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
*/
file_unique_id: string;
/**
* Optional. Document thumbnail as defined by sender
*/
thumb?: IPhotoSize;
/**
* Optional. Original filename as defined by sender
*/
file_name?: string;
/**
* Optional. MIME type of the file as defined by sender
*/
mime_type?: string;
/**
* Optional. File size in bytes
*/
file_size?: number;
}
48 changes: 48 additions & 0 deletions src/types/IEncryptedPassportElement.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Contains information about documents or other Telegram Passport elements shared with the bot by the user.
*/

import { IPassportFile } from "./IPassportFile";

export interface IEncryptedPassportElement {
/**
* Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.
*/
type: string;
/**
* Optional. Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials.
*/
data: string;
/**
* Optional. User's verified phone number, available only for “phone_number” type
*/
phone_number?: string;
/**
* Optional. User's verified email address, available only for “email” type
*/
email?: string;
/**
* Optional. Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
*/
files?: IPassportFile[];
/**
* Optional. Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
*/
front_side?: IPassportFile;
/**
* Optional. Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
*/
reverse_side?: IPassportFile;
/**
* Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
*/
selfie?: IPassportFile;
/**
* Optional. Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
*/
translation?: IPassportFile[];
/**
* Base64-encoded element hash for using in PassportElementErrorUnspecified
*/
hash: string;
}
32 changes: 32 additions & 0 deletions src/types/IGame.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { IAnimation } from "./IIAnimation";
import { IPhotoSize } from "./IIPhotoSize";
import { IMessageEntity } from "./IMessageEntity";
/**
* This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
*/
export interface IGame {
/**
* Title of the game
*/
title: string;
/**
* Description of the game
*/
description: string;
/**
* Photo that will be displayed in the game message in chats.
*/
photo: IPhotoSize[];
/**
* Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
*/
text?: string;
/**
* Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc.
*/
text_entities?: IMessageEntity[];
/**
* Optional. Animation that will be displayed in the game message in chats. Upload via BotFather
*/
animation?: IAnimation;
}
44 changes: 44 additions & 0 deletions src/types/IIAnimation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { IPhotoSize } from "./IIPhotoSize";

/**
* This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
*/

export interface IAnimation {
/**
* Identifier for this file, which can be used to download or reuse the file
*/
file_id: string;
/**
* Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
*/
file_unique_id: string;
/**
* Video width as defined by sender
*/
width: number;
/**
* Video height as defined by sender
*/
height: number;
/**
* Duration of the video in seconds as defined by sender
*/
duration: number;
/**
* Optional. Animation thumbnail as defined by sender
*/
thumb?: IPhotoSize;
/**
* Optional. Original animation filename as defined by sender
*/
file_name?: string;
/**
* Optional. MIME type of the file as defined by sender
*/
mime_type?: string;
/**
* Optional. File size in bytes
*/
file_size?: number;
}
42 changes: 42 additions & 0 deletions src/types/IInlineKeyboardButton.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { ICallbackGame } from "./ICallbackGame";
import { ILoginUrl } from "./ILoginUrl";

/**
* This object represents one button of an inline keyboard. You must use exactly one of the optional fields.
*/

export interface IInlineKeyboardButton {
/**
* Label text on the button
*/
text: string;
/**
* Optional. HTTP or tg:// url to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings.
*/
url?: string;
/**
* Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.
*/
login_url?: ILoginUrl;
/**
* Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
*/
callback_data?: string;
/**
* Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot's username will be inserted.
*/
switch_inline_query?: string;
/**
* Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot's username will be inserted.
This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options.
*/
switch_inline_query_current_chat?: string;
/**
* Optional. Description of the game that will be launched when the user presses the button. NOTE: This type of button must always be the first button in the first row.
*/
callback_game?: ICallbackGame;
/**
* Optional. Specify True, to send a Pay button. NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
*/
pay?: boolean;
}
12 changes: 12 additions & 0 deletions src/types/IInlineKeyboardMarkup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { IInlineKeyboardButton } from "./IInlineKeyboardButton";

/**
* This object represents an inline keyboard that appears right next to the message it belongs to.
*/

export interface IInlineKeyboardMarkup {
/**
* Array of button rows, each represented by an Array of InlineKeyboardButton objects
*/
inline_keyboard: [IInlineKeyboardButton[]];
}

0 comments on commit 7d190bc

Please sign in to comment.